delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/04/03/11:54:55

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AD1F13846405
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1712159691;
bh=h9Wy7hCPqGl3jWmNuv9K2bJctE/ahlEp/LvlProLNAc=;
h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post:
List-Help:List-Subscribe:From:Reply-To:From;
b=ZZ61OEiIMTEJ3LLha6rQS9Z31CdtyzGzSP62wpp6A2GuP3CUmJdMM2dR3Ea7aqVqz
9/wFRYkOu7sL4BBy4O6QLM2ekTdjMg4qZ867hc4JUuX1a9KMbXs/bTtA4bNG34Fd5C
2WvwJIFXS/cEKAXlcN0U/nzzgliUJb6XDi0phF5w=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 704163858401
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 704163858401
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712159636; cv=none;
b=UWZ9jltgQTNMyGCI8YVjyK560zOpQt4KX3b0nYgBLkumGrcU8nnfkbGSSsWXh+m8vsep61Wc670yZqXB6CsErqBq3HaQrY9rSSb2vjTUR9MYSigImPpg0VHgHknZEjz3bTujcSgHGqwuuZVpBKEyzRJOxxffabCSEBoNENG+obs=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1712159636; c=relaxed/simple;
bh=CeDKSgcaDwRISk9LBx66alw4p2JBj86yiUKwNCJYWJc=;
h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To;
b=AUmftpQ2RnKu5QV3oqKaQtbz2zOiiJMzjawh/2zmGM5QOmSGnmEgM25sPoBWhvOzpnYlhKAx5rvsjquvn/Fo4huCb4cawBTZ7bdeTODJcdGPqpNLAnOaJg3NT9gGrjeDlUQbnEzh+ioWkeyhVPSVfkYP1Xtu9a0FKAPUOiRcJeY=
ARC-Authentication-Results: i=1; server2.sourceware.org
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1712159633; x=1712764433;
h=content-transfer-encoding:to:subject:message-id:date:from
:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=wlA/TvQ5NEIA5t1NRfCripvq1HC0Rta300ybmE3jgHU=;
b=cANsOgIwVIj10eEsCf0xHDz2auE/zFH32olAWovfqWYfeDjeIkhsm8enmvvAezrOU+
cmgMKtUfpJAQgRG/4Z5p5Zn0s8JesqGGw/PVJAtf+chIcvEBtBzYpt1UkPgp3Ew6tCcu
3e4elJmXJYGDLwCT/HnSsgNDLXi3dNBjzZBJpOfMsG4GUNnsknWwBW4RaUBD/WJPIOYv
uNRKqzs9W5eXHfzD4vsTvhaVFY8LcxBnofbYfdq/W6J83ijihHgzh3tGKFiGJuW+MYQ+
gzYjJlnKbc90HSykHvVOTaXfU4sOLRVDrkNLF1Q+q2KZBY/qzvdExw3obvLycWbi3fgt
lQNg==
X-Gm-Message-State: AOJu0Yw/9h+nYxPOI6cymGin4z1Xd4n5M1NpRFGj7BF2E2qXst+M4h7O
nxAs+L8EQFyLLcWobYnfeF8d8Jnbu3P9iy+EiNPnovimuJafC9KZYRLyEWhHSww4C9/SJw1BW+g
wnFmirtt3PkaMfKQP6oADvTG33FSdtwy0rf8nlk8kQNaAimekSBs=
X-Google-Smtp-Source: AGHT+IHzwINgotBh0pv6MhdYLG96NJwnEq1rSIv9/BNA5kQm55kpwWL4IXFjsP5B4Ii3dPFO1ihItddJhd/bR4RoD6w=
X-Received: by 2002:a50:c34c:0:b0:568:b0f4:fe69 with SMTP id
q12-20020a50c34c000000b00568b0f4fe69mr2558619edb.12.1712159633085; Wed, 03
Apr 2024 08:53:53 -0700 (PDT)
MIME-Version: 1.0
Date: Wed, 3 Apr 2024 16:53:21 +0100
Message-ID: <CAJQQdJhUmqO8aTt-avVGw3yL5iohKfCAQD1KHeAMh_qN-nM8Ng@mail.gmail.com>
Subject: 3.5.x regression: misquoting command line arguments from native
processes
To: The Cygwin Mailing List <cygwin AT cygwin DOT com>
X-Spam-Status: No, score=1.0 required=5.0 tests=BAYES_00, BODY_8BITS,
DKIM_SIGNED, DKIM_VALID, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,
SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.6
X-Spam-Level: *
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
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: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: David Allsopp via Cygwin <cygwin AT cygwin DOT com>
Reply-To: David Allsopp <david AT tarides DOT com>
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 433FsswR2307536

