Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!mcsun!unido!mikros!mwtech!martin
From: martin@mwtech.UUCP (Martin Weitzel)
Newsgroups: comp.unix.questions
Subject: Re: BSD vs SysV -- [ -w
] different?
Message-ID: <540@mwtech.UUCP>
Date: 13 Dec 89 20:54:19 GMT
References: <4640@itivax.iti.org>
Reply-To: martin@mwtech.UUCP (Martin Weitzel)
Organization: MIKROS Systemware, Darmstadt/W-Germany
Lines: 33
In article <4640@itivax.iti.org> scs@itivax.iti.org (Steve Simmons) writes:
>I've run into what appears to be an incompatibility between SysV and
>BSD (and Ultrix), and wanted to get some feedback:
>
>Given a directory foo, with permissions 777 and owned by root, running
>as root the following bourne shell script gives different results:
>
>#!/bin/sh
>if [ -w foo ] ; then
[rest deleted]
Obviously, there are too ways to define "writable":
1) Will I be able to open the file for writing?
2) Will I have the possibility to *change* the contents?
Because of the special nature of directories in UNIX, these two
questions must be answered differently (even to the Super-User):
1) You are *not* allowed to open a directory-file for writing, but
2) you *may* be able to change its contents with system services
like "creat" (create new file) "link" and "unlink".
Now, SysV takes the one interpretation, BSD the other. As much as
I know, this problem occured allready in XENIX, when they shifted
from the external 'test'-command to the internal '[...]'-feature
of the shell (in System III). Some command scripts, that were
blindly converted (to achieve better performance) just went
the wrong way then.
IMHO, many many unix consultants (as me) would have no work, if
such inconsistencies were ommitted from the systems ... :-)
--
<<< MW -- email: see header -- voice: 49-(0)6151-6 56 83 >>>