delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2000/05/08/04:37:20

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-developers-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com
Message-ID: <779F20BCCE5AD31186A50008C75D997917171E@silldn_mail1.sanwaint.com>
From: "Fifer, Eric" <EFifer AT sanwaint DOT com>
To: cygwin-developers AT sourceware DOT cygnus DOT com
Subject: stat() behavior differs on Win9x and WinNT
Date: Mon, 8 May 2000 10:38:36 +0100
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2650.21)

With recent snapshots, stat() of a file with an invalid name,
like stat("abc>def") ('>' is not allowed in file names), does 
not fail on Win98:

  Win98:
    $ ls -l 'abc>def'
    -r-xr-xr-x   1 fifer    unknown         0 Jan  1  1970 abc>def

  WinNT:
    $ ls -l 'abc>def'
    ls: abc>def: No such file or directory

A comparison of Win98 and WinNT straces show
different Win32 error codes being returned for
the same problem:

  Win98:
    symlink_info::check: GetFileAttributesA (c:\efifer\opt\abc>def) failed
    seterrno: 161 (BAD_PATHNAME) -> 22
    [...]
    fhandler_base::open: -1 = CreateFileA [...]
    seterrno: 161 (BAD_PATHNAME) -> 22
    [...]
    stat_worker: -1 = stat [...]

  WinNT:
    symlink_info::check: GetFileAttributesA (c:\efifer\opt\abc>def) failed
    seterrno: 123 (INVALID_NAME) -> 2
    [...]
    fhandler_base::open: -1 = CreateFileA [...]
    seterrno: 123 (INVALID_NAME) -> 2
    [...]
    stat_worker: -1 = stat [...]

A patch is trival, but I'm not sure which is correct:

  + map BAD_PATHNAME to ENOENT (instead of the current EINVAL), but
    I have no idea how widespread the impact of this might be.  Or,
    maybe INVALID_NAME should really be EINVAL?

  + change the test in stat_worker to:

      (!oret && get_errno () != ENOENT && get_errno () != EINVAL)

Thanks,

Eric Fifer

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019