I have what appears to be a regression in Cygwin 3.5.0 which, owing to
a CI system lagging behind, we've only just discovered.

In order to torture our Unicode support, OCaml's Windows CI compiles
its sources in C:\projects\πŸ«Ρ€Π΅Π°Π»ΠΈΠ·Π°Ρ†ΠΈΡ-mingw64 (that's a directory
under C:\projects with the camel emoji U+1F42A followed, I am told, by
the word "implementation" in Russian then with the name of the "port"
of OCaml appended in ASCII).

AppVeyor updated to Cygwin 3.5.1 at the weekend and now, during the
build, we end up with the following kind of error seen in, say,
https://ci.appveyor.com/project/avsm/ocaml/builds/49538801#L711. What
is happening here is that Cygwin's make has passed
C:\projects\πŸ«Ρ€Π΅Π°Π»ΠΈΠ·Π°Ρ†ΠΈΡ-mingw64\byte\bin\flexdll_mingw64.o to a
non-Cygwin program (flexlink.exe) which has called back to Cygwin's
x86_64-w64-mingw32-gcc ultimately via CreateProcess and which has then
failed.

I have reduced this chain to the following program, which takes
argv[1] and calls Cygwin's stat program using _wsystem with argv[1]
"-quoted:

#include <stdlib.h>
#include <string.h>

int wmain(int argc, wchar_t **argv) {
  int len = 2 + 6 + wcslen(argv[1]);
  wchar_t *cmd = (wchar_t *)malloc(len * sizeof(wchar_t));
  wcscpy(cmd, L"stat ");
  cmd[5] = L'"';
  cmd[6] = 0;
  wcscat(cmd, argv[1]);
  cmd[len - 1] = L'"';
  cmd[len] = 0;
  _wsystem(cmd);
}

Compile with x86_64-w64-mingw32-gcc -municode -DUNICODE -D_UNICODE and
then see it works on Cygwin 3.4.10:

$ ./t.exe 'C:\Devel\πŸ«Ρ€Π΅Π°Π»ΠΈΠ·Π°Ρ†ΠΈΡ-mingw64\flexdll\flexdll_mingw64.o'
  File: C:\Devel\πŸ«Ρ€Π΅Π°Π»ΠΈΠ·Π°Ρ†ΠΈΡ-mingw64\flexdll\flexdll_mingw64.o
  Size: 11441           Blocks: 12         IO Block: 65536  regular file
Device: 35525,39577     Inode: 3659174698707368  Links: 1
Access: (0644/-rw-r--r--)  Uid: (1049719/     DRA)   Gid: (1049089/Domain Users)
Access: 2024-04-03 16:43:36.782037800 +0100
Modify: 2024-04-03 14:09:08.012955600 +0100
Change: 2024-04-03 14:09:08.012955600 +0100
 Birth: 2024-04-03 14:09:08.006955500 +0100

but fails on 3.5.1+ (including the latest 3.6.0-0.109 snapshot):

$ ./t.exe 'C:\Devel\πŸ«Ρ€Π΅Π°Π»ΠΈΠ·Π°Ρ†ΠΈΡ-mingw64\flexdll\flexdll_mingw64.o'
stat: cannot stat
'"C:\Devel\'$'\360\237\220\253''рСализация-mingw64\flexdll\flexdll_mingw64.o':
No such file or directory

Note the stray double-quote at the start of the error. This appears to
be down to the presence of the emoji, rather than the Cyrillic
characters, this is fine in both:

$ ./t.exe 'C:\Devel\рСализация\flexdll\flexdll_mingw64.o'
  File: C:\Devel\рСализация\flexdll\flexdll_mingw64.o
  Size: 11441           Blocks: 12         IO Block: 65536  regular file
Device: 35525,39577     Inode: 16607023627376791  Links: 1
Access: (0644/-rw-r--r--)  Uid: (1049719/     DRA)   Gid: (1049089/Domain Users)
Access: 2024-04-03 16:48:43.003742000 +0100
Modify: 2024-04-03 14:09:08.012955600 +0100
Change: 2024-04-03 16:32:35.648039600 +0100
 Birth: 2024-04-03 16:32:35.647539400 +0100

All best,


David

-- 
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