From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by sourceware.org (Postfix) with ESMTPS id 704163858401 for ; Wed, 3 Apr 2024 15:53:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 704163858401 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tarides.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tarides.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 704163858401 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::52a 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 Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-56c583f5381so1855607a12.1 for ; Wed, 03 Apr 2024 08:53:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tarides-com.20230601.gappssmtp.com; s=20230601; t=1712159633; x=1712764433; darn=cygwin.com; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=wlA/TvQ5NEIA5t1NRfCripvq1HC0Rta300ybmE3jgHU=; b=XaSUpRxFHe+K6APxxESk130+qUfkVt32d/ZNoZ0i7pMP/7Qf15QJoceSHkB+dgdRQh R78+VzqZ1ej5x3GwObL2lyWsZZqwMmvLmy4qVnY1SHwpT17M2G+LVPMlqIU34tXxbM02 Gd9K/eDIYvtKAZ/E5ZWBZHU1W+tD21cjP8sZqohvN1BJaXAX1d8JPQSBGb4HEINtYQ1/ 9av5GmNlxppSmKFJC08Kfpmseb7E9C0ps0oZ5TrY+AZkzRdKWfuegh+ZDp2tklDQF8KQ +RaurKR5a6ENn5Eln9879EKP1ThVFBYmDLYG0sl000iibY4mt3UK2vRyuKOKE8mwhu7I ClXg== 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 From: David Allsopp Date: Wed, 3 Apr 2024 16:53:21 +0100 Message-ID: Subject: 3.5.x regression: misquoting command line arguments from native processes To: The Cygwin Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 List-Id: 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\=F0=9F=90=AB=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7= =D0=B0=D1=86=D0=B8=D1=8F-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\=F0=9F=90=AB=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0= =B8=D1=8F-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 #include int wmain(int argc, wchar_t **argv) { int len =3D 2 + 6 + wcslen(argv[1]); wchar_t *cmd =3D (wchar_t *)malloc(len * sizeof(wchar_t)); wcscpy(cmd, L"stat "); cmd[5] =3D L'"'; cmd[6] =3D 0; wcscat(cmd, argv[1]); cmd[len - 1] =3D L'"'; cmd[len] =3D 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\=F0=9F=90=AB=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0= =D1=86=D0=B8=D1=8F-mingw64\flexdll\flexdll_mingw64.o' File: C:\Devel\=F0=9F=90=AB=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1= =86=D0=B8=D1=8F-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 U= sers) 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\=F0=9F=90=AB=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0= =D1=86=D0=B8=D1=8F-mingw64\flexdll\flexdll_mingw64.o' stat: cannot stat '"C:\Devel\'$'\360\237\220\253''=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0= =D1=86=D0=B8=D1=8F-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\=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8= =D1=8F\flexdll\flexdll_mingw64.o' File: C:\Devel\=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1= =8F\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 U= sers) 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