delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2020/06/10/21:06:23

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9804A3885C19
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1591837539;
bh=oXN2vVAANdW6Ks6LdqoIKaMYeoyby9IZoymWX2PC5ng=;
h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post:
List-Help:List-Subscribe:From:Reply-To:From;
b=LxHV57SjoLv/vO3flR131B3pKY6jwSvy2lKvJWxsaHoyCXvsjeKKHQjX09qUDGlLF
srKpmiSaoNuadcIuOgrE+JdhmFZmneJbXNuGYDo0QodAEkFIJWH0SbTZ5i4qcETrjd
dAkkPwmak7oy04rz/DzGzDfKywBdHBv/uxuApfK4=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D8802383E805
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
bh=lP8dcq0rRTzUDHVBmMdaPxfnBaBBu8avqeQ05utZ3p8=;
b=V6Mf7JDg7aTgw+5rJEdy6u3a0+bwsDFvUJMfasz22X0NU3mtSWS68nUzCpDDuQBcoL
ueFcDAb20tz72wtHqXMSeQjQ037ArDYe8R0L3B8SZ71DNcrLJNzbuUupTudKewTYe3Cb
tDOOGtTOFJFUWL9CWbT9aMQhLYZdZoMWYzR1wWH9wpLOonrhwTC7Ib2D3UVC09jZDSTV
tAjwny9L6w2yXrXZSYF8e2+ynucsUBJ0hSWY8hj0hmgRBM4iWtfIEFe3/3eL6oJo8JQi
U0SbPRdvPWaHZOBQJJWQUjfpkYHu8ZSr3RQMEQZAUGghqiOgkPs68eFwySw9aDBuODTc
97MQ==
X-Gm-Message-State: AOAM532vu7TNQPPADDzbmmFtiJD7hBBd+1JWLwQeANsANy0k27SUCPu9
Hao0HYtkgBcAYYfnhjFKWjPi9hz0MhNmFkJ3Qrxrd8u04wenrQ==
X-Google-Smtp-Source: ABdhPJw4QTT0f3q/wF1c3PfF09IX+t6+/Q+01q/VTcFk//omYjC9ATUU2gNqCGf8UuaLZIe/9o8ldgnsIQ5CinZN2Sg=
X-Received: by 2002:a17:906:4d42:: with SMTP id
b2mr5966901ejv.34.1591837535564;
Wed, 10 Jun 2020 18:05:35 -0700 (PDT)
MIME-Version: 1.0
Date: Thu, 11 Jun 2020 09:05:23 +0800
Message-ID: <CAD66C+aH9ur_swV6ASK6V13hVKzuv1LJBoPpmfEO=TjrXo9kBA@mail.gmail.com>
Subject: [bug?] Spawning cygwin32 program from cygwin64 messes up backslashes
To: cygwin AT cygwin DOT com
X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT,
FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS,
TXREP autolearn=ham autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <http://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Mingye Wang via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Mingye Wang <arthur200126 AT gmail DOT com>
Sender: "Cygwin" <cygwin-bounces AT cygwin DOT com>

Hi,

The following test case script fails under cygwin64:

```
out32=$(/cygdrive/c/cygwin/bin/echo.exe 'a\\ b')
out64=$(/cygdrive/c/cygwin64/bin/echo.exe 'a\ b')
test "$out32" = "$out64"
```

In other words, while the correct (by-argv-memory) result is `a\\ b`,
cygwin32 gives `a\ b` as output instead. The test case works fine when
CYGWIN=noglob is set, but then `echo.exe 'a\" b'` fails miserably.

The problem is that a cygwin32 program, when run from cygwin64, takes
the code path of normal (non-cygwin) programs. The argv is translated
according to MSVCRT rules in linebuf::fromargv(), but on the receiving
side cygwin's build_argv() is incompatible with MSVCRT rules.

The question mark on the [bug] is due to the apparent old age of this
very unique parsing code and some features it implies. The whole
`winshell` name is pretty bad to start with, since it's really more
relevant to the configurable glob setting as a cygwin parent would
have filled in a `cygheap_exec_info` structure anyways. The link
between globify and quoted is also pretty wild to go through. I mean,
there's nothing sane about cmdline globbing under windows, but a good
place to start is trying to do MSVCRT quoting. The glob rewriting in
globify() should probably go into quoted() for reader's sanity too.

Regards,
Mingye Wang (Artoria2e5)
--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019