public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Cygwin Setup Command-line Arguments - Paths with a Space Incorrectly Parsed
@ 2016-11-13 23:17 OwN-3m-All
  2016-11-14 19:23 ` Gerrit Haase
  0 siblings, 1 reply; 6+ messages in thread
From: OwN-3m-All @ 2016-11-13 23:17 UTC (permalink / raw)
  To: cygwin

Is there a way to pass in paths that contain a space in the --root and
--local-package-dir Cygwin command-line arguments?  Everything I've
tried doesn't work.

Here's a sample batch script to reproduce the issue (create a
directory with a space in it, copy Cygwin setup exe, and then save
batch script into this directory):

cd "C:\test\with space"
set WD=%~dp0
echo "%WD%cygTemp"
"setup-x86_64.exe" --root "%WD%" --local-package-dir "%WD%cygTemp"
pause

If I double quote the path as expected for path variables that may
contain a space in batch, Cygwin incorrectly parses the above
command-line arguments.  I know it is NOT recommended to install
Cygwin with a path that contains spaces, but according to the
documentation, "Cygwin does support spaces in filenames and paths."
But, it doesn't appear to when passing in parameters to the setup?

I'd like to automate Cygwin installation, but I don't want to rule out
the possibility that a path with a space will not be used.

Please let me know if this is possible.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Cygwin Setup Command-line Arguments - Paths with a Space Incorrectly Parsed
  2016-11-13 23:17 Cygwin Setup Command-line Arguments - Paths with a Space Incorrectly Parsed OwN-3m-All
@ 2016-11-14 19:23 ` Gerrit Haase
  2016-11-15  3:38   ` Gerrit Haase
  2016-11-15  7:33   ` Brian Inglis
  0 siblings, 2 replies; 6+ messages in thread
From: Gerrit Haase @ 2016-11-14 19:23 UTC (permalink / raw)
  To: cygwin

2016-11-13 23:19 GMT+01:00 OwN-3m-All wrote:
> cd "C:\test\with space"
> set WD=%~dp0
> echo "%WD%cygTemp"
> "setup-x86_64.exe" --root "%WD%" --local-package-dir "%WD%cygTemp"
> pause
>

The problem is this trailing backslash in the directory name.

D:\temp\Neuer Ordner\cygwinpkg>setup_script.bat

D:\temp\Neuer Ordner\cygwinpkg>set WD=D:\temp\Neuer Ordner\cygwinpkg\

D:\temp\Neuer Ordner\cygwinpkg>echo "D:\temp\Neuer Ordner\cygwinpkg\"
"D:\temp\Neuer Ordner\cygwinpkg\"

D:\temp\Neuer Ordner\cygwinpkg>"setup-x86_64.exe" --root
"D:\temp\Neuer Ordner\cygwinpkg\" --local-package-dir "D:\temp\Neuer
Ordner\cygwinpkg\"


Try adding a dot:

set WD=%~dp0
echo "%WD%."
"setup-x86_64.exe" --root "%WD%." --local-package-dir "%WD%."
pause


> I'd like to automate Cygwin installation, but I don't want to rule out
> the possibility that a path with a space will not be used.

You'll get a warning from Setup:  it is strongly recommended, to use a
root path without spaces.


> Please let me know if this is possible.

I don't know, never tried, I always used C:\cygwin as root.

Regards,
Gerrit

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Cygwin Setup Command-line Arguments - Paths with a Space Incorrectly Parsed
  2016-11-14 19:23 ` Gerrit Haase
@ 2016-11-15  3:38   ` Gerrit Haase
  2016-11-15  7:33   ` Brian Inglis
  1 sibling, 0 replies; 6+ messages in thread
From: Gerrit Haase @ 2016-11-15  3:38 UTC (permalink / raw)
  To: cygwin

> Try adding a dot:
>
> set WD=%~dp0
> echo "%WD%."
> "setup-x86_64.exe" --root "%WD%." --local-package-dir "%WD%."
> pause


or
set WD=%~dp0.
...

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Cygwin Setup Command-line Arguments - Paths with a Space Incorrectly Parsed
  2016-11-14 19:23 ` Gerrit Haase
  2016-11-15  3:38   ` Gerrit Haase
@ 2016-11-15  7:33   ` Brian Inglis
  2016-11-15  8:24     ` OwN-3m-All
  1 sibling, 1 reply; 6+ messages in thread
From: Brian Inglis @ 2016-11-15  7:33 UTC (permalink / raw)
  To: cygwin

On 2016-11-14 07:43, Gerrit Haase wrote:
> 2016-11-13 23:19 GMT+01:00 OwN-3m-All wrote:
>> I'd like to automate Cygwin installation, but I don't want to rule
>> out the possibility that a path with a space will not be used.
>
> You'll get a warning from Setup: it is strongly recommended, to use a
> root path without spaces.

I'd go further - it is strongly recommended that you use only a subset
of printable ASCII characters to avoid problems with Windows OEM and
NLS code pages, and Cygwin mapping of some characters to UTF-16 user
defined supplementary characters, understood only by Cygwin internals,
for POSIX compatibility.
So disallow names with anything disallowed by Windows:
	"*/:<>?\|
or outside the [!-~] range leaving [!#-)+-.0-9;=@-[\]-{}~]
It would also be sensible to disallow anything interpreted by shells,
including cmd, or programs, to avoid issues:
	!#$%&'();[]`{}
