This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: cygpath
- From: Brian Inglis <Brian dot Inglis at SystematicSw dot ab dot ca>
- To: cygwin at cygwin dot com
- Date: Sat, 11 Feb 2017 11:19:43 -0700
- Subject: Re: cygpath
- Authentication-results: sourceware.org; auth=none
- References: <91DCAC3CB99C724EB365BB64677FBE7B139A86@MX204CL04.corp.emc.com>
- Reply-to: Brian dot Inglis at SystematicSw dot ab dot ca
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: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple