[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ -w ... ] should use access(2)
From: |
Tim Waugh |
Subject: |
[ -w ... ] should use access(2) |
Date: |
Wed, 12 Nov 2003 09:35:05 +0000 |
User-agent: |
Mutt/1.4.1i |
Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu'
-DCONF_VENDOR='pc' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib
-D_FILE_OFFSET_BITS=64 -g
uname output: Linux gene.surrey.redhat.com 2.4.22-1.2115.nptl #1 Wed Oct 29
15:42:51 EST 2003 i686 i686 i386 GNU/Linux
Machine Type: i686-pc-linux-gnu
Bash Version: 2.05b
Patch Level: 0
Release Status: release
Description:
Built-in test should use access(2) for -w
Repeat-By:
touch immutable; chattr +i immutable
[ -w immutable ] && echo writable
/usr/bin/test -w writable && echo writable
The [ (built-in) -w test claims the file is writable when it is
not; the /usr/bin/test from coreutils-5.0 correctly reports that
the file is not writable.
Fix:
Using access(2) for this check would fix the problem, so long as
you used the approach taken in coreutils of setting the effective
user/group IDs before the call and restoring them afterwards.
pgpP967DS2FaM.pgp
Description: PGP signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [ -w ... ] should use access(2),
Tim Waugh <=