reducing the set to [+-.0-9=@-Z^_a-z~] i.e.
	+,-.=@^_~
plus digits and letters, to maintain interoperability without issues.
Leading -.@~ should be disallowed as they have special meaning, and
trailing ~ is questionable as it is often used for backup files,
removed by cleanup scripts, so you might also want to disallow these.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Cygwin Setup Command-line Arguments - Paths with a Space Incorrectly Parsed
  2016-11-15  7:33   ` Brian Inglis
@ 2016-11-15  8:24     ` OwN-3m-All
  2016-11-15 18:56       ` Andrey Repin
  0 siblings, 1 reply; 6+ messages in thread
From: OwN-3m-All @ 2016-11-15  8:24 UTC (permalink / raw)
  To: cygwin

Thanks guys.  That was it.  I decided to remove the trailing slash for
my purposes.

set WD=%~dp0
set WD=%WD:~0,-1%

It's working now!

On Mon, Nov 14, 2016 at 12:23 PM, Brian Inglis
<Brian.Inglis@systematicsw.ab.ca> wrote:
> On 2016-11-14 07:43, Gerrit Haase wrote:
>>
>> 2016-11-13 23:19 GMT+01:00 OwN-3m-All wrote:
>>>
>>> I'd like to automate Cygwin installation, but I don't want to rule
>>> out the possibility that a path with a space will not be used.
>>
>>
>> You'll get a warning from Setup: it is strongly recommended, to use a
>> root path without spaces.
>
>
> I'd go further - it is strongly recommended that you use only a subset
> of printable ASCII characters to avoid problems with Windows OEM and
> NLS code pages, and Cygwin mapping of some characters to UTF-16 user
> defined supplementary characters, understood only by Cygwin internals,
> for POSIX compatibility.
> So disallow names with anything disallowed by Windows:
>         "*/:<>?\|
> or outside the [!-~] range leaving [!#-)+-.0-9;=@-[\]-{}~]
> It would also be sensible to disallow anything interpreted by shells,
> including cmd, or programs, to avoid issues:
>         !#$%&'();[]`{}
> reducing the set to [+-.0-9=@-Z^_a-z~] i.e.
>         +,-.=@^_~
> plus digits and letters, to maintain interoperability without issues.
> Leading -.@~ should be disallowed as they have special meaning, and
> trailing ~ is questionable as it is often used for backup files,
> removed by cleanup scripts, so you might also want to disallow these.
>
> --
> 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
>

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Cygwin Setup Command-line Arguments - Paths with a Space Incorrectly Parsed
  2016-11-15  8:24     ` OwN-3m-All
@ 2016-11-15 18:56       ` Andrey Repin
  0 siblings, 0 replies; 6+ messages in thread
From: Andrey Repin @ 2016-11-15 18:56 UTC (permalink / raw)
  To: OwN-3m-All, cygwin

Greetings, OwN-3m-All!

> Thanks guys.  That was it.  I decided to remove the trailing slash for
> my purposes.

> set WD=%~dp0
> set WD=%WD:~0,-1%

> It's working now!

Alternatively, you could translate backslashes to regular slashes. Should work
too.

SETLOCAL ENABLEEXTENSIONS
SET CWD=%CD:\=/%

P.S.
This list is in "no top posting, please, thank you" mode.


-- 
With best regards,
Andrey Repin
Tuesday, November 15, 2016 16:13:53

Sorry for my terrible english...


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-11-15 13:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-13 23:17 Cygwin Setup Command-line Arguments - Paths with a Space Incorrectly Parsed OwN-3m-All
2016-11-14 19:23 ` Gerrit Haase
2016-11-15  3:38   ` Gerrit Haase
2016-11-15  7:33   ` Brian Inglis
2016-11-15  8:24     ` OwN-3m-All
2016-11-15 18:56       ` Andrey Repin

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