[1.7] Undocumented change in accessing by dos drive letters?

View: New views
12 Messages — Rating Filter:   Alert me  

[1.7] Undocumented change in accessing by dos drive letters?

by Jeffrey J. Kosowsky-11 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I didn't see any documentation in the What's New/What's Changed
document saying that the following no longer works:
                 <cmd> <drive letter>:
For example:
        $ ls C:
        ls: cannot access C:: No such file or directory

This had worked fine on earlier versions.
This has broken several of my shell scripts so I am surprised it isn't
either documented (if a desired change) or fixed (if a bug).

Am I missing something?

Note using C:\\ does work.

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


Re: [1.7] Undocumented change in accessing by dos drive letters?

by Larry Hall (Cygwin) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 11/02/2009 01:29 PM, Jeffrey J. Kosowsky wrote:

> I didn't see any documentation in the What's New/What's Changed
> document saying that the following no longer works:
> <cmd>  <drive letter>:
> For example:
> $ ls C:
> ls: cannot access C:: No such file or directory
>
> This had worked fine on earlier versions.
> This has broken several of my shell scripts so I am surprised it isn't
> either documented (if a desired change) or fixed (if a bug).

I agree it's worth documenting.

> Am I missing something?
>
> Note using C:\\ does work.

C:/ also works.

--
Larry Hall                              http://www.rfk.com
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
216 Dalton Rd.                          (508) 893-9889 - FAX
Holliston, MA 01746

_____________________________________________________________________

A: Yes.
 > Q: Are you sure?
 >> A: Because it reverses the logical flow of conversation.
 >>> Q: Why is top posting annoying in email?

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


Re: [1.7] Undocumented change in accessing by dos drive letters?

by Corinna Vinschen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Nov  2 14:22, Larry Hall (Cygwin) wrote:

> On 11/02/2009 01:29 PM, Jeffrey J. Kosowsky wrote:
> >I didn't see any documentation in the What's New/What's Changed
> >document saying that the following no longer works:
> > <cmd>  <drive letter>:
> >For example:
> > $ ls C:
> > ls: cannot access C:: No such file or directory
> >
> >This had worked fine on earlier versions.
> >This has broken several of my shell scripts so I am surprised it isn't
> >either documented (if a desired change) or fixed (if a bug).
>
> I agree it's worth documenting.
>
> >Am I missing something?
> >
> >Note using C:\\ does work.
>
> C:/ also works.

And /cygdrive/c, of course.  What's the idea to use DOS paths in
POSIX shell scripts?


Corinna

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

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


Re: [1.7] Undocumented change in accessing by dos drive letters?

by Corinna Vinschen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Nov  2 21:27, Corinna Vinschen wrote:

> On Nov  2 14:22, Larry Hall (Cygwin) wrote:
> > On 11/02/2009 01:29 PM, Jeffrey J. Kosowsky wrote:
> > >I didn't see any documentation in the What's New/What's Changed
> > >document saying that the following no longer works:
> > > <cmd>  <drive letter>:
> > >For example:
> > > $ ls C:
> > > ls: cannot access C:: No such file or directory
> > >
> > >This had worked fine on earlier versions.
> > >This has broken several of my shell scripts so I am surprised it isn't
> > >either documented (if a desired change) or fixed (if a bug).
> >
> > I agree it's worth documenting.
> >
> > >Am I missing something?
> > >
> > >Note using C:\\ does work.
> >
> > C:/ also works.
>
> And /cygdrive/c, of course.  What's the idea to use DOS paths in
> POSIX shell scripts?

Btw., C: still works, if you have a file in the current working called
"C:"...


Corinna

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

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


Re: [1.7] Undocumented change in accessing by dos drive letters?

by Andy Koppe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/11/2 Larry Hall (Cygwin):

> On 11/02/2009 01:29 PM, Jeffrey J. Kosowsky wrote:
>>
>> I didn't see any documentation in the What's New/What's Changed
>> document saying that the following no longer works:
>>                <cmd>  <drive letter>:
>> For example:
>>        $ ls C:
>>        ls: cannot access C:: No such file or directory
>>
>> This had worked fine on earlier versions.
>> This has broken several of my shell scripts so I am surprised it isn't
>> either documented (if a desired change) or fixed (if a bug).
>
> I agree it's worth documenting.
>
>> Am I missing something?
>>
>> Note using C:\\ does work.
>
> C:/ also works.

C: and C:\ aren't the same thing in DOS/cmd.exe. C: means the current
directory of the C drive, whereas C:\ means the root directory of the
C drive. Within each cmd.exe session, each drive has its own current
directory.

Andy

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


Re: [1.7] Undocumented change in accessing by dos drive letters?

