Re: JFS default behavior (was: UTF-8 in file systems? xfs/extfs/etc.)
From: Pascal Schmidt
Date: Mon Feb 16 2004 - 14:49:12 EST
On Mon, 16 Feb 2004 Valdis.Kletnieks@xxxxxx wrote:
> Oh?
>
> % rm *
> % touch foo1 bar1 # this calls creat() or open() or similar
> % touch foo2 bar2 # as will this...
> % echo foo* # and this will do a readdir(), presumably
>
> Do you have any expectations what the echo will do? Obviously the glob
> DOES have a relationship with previous shell operations.
Yes, and? One may expect the echo to give "foo1 foo2", but that depends
on a lot of side effect, such as no other processing doing things in
the current directory. The same is true in a program - if you need
to know whether you could create a file, the only sane way is to use
creat() from an application and look at the return value. No other
method is meaningful - arbitrary things can happen between creating
a file and running readdir().
> The point is that *if* we assume that glibc is going to do some magic
> conversion when creating a file, we are assuming that glibc will
> *always* keep the conversion hidden. No matter what. Because the user
> now has expectations of what that file was called when he created it -
> the string he passed to open()/creat(). If what gets handed to the
> kernel is something different, we have to make sure that the user never
> finds out about it.
That way lies madness, I agree. The sane thing (but breaks existing
applications) would be to reject any filename that is not valid
UTF-8, returning -EINVAL. I don't think *that* is going to happen,
though. ;)
--
Ciao,
Pascal
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/