Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Cygwin Zsh auto-cygpath? (OT)



On Mon, 9 Feb 2009, Nikolai Weibull wrote:

On Sat, Feb 7, 2009 at 21:53, Benjamin R. Haskell <zsh@xxxxxxxxxx> wrote:

 ... most Windows-native commands, ... usually don't handle
 forward-slash'ed paths.

If they don't then they are actually broken, as a forward slash is defined to be a path separator on Windows systems. Of course, few realize that, and it seems few of those that do bother to handle it.

Huh, neat. I didn't realize (until tangentially looking it up on Wikipedia[1]) that NTFS accommodates POSIX filenames (only the null character and '/' are always forbidden in NTFS filenames.) In "Win32" mode, it still excludes '\' (the path separator) plus the forbidden seven: /:*?"<>


An article from the MSDN Library[2] (which is an interesting read if you have to deal with Windows) seems to corroborate your "If they don't then they are actually broken":

"""
File I/O functions in the Windows API convert "/" to "\" as part of converting the name to an NT-style name, except when using the "\\?\" prefix as detailed in the following sections.
"""

Which, I suppose, makes "cmd" broken. (In more ways than it already seemed.) As a quick test, out of 'dir', 'copy', 'move', 'type', and 'cd', only 'cd' accepts forward slashes[3]. Windows PowerShell handles them all.


There's more information at http://blogs.msdn.com/larryosterman/archive/2005/06/24/432386.aspx

Thanks for the history (especially after following some of the hyperlinks).

Best,
Ben



[1] http://en.wikipedia.org/wiki/NTFS

[2] "Naming a File or Directory (Windows)" http://msdn.microsoft.com/en-us/library/aa365247.aspx

[3] ==== output from   Start > Run > cmd ====

C:\>dir WINDOWS\system\test.txt
 Volume in drive C has no label.
 Volume Serial Number is ECD7-AF25

 Directory of C:\WINDOWS\system

2009/02/09  12:32                16 test.txt
               1 File(s)             16 bytes
               0 Dir(s)  118,255,886,336 bytes free

C:\>dir WINDOWS/system/test.txt
Parameter format not correct - "system".

C:\>copy WINDOWS/system/test.txt .
The syntax of the command is incorrect.

C:\>move WINDOWS/system/test.txt .
The system cannot find the path specified.

C:\>type WINDOWS/system/test.txt
The syntax of the command is incorrect.

C:\>type WINDOWS\system\test.txt
this is test.txt
C:\>cd WINDOWS/system

C:\WINDOWS\system>



Messages sorted by: Reverse Date, Date, Thread, Author