This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cygpath

On 2017-02-10 12:07, Gluszczak, Glenn wrote:
> Isn’t this a defect in cygpath?  Looks like memory corruption.
> %%%cygpath -w /usr/tmp/*
> C:\cygwin\usr\tmp\
> %%%cygpath -w /usr/non-existent/*
> C:\cygwin\usr\non-existent\�[W��

For proper interpretation of a Unix path name, all but the last component must
exist, and that is expected to be a file system entry which will be created.

Unix wild cards are looked up and expanded by the shell prior to command 
execution, so are expected to be existing path names used as input to a 
command, otherwise they are passed to the command as is: if used as an input 
path name, it should not exist; if used as an output path name, it will be 
created if all but the last component exist, otherwise it should fail as a 
directory component in the path does not exist.

One exception is mkdir -p, and there may be some similar commands which will
create multiple explicit directory tree entries in a path.

AFAIK there are no Unix commands which allow output wild card path names and 
interpret them as being the same as the input names, but there are some cmd 
shell commands which allow or expect this e.g. RENAME *.bat *.cmd, which on 
Unix has to be done with multiple commands in a a loop e.g.

	for bat in *.bat; do mv $bat ${bat%.bat}.cmd; done

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

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]