From owner-freebsd-fs Sun Dec 30 8:15:47 2001 Delivered-To: freebsd-fs@freebsd.org Received: from mail.yadt.co.uk (yadt.demon.co.uk [158.152.4.134]) by hub.freebsd.org (Postfix) with SMTP id 85C1937B425 for ; Sun, 30 Dec 2001 08:14:50 -0800 (PST) Received: (qmail 61833 invoked from network); 30 Dec 2001 16:12:28 -0000 Received: from unknown (HELO mail.gattaca.yadt.co.uk) (qmailr@10.0.0.2) by yadt.demon.co.uk with SMTP; 30 Dec 2001 16:12:28 -0000 Received: (qmail 77134 invoked by uid 1000); 30 Dec 2001 16:11:08 -0000 Date: Sun, 30 Dec 2001 16:11:08 +0000 From: David Taylor To: freebsd-current@freebsd.org Cc: freebsd-fs@freebsd.org Subject: msdosfs_lookup returns EINVAL, not ENOENT Message-ID: <20011230161108.A76653@gattaca.yadt.co.uk> Mail-Followup-To: freebsd-current@freebsd.org, freebsd-fs@freebsd.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="VS++wcV0S1rZb1Fb" Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-fs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org --VS++wcV0S1rZb1Fb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Whilst poking around on my msdosfs (trying to find an MP3 I thought I had), I discovered that, if there are no files matching "foo*", ls foo* will return the wrong error. msdosfs: $ ls foo*=20 ls: foo*: Invalid argument ufs: $ ls foo* ls: foo*: No such file or directory Using strace tracked this down to lstat of foo* returning EINVAL, which would appear to be incorrect, as EINVAL is not listed as a possible error for lstat. Now, since I'm not familar with the innards of freebsd's fs code, here is where I get a little bit lost. I _think_ I've tracked down the source of the error to the point where unix2dosfn is called in msdosfs_lookup, which would be expected, since '*' is an invalid character in msdos filenames, but is fine for ufs. The call on line 152 of msdosfs_lookup.c appears to be the one causing the current problem, but I'm not sure if simply replacing EINVAL with ENOENT would affect things other than lstat. However, I'm also not sure if the behaviour of the other two calls is corre= ct. OTOH, I'm not sure what syscalls are supposed to return in the case of an invalid character in a filename. e.g. touch foo\\ fails with EINVAL currently, yet open(2) states EINVAL means you have used an invalid combination of O_RDONLY, O_WRONLY, and O_RDWR. But no error is listed in the manpage for an invalid filename, other than ENAMETOOLONG, which is clearly inappropriate. Perhaps the correct fix would just be to document the use of EINVAL? --=20 David Taylor davidt@yadt.co.uk "The future just ain't what it used to be" --VS++wcV0S1rZb1Fb Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE8LzycfIqKXSsJ/xERAtD6AKCSBGEDpMmOX6LRCMTLkATgdoDucQCgyMfV iXmGsb84pVV+jkp1lnaXD6Y= =Wihg -----END PGP SIGNATURE----- --VS++wcV0S1rZb1Fb-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message