delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2021/07/15/05:30:17

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EDC303AAAC24
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1626341415;
bh=OiUa3p+q07BkDBgpz1Ip/LCMTDDoBg6cvtqjsECOTVw=;
h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=hqx1sYuZXPqJLxuGyHdcfPP2LKJ0nbJHFVW2kVa/sbV/ksSteTnGR8AwAu5cFZdZ2
cprlIu6NLVUVL37DI/dQ/qfI4iEBeY6fFaYgYpz0BRV5uf6MU6yDQWiwz/A/eDxoB9
IOG1VVeii4+C0JOqhGHULWKVfZiMvItwr3p766Wo=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 702D53AAA0A1
Date: Thu, 15 Jul 2021 11:11:00 +0200
To: cygwin AT cygwin DOT com
Subject: Re: cygpath and star character
Message-ID: <YO/7pGWVCHw/QIKl@calimero.vinschen.de>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <7fa873dc-e4cb-8217-5844-82db627bd871 AT gmail DOT com>
<c1720bc3-8ea5-b4a4-fb46-599474b51d88 AT cornell DOT edu>
MIME-Version: 1.0
In-Reply-To: <c1720bc3-8ea5-b4a4-fb46-599474b51d88@cornell.edu>
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 AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
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: Corinna Vinschen via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin 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 16F9UGPp019396

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

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