Date: Tue, 6 Feb 2007 11:14:37 +0300 From: pluknet <pluknet@gmail.com> To: freebsd-current@freebsd.org, freebsd-fs@freebsd.org, pluknet@gmail.com Subject: Re: incorrect(?) errno value in msdosfs Message-ID: <a31046fc0702060014v1609f354t9c6c7423c03f0d6c@mail.gmail.com> In-Reply-To: <200702060752.l167qhup068391@lurza.secnetix.de> References: <freebsd-current.a31046fc0702052220sc5d201aj143f45bcc9795173@mail.gmail.com> <200702060752.l167qhup068391@lurza.secnetix.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On 06/02/07, Oliver Fromme <olli@lurza.secnetix.de> wrote: > pluknet <pluknet@gmail.com> wrote: > > I have discovered an unexpected behavior. If I perform a search > > operation in the directory for non-existing files, then I get > > the EINVAL value on msdosfs filesystem instead of > > the ENOENT value returned. > > EINVAL should be returned if you try to lookup an invalid > file name. ENOENT should be returned if the file name is > valid but does not exist. > > Remember that MSDOSFS is a lot stricter than UFS, as far > as valid file names are concerned. For example, the only > characters forbidden in UFS file names are '/' (slash) and > '\0' (zero byte), because slash is the directory separator > and zero byte is the string terminator. On the other hand, > quite a lot of characters are not allowed in MSDOSFS file > names, including the wildcards '?' and '*'. > > > For example if I run the next command on msdosfs filesystem, > > this is what I get: > > > > bash-2.05b$ ls /mnt/msdosfs/*.nonexistent > > ls: /mnt/msdosfs/*.nonexistent: Invalid argument > > That's correct behaviour. Let me explain: > > When your shell encounters unquoted wildcards ('*' in this > case), it retrieves a directory listing and tries to match > the entries with your pattern. If there is no match, the > default behaviour of most bourne-compatible shells > (including bash) is to use the pattern as-is, i.e. as if > it was quoted. In other words, it tries to look for a > literal file name of "*.nonexistent". > > As I explained above, the '*' character is illegal in > MSDOSFS file names, so the lookup function returns EINVAL > without even trying to locate that file name in the > directory. > > > instead of: > > > > bash-2.05b$ ls /mnt/msdosfs/*.nonexistent > > ls: /mnt/msdosfs/*.nonexistent: No such file or directory > > That would be incorrect behaviour. > > Try to look up a file name that's valid (but doesn't exist > either). You will certainly get ENOENT. If you still get > EINVAL, it's time to submit a PR. :-) > > Best regards > Oliver > > -- > Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M. > Handelsregister: Registergericht Muenchen, HRA 74606, USt-Id: DE204219783 > Any opinions expressed in this message are personal to the author and may > not necessarily reflect the opinions of secnetix GmbH & Co KG in any way. > FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd > > "And believe me, as a C++ programmer, I don't hesitate to question > the decisions of language designers. After a decent amount of C++ > exposure, Python's flaws seem ridiculously small." -- Ville Vainio > Thanks for the explanation. I have forgotten about a not allowed wildcards :( wbr, pluknet
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a31046fc0702060014v1609f354t9c6c7423c03f0d6c>