by Christopher Faylor-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Nov 02, 2009 at 08:58:02PM +0000, Andy Koppe wrote:

>2009/11/2 Larry Hall (Cygwin):
>> On 11/02/2009 01:29 PM, Jeffrey J. Kosowsky wrote:
>>> I didn't see any documentation in the What's New/What's Changed
>>> document saying that the following no longer works:
>>> <cmd> <drive letter>:
>>> For example:
>>> $ ls C:
>>> ls: cannot access C:: No such file or directory
>>>
>>> This had worked fine on earlier versions.
>>> This has broken several of my shell scripts so I am surprised it isn't
>>> either documented (if a desired change) or fixed (if a bug).
>>
>> I agree it's worth documenting.
>>
>>> Am I missing something?
>>>
>>> Note using C:\\ does work.
>>
>> C:/ also works.
>
>C: and C:\ aren't the same thing in DOS/cmd.exe.  C: means the current
>directory of the C drive, whereas C:\ means the root directory of the C
>drive.  Within each cmd.exe session, each drive has its own current
>directory.

But that has never been true for Cygwin.  Or, at least it hasn't been
true for many years.  In Cygwin, C: used to mean "the root of the C
drive".

cgf

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


Re: [1.7] Undocumented change in accessing by dos drive letters?

by Linda Walsh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Andy Koppe wrote:
> C: and C:\ aren't the same thing in DOS/cmd.exe. C: means the current
> directory of the C drive, whereas C:\ means the root directory of the
> C drive. Within each cmd.exe session, each drive has its own current
> directory.
---
        Right.  That's a cmd.exe-ism  -- As Christofpher F. says,
it's not been true in Cygwin in a long time (I don't remember it being
true, ever, but I never tried using it to see if it was supported).

        If you are in a 'bash' shell -- bash doesn't maintain
an internal, drive-specific "CWD", for each DOS drive -- it just
has 1 CWD(CurrentWorkingDir) as there is no concept of 'drivers'.  
C:\\, works due to path mangling -- likely when bash sees it, it's
already "[/YourCygPrefixHere]/c/ or root depending on your mount points.

        If "C:" worked it could be confusing, Unless, "C" was your
*only* drive -- then people might forget and think that C: meant
your CWD on your "current drive"...but really, there's no current
drive, and I'm not sure cygwin should inherently support such a vague
syntax.  What would it mean in a POSIX context?  Would it mean
"/c/$PWD"  or "/c/", or (for /c/ == '/' i.e. c is your root partition),
would it mean '/' or $PWD?  

-l

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


Re: [1.7] Undocumented change in accessing by dos drive letters?

by Andy Koppe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/11/4 Linda Walsh:
>> C: and C:\ aren't the same thing in DOS/cmd.exe. C: means the current
>> directory of the C drive, whereas C:\ means the root directory of the
>> C drive. Within each cmd.exe session, each drive has its own current
>> directory.
>
> ---
>        Right.  That's a cmd.exe-ism  -- As Christofpher F. says,
> it's not been true in Cygwin in a long time (I don't remember it being
> true, ever, but I never tried using it to see if it was supported).

Fair enough. All the more reason to remove support for "C:" then.

Btw, C: still does work for cd, e.g. 'cd C:' or 'cd C:Users', both in
bash and in zsh. How come?

Andy

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


Re: [1.7] Undocumented change in accessing by dos drive letters?

by Corinna Vinschen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Nov  4 06:19, Andy Koppe wrote:

> 2009/11/4 Linda Walsh:
> >> C: and C:\ aren't the same thing in DOS/cmd.exe. C: means the current
> >> directory of the C drive, whereas C:\ means the root directory of the
> >> C drive. Within each cmd.exe session, each drive has its own current
> >> directory.
> >
> > ---
> >        Right.  That's a cmd.exe-ism  -- As Christofpher F. says,
> > it's not been true in Cygwin in a long time (I don't remember it being
> > true, ever, but I never tried using it to see if it was supported).
>
> Fair enough. All the more reason to remove support for "C:" then.
>
> Btw, C: still does work for cd, e.g. 'cd C:' or 'cd C:Users', both in
> bash and in zsh. How come?

