[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug#249177: coreutils: chown is not POSIXLY_CORRECT even when the va
From: |
Paul Eggert |
Subject: |
Re: Bug#249177: coreutils: chown is not POSIXLY_CORRECT even when the variable is set |
Date: |
Thu, 20 May 2004 23:40:39 -0700 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
Jim Meyering <address@hidden> writes:
> I hate to look a gift horse in the mouth, but would you mind
> adding test scripts to go along with some of those changes?
> chown and chgrp have relatively little test coverage and are
> disproportionately security-sensitive.
OK, here's an (admittedly small) addition to help out.
I'm having some further thoughts about what the semantics should be
(now that I'm recovering from the shock that FreeBSD chown doesn't
conform to POSIX either :-). I'll send these via separate email.
2004-05-20 Paul Eggert <address@hidden>
* tests/chgrp/basic: Test that chgrp -h does not fail on
symlinks, even on hosts where that's not supported.
Test that if -R is specified without -H or L, -h is assumed.
Thest that chown() is not optimized away.
diff -pu cu-chown/tests/chgrp/basic cu-chown2/tests/chgrp/basic
--- cu-chown/tests/chgrp/basic 2004-05-18 15:02:12 -0700
+++ cu-chown2/tests/chgrp/basic 2004-05-20 15:23:26 -0700
@@ -56,10 +56,10 @@ test "$VERBOSE" = yes && set +x
touch f
ln -s f symlink
chgrp $g1 f
- chgrp -h $g2 symlink 2> /dev/null
+ chgrp -h $g2 symlink
# This should not change the group of f.
- chgrp -h -c $g2 symlink 2> /dev/null
+ chgrp -h -c $g2 symlink
chown --from=:$g1 -c :$g2 f
# This *should* change the group of f.
@@ -68,6 +68,20 @@ test "$VERBOSE" = yes && set +x
chgrp -c $g1 symlink
chown --from=:$g1 -c :$g2 f
+ # If -R is specified without -H or L, -h is assumed.
+ chgrp -h $g1 f symlink
+ chgrp -R $g2 symlink
+ chown --from=:$g1 -c :$g2 f
+
+ # chown() must not be optimized away even when
+ # the file's owner and group already have the desired value.
+ touch f g
+ chgrp $g1 f g
+ chgrp $g2 g
+ sleep 1
+ chgrp $g1 f
+ ls -c -t f g
+
) 2>&1 | sed "s/\([ :]\)$g1$/\1G1/;s/\([ :]\)$g2$/\1G2/" > actual
cat <<\EOF > expected
@@ -90,6 +104,9 @@ changed group of `symlink' to G2
changed ownership of `f' to :G2
changed group of `symlink' to G1
changed ownership of `f' to :G2
+changed ownership of `f' to :G2
+f
+g
EOF
cmp expected actual \
Only in cu-chown2/tests/chgrp: basic-20040518
Common subdirectories: cu-chown/tests/chgrp/CVS and cu-chown2/tests/chgrp/CVS
- Re: Bug#249177: coreutils: chown is not POSIXLY_CORRECT even when the variable is set, Jim Meyering, 2004/05/15
- Re: Bug#249177: coreutils: chown is not POSIXLY_CORRECT even when the variable is set, Jim Meyering, 2004/05/17
- Re: Bug#249177: coreutils: chown is not POSIXLY_CORRECT even when the variable is set, Paul Eggert, 2004/05/18
- Re: Bug#249177: coreutils: chown is not POSIXLY_CORRECT even when the variable is set, Jim Meyering, 2004/05/20
- Re: Bug#249177: coreutils: chown is not POSIXLY_CORRECT even when the variable is set,
Paul Eggert <=
- Re: Bug#249177: coreutils: chown is not POSIXLY_CORRECT even when the variable is set, Paul Eggert, 2004/05/21
- Re: Bug#249177: coreutils: chown is not POSIXLY_CORRECT even when the variable is set, Jim Meyering, 2004/05/23
- Re: Bug#249177: coreutils: chown is not POSIXLY_CORRECT even when the variable is set, Paul Eggert, 2004/05/23
- Re: Bug#249177: coreutils: chown is not POSIXLY_CORRECT even when the variable is set, Jim Meyering, 2004/05/28