lstat() and implied .exe extension

Fifer, Eric
Wed Apr 12 11:25:00 GMT 2000

I have a question about a recent change to stat_worker():

    Sat Mar 25 20:46:39 2000  Christopher Faylor <>

	* (stat_worker): Use extension search mechanism in
	path_conv to look for .exe rather than trying to special case it

Before this change, an lstat() would more or less transparently add a
.exe extension to a symlink'ed file:

	ln -s /bin/cat.exe
	ls -l cat.exe
	lrwxrwxrwx   1 fifere   SIL_Equi       23 Apr 12 18:56 cat.exe ->
	ls -l cat
	-rwxrwxrwx   1 fifere   SIL_Equi       23 Apr 12 18:56 cat

I say "more or less" because the non-exe version is considered a regular
I assume in part this was done because ls ordinarily does a lstat() and if
the file is a symlink follows up with a readlink(), and readlink() will not
imply a .exe.

After the change, lstat() does not imply a .exe:

	ls -l cat
	ls: cat: No such file or directory

This isn't a big deal, but I was surprised by the change in behavior
and thought I should ask whether the impact was anticipated.


Eric Fifer

More information about the Cygwin-developers mailing list