delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/07/27/01:25:06

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=izARrUskSzZ+1CAd
9tW2qNAxKHA5VVl8BxuU9DwvCDS5+8siMbjDmblmxnAjhZ2ezuFFQhUoqR8K7Q+u
i2gxKXagPmfDaT1+PqwvBJMFj0KBLmhEB230y7RpE2ADJuUAIcWedHClRrun6HKj
8MadRj7SbwdLCdpkuhofobZz/pA=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=JE4tbAG40oa9+g5x6OKTRI
tAJ/M=; b=pzODDkUUd5AmnXUOwCQ6W34roTV9zuONkNRrrcSDvxDIFSatJ12qm6
bqO7uI7RC30wBg1kHXGKOtfeWDlF0bn6ypZxBK1uXnXHYNS5YXnFKqWxnZjUZcm6
NVKFwLZrbUQuQ5hlC8QZ4HGw24jDzDGfDNlG8XHnS6Uy/uUwWmzaM=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=1.4 required=5.0 tests=BAYES_00,BODY_8BITS,GARBLED_BODY,RCVD_IN_DNSWL_LOW,TIME_LIMIT_EXCEEDED autolearn=unavailable version=3.3.2 spammy=h_onootolympuscojp, sk:h_onoo, D*olympus.co.jp, U*h_ono
X-HELO: smtp-out-so.shaw.ca
Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca
Subject: Re: cmd.exe and file name conversion from comman line argument
To: cygwin AT cygwin DOT com
References: <OFADDE98D4 DOT BA910041-ON492582D7 DOT 00014612-492582D7 DOT 00053602 AT ot DOT olympus DOT co DOT jp>
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Openpgp: preference=signencrypt
Message-ID: <950baa09-f613-334e-7f27-b0cad8ba9d14@SystematicSw.ab.ca>
Date: Thu, 26 Jul 2018 23:24:00 -0600
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1
MIME-Version: 1.0
In-Reply-To: <OFADDE98D4.BA910041-ON492582D7.00014612-492582D7.00053602@ot.olympus.co.jp>
X-IsSubscribed: yes
Note-from-DJ: This may be spam

On 2018-07-26 18:56, h_ono AT ot DOT olympus DOT co DOT jp wrote:
> There is strange behavior when naming a file from command line argument in 
> cmd.exe console, using touch or mv.
> I use:
> touch (GNU coreutils) 8.26
> Packaged by Cygwin (8.26-2)
> cygwin1.dll version 2.10.0
> in cmd.exe, doing
>> touch aaa
> and
>> touch 'aaa'
> give same file name aaa.
>> ls
>  aaa
> but, when I use Japanese characters as file name, it gives different file 
> names with and without the quote.
>> env LANG=ja_JP.UTF-8 touch あああ
> gives
>> env LANG=ja_JP.UTF-8 ls
>   あああ
> but,
>> env LANG=ja_JP.UTF-8 touch 'あああ'
> gives file name with quote not stripped.
>> env LANG=ja_JP.UTF-8 ls
>   'あああ'
> If called from mintty + bash,
> $ env LANG=ja_JP.UTF-8 touch 'あああ'
> gives
> $ env LANG=ja_JP.UTF-8 ls
>   あああ
> The problem is when I create a file containing spaces in its name.
> Creating a file in cmd.exe like:
>> env LANG=ja_JP.UTF-8 touch 'ああ あ'
> gives
>> env LANG=ja_JP.UTF-8 ls
> "'ああ あ'"
> (which is a file named 'ああ あ', not ああ あ)
> It seems, there is no way to create a file containing a space in its name, 
> like
>  ああ あ
> with commands such as touch or mv.
> Is it a normal behavior, or a bug?
> Is there any way to create a file containing Japanese characters and spaces
> in its name without quote added?
> FYI, With old cygwin (cygwin1.dll version 1.5.25), there were not such 
> problem. Even from cmd.exe,
>> touch 'ああ あ'
> gave a file named 'ああ あ' (without the quote in real.)

Under a Unix shell, both double quote " and single quote/apostrophe ' are
quoting metacharacters, as is backquote/grave `, but any character may be used
in a file name by prefixing with the escape character \.
Under Windows cmd only double quote " is a quoting metacharacter; path spec
delimiters : \ /, wild card characters * ?, and redirection characters | < > are
also not allowed in file names. So to create a Windows file name with a space
from cmd, use only double quotes " around the name.
Under Cygwin, any file name characters disallowed by Windows are mapped into
Unicode private use area characters, but converted back on display, so under
Windows programs those files' long names will display characters without
assigned glyphs.

Note that in ls, nongraphic characters in a file name entry e.g. space, causes
that file name entry to be displayed single quoted 'a b'; specifying ls
-N|--literal|--quoting-style=literal omits the single quotes, but nongraphic
characters are displayed on terminals as question marks ?, unless
--show-control-chars is also specified.
Run "info ls 'Formatting the file names'" to see full explanations.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019