From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id D8802383E805 for ; Thu, 11 Jun 2020 01:05:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D8802383E805 Received: by mail-ej1-x635.google.com with SMTP id k11so4661274ejr.9 for ; Wed, 10 Jun 2020 18:05:36 -0700 (PDT) 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 From: Mingye Wang Date: Thu, 11 Jun 2020 09:05:23 +0800 Message-ID: Subject: [bug?] Spawning cygwin32 program from cygwin64 messes up backslashes To: cygwin@cygwin.com Content-Type: text/plain; charset="UTF-8" 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@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jun 2020 01:05:38 -0000 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)