public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Fails to launch batch script in some directories
Date: Mon, 23 Apr 2018 08:45:00 -0000	[thread overview]
Message-ID: <20180423084451.GT15911@calimero.vinschen.de> (raw)
In-Reply-To: <71792648-0698-e407-ac67-244ddab446b3@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1789 bytes --]

On Apr 23 08:43, David Macek wrote:
> On 21. 4. 2018 17:38, Brian Inglis wrote:
> > See my other post in this thread where strace shows @ handling is not involved,
> > as the script directory and name are normalized and converted to a win32 path
> > correctly, but child_info_spawn::worker does not appear to quote args with
> > spaces (or apostrophes) when building the command line, despite the comment near
> > the top of the function.
> 
> Do you have a test case for this?  In my testing, paths with spaces (like 'x y' instead of '@ x') work just fine.

Brian has a point though.  It's not a space *in* a filename, it's a
*trailing* space.  And that points to the cause of the problem:

Paths with trailing spaces are invalid DOS paths.

Try this:

  bash$ mkdir "x "
  bash$ cmd
  C:\...>cd "x "
  cd "x "
  The system cannot find the path specified.

The problem is not exactly in Cygwin, it's the good old fact that Win32
tools using the WIn32 file API just can't accfess the file because they
don't see it.  The Win32 API simply deletes trailing spaces from
filenames, in and out.

Cygwin doesn't suffer this problem because it uses the underlying NT API.

https://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-specialchars

The only workaround from Cygwin's side would be to convert 0x20 spaces
to 0xf020 characters as the other invalid chars as outlined in the above
URL.  However, this would only be ok for trailing spaces, given that
leading or in-between spaces are perfectly valid.  Sounds kind of
error prone.

IMHO, better leave it as is and tell the user.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2018-04-23  8:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Alexpux/MSYS2-packages/issues/1225@github.com>
2018-04-20 12:33 ` David Macek
2018-04-20 13:11   ` Corinna Vinschen
2018-04-21 15:39     ` Brian Inglis
2018-04-23  6:43       ` David Macek
2018-04-23  8:45         ` Corinna Vinschen [this message]
2018-04-23 17:20           ` Brian Inglis
2018-04-24  7:55             ` Corinna Vinschen
2018-04-20 13:11   ` Brian Inglis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180423084451.GT15911@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).