Date: Tue, 19 Mar 1996 17:27:48 +0200 (IST) From: Eli Zaretskii To: Mat Hostetter Cc: djgpp-workers AT delorie DOT com Subject: Re: `stat' fails to detect nonexistent files under WinNT In-Reply-To: Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Mon, 18 Mar 1996, Mat Hostetter wrote: > Here you go. This is from WinNT 3.51. Neither badfile nor > reallylongfilename.will.fail exist. > > C:\tmp>stat 0 badfile reallylongfilename.will.fail > DOS 5.0 (Microsoft MS-DOS) > badfile: 2 1 50444 1 42 0 312768000 Fri Nov 30 00:00:00 1979 > Everything checks out OK > reallylongfilename.will.fail: lossage : No such file or directory (ENOENT) > Get TrueName call (INT 21h/AX=6000h) failed > > Could this all be explained by Kenji Masaki's idea: > > I use WinNT 3.51 on NTFS , and gets same result. It seems that > WinNT dose not support undocumented DOS call int 21h ax=6000h . Thanks for the info. My problem is that for `badfile' it didn't say that TrueName call failed, so there must be more to it. The contents of the stat buffer say that `stat' thinks it's a root directory (the inode is 1, which it assigns to root directories only). Root directories fail `findfirst', so when `findfirst' fails, `stat' has to decide whether it has a root directory or a non-existent file. It does so by feeding `_truename' with a path such as "X:\\" (root directory on the drive in point) and checking the path that's returned against `canon_path'. Can you please try to step through `stat' with a debugger and see why does it decide it's a root? The code that detects root directories begins around line 600 in stat.c. Another thing that puzzles me is that `stat' thinks the file is on drive C: (the 2 which is printed as the first number on the `stat' output above is st_dev, which is drive - 'A'). Is that what DOS box thinks about that NTFS drive? If not, please try to invoke the program with an explicit drive letter in the pathname, and see if that makes a difference. Thanks again for your time.