Mail Archives: cygwin/2005/07/09/00:04:06
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to fergus on 7/8/2005 9:43 PM:
> ln -s /cygdrive/c /c
> ln -s /cygdrive/f /f
> Following the recent upgrade to cygutils I find that the symlink is
> created as /c.exe not /c and /f.exe not /f in cases where the drive
> exists.
Confirmed. Unfortunately, this is a side effect of my improvements to ln
to unify the cygwin-specific .exe code which tries to determine when the
original file exists as just "file" vs. "file.exe". Inside normal
directories, the test is simple - check if "file." exists (since Windows
flattens the trailing .). But for virtual filenames (such as /cygdrive,
/proc/registry, //server, or managed drives), the trailing . trick doesn't
work. I really NEED a way to tell whether a file exists with exact
spelling, or had .exe appended, and you've found a place where the
trailing . trick is not cutting it. Since ln, mv, and cp share my
cygwin-specific code now, I imagine it is probably easy to find a similar
bug in cp or mv.
Is there an easy way to tell if a filename resolves to a virtual mount,
instead of a disk file, and therefore know that the trailing . trick won't
work?
> Where it doesn't (e.g. it isn't plugged in but might be later so
> I am just preparing the way) then
> ln -s /cygdrive/h /h
> works as before: the symlink /h exists, and is not called /h.exe.
Hmm, I thought that a possible workaround might be using "ln -s
/cygdrive/h. /h", even when h exists. It correctly created /h, supressing
the .exe extension, but now "stat /h" shows that the link has length 12
but only points to the 11 characters /cygdrive/h (in other words, cygwin
chopped the trailing dot from the link name, so it is reporting the wrong
length). Furthermore, since /cygdrive/h. doesn't exist, the link is
useless without any indication that it is broken because of the invisible
trailing dot:
$ ln -s /cygdrive/d. d
$ readlink d
/cygdrive/d
$ stat d
File: `d' -> `/cygdrive/d'
Size: 12 Blocks: 1 IO Block: 1024 symbolic link
Device: d47c93feh/3564934142d Inode: 50665495808013319 Links: 1
Access: (0777/lrwxrwxrwx) Uid: ( 1007/ eblake) Gid: ( 513/ None)
Access: 2005-07-08 21:56:04.209000000 -0600
Modify: 2005-07-08 21:56:01.599625000 -0600
Change: 2005-07-08 21:56:01.599625000 -0600
$ ls d
d@
$ ls d/
ls: d/: No such file or directory
- --
Life is short - so eat dessert first!
Eric Blake ebb9 AT byu DOT net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCz0yd84KuGfSFAYARAqlJAKDKEqDnL5knEaT4sr+9x+3w5ir5LQCgxNhg
cl66yRebPnVLO4igOspM//0=
=2Cnw
-----END PGP SIGNATURE-----
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -