This is the mail archive of the cygwin-developers@cygwin.com 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]

stat vs open w/ ".exe"


I think this has been discussed before but I've searched the
mailing lists to no avail, so here goes.

If you *stat* a file with no suffix, e.g. /bin/bash, it will
succeed if there is a file /bin/bash.exe.

If you *open* a file with no suffix, it doesn't succeed in that
case.

(So "ls /bin/bash" succeeds and "strings /bin/bash" fails.)

In other words, stat(2) also checks for the file with a .exe
extension, while open(2) doesn't.  The difference comes down to
the call to cygheap->fdtab.build_fhandler_from_name() in
syscalls.cc:_open() vs that in syscalls.cc:stat_worker().

Is this a bug or a deliberate decision? and if the latter, why so?

// Conrad




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