[uClibc]ttyname() heuristics break on cramfs

Erik Andersen andersen at codepoet.org
Fri Jul 5 23:55:49 UTC 2002


On Fri Jul 05, 2002 at 03:11:49AM -0700, David Blythe wrote:
> ttyname() fails on cramfs filesystems since cramfs likes to use 1 as the 
> inode number a lot.  It can be fixed by adding some extra conditions like:

Wait a sec.  Are you telling me that with cramfs, it does not
guarantee per-file unique inode numbers?  What sortof a broken
filesystem is that?   Quoting from SuSv3, "The st_ino and st_dev
fields taken together uniquely identify the file within the
system."  Therefore, per SuSv3, cramfs if broken(tm), and many
other things will also break.  Creating a tarball will
accidentally hard link unrelated files, for example.  Seems to 
me someone should fix cramfs so it behaves itself.

> st->st_mode == dst.st_mode && st->st_rdev == dst.st_rdev

Well, this one might miss if there are two char devices
with mismatched file perms.

> - or -
> 
> S_ISCHR (dst.st_mode) && st->st_rdev == dst.st_rdev

I suppose that could work, as long as we don't mind char dev
aliasing (i.e. you might have opened /dev/tty6, but if some loon
creats char special file /dev/foo with the same major and minor
then ttyname would return /dev/foo.  But baring stupid sysadmin
problems, I suppose this works (though I'd still be happier if
cramfs would behave itself),

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--



More information about the uClibc mailing list