9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Aharon Robbins <arnold@skeeve.com>
To: 9fans@cse.psu.edu
Subject: [9fans] what a mess the Unix world has become
Date: Sun,  9 Feb 2003 12:05:39 +0200	[thread overview]
Message-ID: <200302091005.h19A5d2A018648@localhost.localdomain> (raw)

I forward this for the amusement of the list members.  My initial
reply to this question was that the "Unix guru gives up in disgust
and moves to Plan 9."  Would that I could.

Arnold

> Date: Sat, 8 Feb 2003 09:37:50 -0700 (MST)
> Subject: Readable files: a Unix philosophy question for gurus
>
> In "man test", we find this documentation:
>
>        -r FILE
>               FILE exists and is readable
>
> Similar wording appears in vendor man pages, although Compaq OSF/1
> is a bit more precise:
>
>        -r file
>            TRUE if file exists and has read permission.
>
> Consider a file with these permissions:
>
> 	% ls -l foo.xml
> 	-rwSr-Srwx    2 beebe    staff      174440 Feb  8 08:20 foo.xml
>
> created by
>
> 	chmod u+s,g+s,o+rwxt foo.xml
>
> Now look at this:
>
> (1) On the file server:
>
> 	/bin/test -r foo.xml && echo file is readable
> 	file is readable
>
> 	/usr/local/bin/test -r foo.xml && echo file is readable
> 	file is readable
>
> 	/usr/local/bin/test --version
> 	test (GNU coreutils) 4.5.6
> 	...
>
> 	/bin/cat foo.xml > /dev/null
>
> 	echo $?
> 	0
>
> (2) On a [Sun Solaris 2.8] client, where the filesystem is mounted via
>     NFS with the attributes remote/read/write/nosuid/grpid/intr/noquota:
>
> 	/bin/test -r foo.xml && echo file is readable
> 	[no output]
>
> 	/usr/local/bin/test -r foo.xml && echo file is readable
> 	file is readable
>
> 	/bin/cat foo.xml > /dev/null
> 	cat: cannot open foo.xml
>
> 	/usr/local/bin/cat foo.xml > /dev/null
> 	/usr/local/bin/cat: foo.xml: Permission denied
>
> 	echo $?
> 	1
>
> The $65,536 question is: what should test report?  In this case, the
> setuid bit combined with the mount options makes the file unreadable,
> and the Solaris test command reflects that, but the GNU coreutils
> one does not.
>
> Experiments with native test on other systems produced these results:
>
> 	SGI IRIX 6.5:		file is readable, cat fails
> 	Compaq OSF/1 4.0:	no output from test, cat fails
>
> On AIX, my home filesystem is not mounted with special attributes, so
> I could not make the same experiment.
>
> On FreeBSD, chmod would not do g+s or o+t for me, and the file
> remained readable for both test and cat.
>
> My feeling is that the GNU version of test (going back to at least
> sh-utils 2.0.11 on Red Hat 7.2, and likely much earlier), and the IRIX
> version too, are wrong.
>
> I think that one really should be able to do "test -r foo && cat foo"
> without cat failing because of permissions.
>
> Comments?


             reply	other threads:[~2003-02-09 10:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-09 10:05 Aharon Robbins [this message]
2003-02-09 19:48 ` Mike Haertel
2003-02-10  9:00 ` [9fans] mpg123 Conor Williams
2003-02-10 12:02   ` Russ Cox
2003-02-10 14:14   ` Nigel Roles
2003-02-10 14:34     ` Fco.J.Ballesteros
2003-02-10 14:53       ` Axel Belinfante
2003-02-10 15:05         ` Fco.J.Ballesteros
2003-02-10 15:53       ` Conor Williams
2003-02-10 16:41         ` Fco.J.Ballesteros
2003-02-11 10:19     ` Conor Williams
2003-02-11 11:26       ` nigel
2003-02-13  9:02         ` Conor Williams
2003-02-10 18:13   ` Tad Hunt
2003-02-10 10:04 ` [9fans] what a mess the Unix world has become Douglas A. Gwyn
2003-02-10 11:58   ` Russ Cox
2003-02-10 15:20   ` Ronald G. Minnich
2003-02-11  9:29     ` Douglas A. Gwyn
2003-02-11 10:25       ` Geoff Collyer
2003-02-10 16:19 C H Forsyth
2003-02-10 20:26 ` Ronald G. Minnich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200302091005.h19A5d2A018648@localhost.localdomain \
    --to=arnold@skeeve.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).