Whamcloud - gitweb
buildsystem: use 'chmod a-w' instead of 'chmod -w'
authorEnrico Scholz <enrico.scholz@sigma-chemnitz.de>
Fri, 23 Jan 2015 17:05:17 +0000 (12:05 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 23 Jan 2015 17:05:19 +0000 (12:05 -0500)
'chmod -w' is not portable and can break the build:

| chmod: chmod: ss_err.h: new permissions are r--rw-r--, not r--r--r--
| ss_err.h: new permissions are r--rw-r--, not r--r--r--
| chmod: ss_err.c: new permissions are r--rw-r--, not r--r--r--
| make[2]: *** [ss_err.h] Error 1

This happens because 'chmod -w' is affected by umask. Issue can be
reproduced e.g. by

$ mkdir /tmp/foo
$ setfacl -m d:m:rwx /tmp/foo

$ umask 022
$ touch /tmp/foo/x
$ chmod -w /tmp/foo/x
chmod: /tmp/foo/x: new permissions are r--rw-r--, not r--r--r--

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/et/compile_et.sh.in
lib/ss/mk_cmds.sh.in

index a71ae8a..c2861f4 100644 (file)
@@ -51,12 +51,12 @@ if test -f ${BASE}.h && cmp -s ${BASE}.h.$$ ${BASE}.h ; then
     rm -f ${BASE}.h.$$
 else
     mv -f ${BASE}.h.$$ ${BASE}.h
-    chmod -w ${BASE}.h
+    chmod a-w ${BASE}.h
 fi
 $AWK -f "${DIR}/et_c.awk" "outfile=${BASE}.c.$$" "outfn=${BASE}.c" "$ROOT.et"
 if test -f ${BASE}.c && cmp -s ${BASE}.c.$$ ${BASE}.c ; then
     rm -f ${BASE}.c.$$
 else
     mv -f ${BASE}.c.$$ ${BASE}.c
-    chmod -w ${BASE}.c
+    chmod a-w ${BASE}.c
 fi
index 572966c..a8976a4 100644 (file)
@@ -57,6 +57,6 @@ if grep "^#__ERROR_IN_FILE" "${TMP}" > /dev/null; then
 else
        rm -f "${BASE}.c"
        mv -f "${TMP}" "${BASE}.c"
-       chmod -w "${BASE}.c"
+       chmod a-w "${BASE}.c"
        exit 0
 fi