From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.75]) by sourceware.org (Postfix) with ESMTPS id 702D53AAA0A1 for ; Thu, 15 Jul 2021 09:11:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 702D53AAA0A1 Received: from calimero.vinschen.de ([24.134.7.25]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N1wdj-1l1dSX3XhJ-012DSs for ; Thu, 15 Jul 2021 11:11:00 +0200 Received: by calimero.vinschen.de (Postfix, from userid 500) id 42454A826A0; Thu, 15 Jul 2021 11:11:00 +0200 (CEST) Date: Thu, 15 Jul 2021 11:11:00 +0200 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: cygpath and star character Message-ID: Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <7fa873dc-e4cb-8217-5844-82db627bd871@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Provags-ID: V03:K1:V4CIV9LCAoHhw1A+T6Oj6hztnLZrx76AFG/IWwp0V8GG7dHKNz+ XE/VWGeV2C8AfJ6YGxyzIdAVngjhUxDz9NwoHalsuPsGh/XI66v/H0pUK2L5YklCmWiJDdp bIF+YQxYPrgjZu6KJ0iULjsuIqROTs1RH8abfCuV4POzMvmpsW9TStGhE58ACDNbcVh8UCu p+eN4fLVuElhub8keR6Cw== X-UI-Out-Filterresults: notjunk:1;V03:K0:/kv1iEesHSc=:IXIiEDnYj52JdNwOlk7vN0 Sn0JhBwTFUTbgq/4khaLWZZ9nlHa6Hd52rcDOC0PP4g96wsuYjmASUleapMRQoBbj4iHMR5GO 8/UHJwsnjsMKbx8oKRtVDnjiO+mEsk7IGoFDXpT800M0KjCMCzdVYffUveDuF9Z+3eWlbR/sQ 4iLaAS77coNAEZkmGyY5lmnrQjc4YD4rRPr6vxgq26YOvEhVAfe3fn7XvFVDT/rAUWWVEyzws 587j6XKTJcyv2/sfjxmZ1MceOqs0RgznH0AXAXXWyKW/ZgU8gYDTdhlLR0t1qR+qGyL5QJCDB A7l2OgrmFr139xVjbNyr7zy+zvWYC37KUlhRlhMh35NVgenbDSO3SKyo1nV7A7X9AcOJvDfeR 6+7HPoZaB2GD2uKty+SR42FYw/OC45RY2W0nCsaTGulI2JLuhJimpYFj/F37raOuti85V8NvE IsXrfx5vaRHSzhCYauMoJtAvMHM/zMu8eu90f9v+P3tm38EoHyZ4naGGNqQVOxTzTz1bBQUDK xLHnnnRhhFSpTswB65GgPoG1NDDtl8b2o+aEAdjYaND47+Hz19fqa6cmzFq9bMOXSD82DI4qm WiZjPpGWRO867ly22j4xz6yGnmUtOXu0e+hQqvzlbsoadwvWJR9eE1s7fJa72oIPCeED8f55R NDn2BddW4sfwsktAE3Zmt03BmM0bqJZQgQWIzyT+ppuD/lenfHP5kbntB6VZEjb6Ww2F8gSVd BbpTyrlEvEc4nrKLv7bk/OOfatZYob+/kp3VYHgoXnSWvCjRgorjT8VucigXf8azUgGu4Z7Sc Qy2HCINULNVtDG0iUsTUCmv+288sNVmgCHEXMftSUobPhvsy8VB/rK2FsRHQy0ULUsFbc7rRM zmvV+cAaOZ+I/erpi4+g== X-Spam-Status: No, score=-98.8 required=5.0 tests=BAYES_00, BODY_8BITS, GOOD_FROM_CORINNA_CYGWIN, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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, 15 Jul 2021 09:11:06 -0000 On Jul 14 15:26, Ken Brown via Cygwin wrote: > On 7/14/2021 4:10 AM, Tomas Jura via Cygwin wrote: > > Hi > > > > I found a strange behaviour of the program cygpath program > > > > 0 >cygpath -w "./*/*"           <--- IMHO wrong output > >  \ > > > > 0 >cygpath -w "./*/*"  | od -a                   <--- a detailed dump > > 0000000   o nul   *   \   o nul   *  nl > > 0000010 > > What you're seeing here is a consequence of the way Cygwin handles valid > POSIX file names that contain characters (like '*') that are not allowed in > Windows file names. See "Forbidden characters in filenames" at > > https://cygwin.com/cygwin-ug-net/using-specialnames.html > > Internally, Cygwin converts "./*/*" to the wide char string L"*\*" with '*' > replaced by 0xf02a. This then gets converted to the multibyte sequence in > your "detailed dump", which is not quite detailed enough: > > $ cygpath -w "./*/*" | od -b > 0000000 357 200 252 134 357 200 252 012 > 0000010 > > I tend to agree that this is not desirable behavior. I doubt if users of > 'cygpath -w' expect to get a result that contains transformed forbidden > characters. But maybe there's a use case for this that I'm missing. > Corinna? The purpose of cygpath is to convert paths between Cygwin and Windows, so that you can access the same file in both worlds. The '*' character is a valid character in Cygwin, but the created file will have a unicode 0xf02a in its place. If cygpath doesn't convert the path accordingly, accessing the file from Windows via the converted path would fail. > > 0 >cygpath -wp "./*/*"         <-- but this works as expected > > *\* > > > > Is this bug or expected behavior ? > > It looks to me like a bug that 'cygpath -w' and 'cygpath -wp' give different > results on a path that doesn't contain a colon. Yeah, that's not quite right. Historically, the conversion of path lists is performed on multibyte paths, not on wide char paths. This has never been changed, and that results in special characters getting lost. So in fact, the behaviour in -p is wrong for those chars invalid in Windows and only valid for POSIX paths. Corinna