From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 2 13:25:58 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7D52616A41F for ; Tue, 2 Aug 2005 13:25:58 +0000 (GMT) (envelope-from joerg@britannica.bec.de) Received: from hydra.bec.de (www.ostsee-abc.de [62.206.222.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id D25BA43D45 for ; Tue, 2 Aug 2005 13:25:57 +0000 (GMT) (envelope-from joerg@britannica.bec.de) Received: from britannica.bec.de (unknown [139.30.252.72]) by hydra.bec.de (Postfix) with ESMTP id 5A67B35707 for ; Tue, 2 Aug 2005 15:25:54 +0200 (CEST) Received: by britannica.bec.de (Postfix, from userid 1001) id 597FB5406; Tue, 2 Aug 2005 15:23:44 +0200 (CEST) Date: Tue, 2 Aug 2005 15:23:43 +0200 From: Joerg Sonnenberger To: freebsd-hackers@freebsd.org Message-ID: <20050802132343.GA3012@britannica.bec.de> Mail-Followup-To: freebsd-hackers@freebsd.org 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> <20050802130812.GA23261@sinanica.bg.datamax> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050802130812.GA23261@sinanica.bg.datamax> User-Agent: Mutt/1.5.6i Subject: Re: [patch] rc.d/tmp (silly mkdir usage) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2005 13:25:58 -0000 On Tue, Aug 02, 2005 at 04:08:12PM +0300, Vasil Dimov wrote: > 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. > > > > > > > > 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). > > > > > > > That's correct, -w cannot be used to check read-only filesystem. > > > > Actually, you can. That's not portable behaviour though. > > > > Well, look what I discovered: As I said, it is not portable. > > # 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 I'd say this is a bug in the bash builtin :-) Joerg