Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Aug 2005 16:08:12 +0300
From:      Vasil Dimov <vd@datamax.bg>
To:        freebsd-hackers@freebsd.org
Subject:   Re: [patch] rc.d/tmp (silly mkdir usage)
Message-ID:  <20050802130812.GA23261@sinanica.bg.datamax>
In-Reply-To: <20050802111535.GA2468@britannica.bec.de>
References:  <51934.68.95.232.238.1122957425.squirrel@68.95.232.238> <20050802062937.GA31485@sinanica.bg.datamax> <42EF5072.30808@freesbie.org> <20050802110632.GB85997@sinanica.bg.datamax> <20050802111535.GA2468@britannica.bec.de>

next in thread | previous in thread | raw e-mail | index | archive | help

--huq684BweRXVnRxX
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Aug 02, 2005 at 01:15:35PM +0200, Joerg Sonnenberger wrote:
> On Tue, Aug 02, 2005 at 02:06:32PM +0300, Vasil Dimov wrote:
> > On Tue, Aug 02, 2005 at 12:52:34PM +0200, Dario Freni wrote:
> > > Vasil Dimov wrote:
> > > > Even we can use
> > > > if [ -d /tmp -a -w /tmp ] ; then
> > > > or (which is equivalent)
> > > > if [ -d /tmp ] && [ -w /tmp ] ; then
> > > > and save external commands (mkdir) execution and directory
> > > > creation/deletion at all.
> > >=20
> > > You can't use test -w here. The script is checking if there is a
> > > read-only filesystem. -w checks only the file flags (according to the
> > > man page, at least).
> > >=20
> > That's correct, -w cannot be used to check read-only filesystem.
>=20
> Actually, you can. That's not portable behaviour though.
>=20

Well, look what I discovered:

# mount |grep read-only
/usr/ports on /mnt/ar0s2d/usr/ports5 (nullfs, local, read-only)
# sh -c '[ -w /mnt/ar0s2d/usr/ports5 ] && echo writeable'
# bash -c '[ -w /mnt/ar0s2d/usr/ports5 ] && echo writeable'
writeable
#

One should really not rely on this.

--huq684BweRXVnRxX
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----

iD8DBQFC73A8Fw6SP/bBpCARAl+RAJ9XxERDhYhKFrPwIisF2seD0cQHKwCgyvGT
Iu2nX5+E1GiolRIsZSOFh8Y=
=fHyP
-----END PGP SIGNATURE-----

--huq684BweRXVnRxX--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050802130812.GA23261>