Linux's interpretation of trailing '/'

Jeremy Fitzhardinge (jeremy@goop.org)
Mon, 14 Dec 1998 16:42:16 -0800 (PST)


Hi all,

A friend of mine pointed out that Linux's interpretation of a trailing '/' on
ordinary files differs from traditional Unix behaviour.

On Linux:

$ touch z
$ cat z/
cat: z/: Not a directory
$ cat z//
cat: z//: Not a directory
$ cat z/.
cat: z/.: Not a directory

All quite reasonable and logical, but Solaris behaves this way:

: aegis:pts/4; echo foo > z
: aegis:pts/4; cat z/
foo
: aegis:pts/4; cat z//
foo
: aegis:pts/4; cat z//.
cat: cannot open z//.
: aegis:pts/4; cat z/.
cat: cannot open z/.

Apparently Solaris' behaviour is traditional all the way back to V6, but I
can't say I've noticed it.

Now I would say that Linux makes complete sense, and the Solaris behaviour
looks like sloppy handling to mee. My friend who raised the issue points out
that its consistent if you regard '/' as a delimiter in the same way as
whitespace is delimiter in /bin/sh, and consequently you should just ignore
trailing '/' as you would trailing whitespace on a command like.

I haven't checked to see what any of the standards say about this issue.

J

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/