Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Jun 2002 21:31:32 -0700 (PDT)
From:      Pat Young <pyoung@oraclesb.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/38818: if [ -w filename ] incorrectly returns results when run as root and testing non-writeable files.
Message-ID:  <200206020431.g524VWgS061179@www.freebsd.org>

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

>Number:         38818
>Category:       bin
>Synopsis:       if [ -w filename ] incorrectly returns results when run as root and testing non-writeable files.
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jun 02 02:40:14 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Pat Young
>Release:        4.6-RC
>Organization:
NetLedger, Inc.
>Environment:
FreeBSD beast.netledger.com 4.6-RC FreeBSD 4.6-RC #8: Thu May 16 23:34:27 PDT 2002 xdice@beast.netledger.com:/usr/obj/usr/src/sys/BEAST  i386

>Description:
While writing a small shell script to test to see if a file was writable, I found that when running the script as root, and incorrect result was returned.  As a normal user, the script works.  As root, however, even testing a file that is chmod 400 results in an incorrect test.

I've tested with with bash from ports, and /bin/sh - same behavior.  Linux fails in the same fashion, but Solaris works just fine (returns the expected result, which would be nothing.), regardless of shell.


>How-To-Repeat:
# if [ -w netsaintize ]
> then
> ls -l netsaintize
> fi
-r--------  1 root  wheel  0 Jun  1 21:02 netsaintize
#
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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