aboutsummaryrefslogtreecommitdiff
path: root/coreutils/chmod.c
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils/chmod.c')
-rw-r--r--coreutils/chmod.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/coreutils/chmod.c b/coreutils/chmod.c
index 74788bbbe..11c6731a1 100644
--- a/coreutils/chmod.c
+++ b/coreutils/chmod.c
@@ -118,10 +118,12 @@ int chmod_main(int argc, char **argv)
118/* 118/*
119Security: chmod is too important and too subtle. 119Security: chmod is too important and too subtle.
120This is a test script (busybox chmod versus coreutils). 120This is a test script (busybox chmod versus coreutils).
121Run it in empty dir. Probably requires bash. 121Run it in empty directory.
122 122
123#!/bin/sh 123#!/bin/sh
124function create() { 124t1="/tmp/busybox chmod"
125t2="/usr/bin/chmod"
126create() {
125 rm -rf $1; mkdir $1 127 rm -rf $1; mkdir $1
126 ( 128 (
127 cd $1 || exit 1 129 cd $1 || exit 1
@@ -134,17 +136,16 @@ function create() {
134 ln -s ../up dir/up 136 ln -s ../up dir/up
135 ) 137 )
136} 138}
137function tst() { 139tst() {
138 (cd test1; $t1 $1) 140 (cd test1; $t1 $1)
139 (cd test2; $t2 $1) 141 (cd test2; $t2 $1)
140 (cd test1; ls -lR) >out1 142 (cd test1; ls -lR) >out1
141 (cd test2; ls -lR) >out2 143 (cd test2; ls -lR) >out2
142 echo "chmod $1" >out.diff 144 echo "chmod $1" >out.diff
143 if ! diff -u out1 out2 >>out.diff; then exit 1; fi 145 if ! diff -u out1 out2 >>out.diff; then exit 1; fi
144 mv out.diff out1.diff 146 rm out.diff
145} 147}
146t1="/tmp/busybox chmod" 148echo "If script produced 'out.diff' file, then at least one testcase failed"
147t2="/usr/bin/chmod"
148create test1; create test2 149create test1; create test2
149tst "a+w file" 150tst "a+w file"
150tst "a-w dir" 151tst "a-w dir"