Funny.  In tcsh it does not work.  The difference is in the strace
suggests that tcsh calls `chdir ("c:")':

  -csh 2372 chdir: dir 'c:'
  -csh 2372 normalize_posix_path: src c:
  -csh 2372 cwdstuff::get: posix /home/corinna
  -csh 2372 cwdstuff::get: (/home/corinna) = cwdstuff::get (0xD80808, 32768, 1, 0), errno 9
  -csh 2372 normalize_posix_path: /home/corinna/c: = normalize_posix_path (c:)
  -csh 2372 mount_info::conv_to_win32_path: conv_to_win32_path (/home/corinna/c:)

normalize_posix_path() only recognizes a DOS path if it starts with
"x:/", "x:\" or "\", so "c:" is not a DOS path, rather just some
arbitrary filename.  Therefore "c:" results in an absolute path of
"/home/corinna/c:", which doesn't exist.

And that's what happens in bash:

  bash 2516 mount_info::conv_to_posix_path: conv_to_posix_path (c:, no-keep-rel, no-add-slash)
  bash 2516 normalize_win32_path: C: = normalize_win32_path (c:)
  bash 2516 mount_info::conv_to_posix_path: /cygdrive/c = conv_to_posix_path (c:)

  [... bash calls stat to check if the dir exists ...]

  bash 2516 chdir: dir '/cygdrive/c'
 
So apparently bash calls cygwin_conv_path(CCP_WIN_A_TO_POSIX, ...), this
treats all incoming paths as Windows paths, the path is converted to a
POSIX path, then bash calls stat to check if the file is an existing
directory, and only then it calls chdir with the POSIX path.

I assume zsh is doing something similar.


Corinna

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

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


Re: [1.7] Undocumented change in accessing by dos drive letters?

by aputerguy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Larry Hall (Cygwin) writes
> On 11/02/2009 01:29 PM, Jeffrey J. Kosowsky wrote:
>> I didn't see any documentation in the What's New/What's Changed
>> document saying that the following no longer works:
>> <cmd>  <drive letter>:
>> For example:
>> $ ls C:
>> ls: cannot access C:: No such file or directory
>>
>> This had worked fine on earlier versions.
>> This has broken several of my shell scripts so I am surprised it isn't
>> either documented (if a desired change) or fixed (if a bug).
>
> I agree it's worth documenting.
>
>> Am I missing something?
>
>> Note using C:\\ does work.

> C:/ also works.


Well, this brings up another seeming problem.

From the cygwin shell, I can do tab-completion on drive letters to get things like C:/usr/bin/ls
However, when I press return, I get:
      bash: C:/usr/bin/ls: No such file or directory
Which is understandable since the file is in C:\cygwin\usr\bin\ls
So, why is bash tab completion messing up here? (note the same behavior was true in cygwin 1.5 too so this is not a "new" bug.

Note that completion does not work at all on the C:\\ format.
And completion works fine on the /c or /cygdrive/c format.

Re: [1.7] Undocumented change in accessing by dos drive letters?

by Eric Blake :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to aputerguy on 11/5/2009 2:34 PM:
>>From the cygwin shell, I can do tab-completion on drive letters to get
> things like C:/usr/bin/ls
> However, when I press return, I get:
>       bash: C:/usr/bin/ls: No such file or directory
> Which is understandable since the file is in C:\cygwin\usr\bin\ls
> So, why is bash tab completion messing up here? (note the same behavior was
> true in cygwin 1.5 too so this is not a "new" bug.

This is not a bug, but a feature of bash tab-completion.  'man bash', and
search for COMP_WORDBREAKS.  Note that : is a special character, in that
it marks a boundary of a word (so you are completing "/usr/bin/ls", not
"c:/usr/bin/ls").  In other words, completion sees a different file name
than ls.  All the more reason to use posix-y paths and avoid drive letters.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrzlJYACgkQ84KuGfSFAYAtGQCeMy454mlxAKx6k/VKj3AkFZek
9CAAnRWyZ+xoZgutSGJ9mIV3KtK7tLB8
=Bgv3
-----END PGP SIGNATURE-----

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


Re: [1.7] Undocumented change in accessing by dos drive letters?

by Dave Korn-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Eric Blake wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> According to aputerguy on 11/5/2009 2:34 PM:
>> >From the cygwin shell, I can do tab-completion on drive letters to get
>> things like C:/usr/bin/ls
>> However, when I press return, I get:
>>       bash: C:/usr/bin/ls: No such file or directory
>> Which is understandable since the file is in C:\cygwin\usr\bin\ls
>> So, why is bash tab completion messing up here? (note the same behavior was
>> true in cygwin 1.5 too so this is not a "new" bug.
>
> This is not a bug, but a feature of bash tab-completion.  'man bash', and
> search for COMP_WORDBREAKS.  Note that : is a special character, in that
> it marks a boundary of a word (so you are completing "/usr/bin/ls", not
> "c:/usr/bin/ls").  In other words, completion sees a different file name
> than ls.  All the more reason to use posix-y paths and avoid drive letters.

  Or escape the colon -

> admin@ubik ~
> $ c\:/WINNT/system32/[TAB][TAB]
> Display all 1869 possibilities? (y or n)
>

    cheers,
      DaveK

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