]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
Create the generated files read-only to remind developers not to edit them.
authorAndreas Dilger <adilger@clusterfs.com>
Sat, 5 Aug 2006 18:41:00 +0000 (14:41 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 5 Aug 2006 18:41:00 +0000 (14:41 -0400)
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/et/ChangeLog
lib/et/compile_et.sh.in
lib/ss/ChangeLog
lib/ss/mk_cmds.sh.in
util/ChangeLog
util/subst.c

index c8f63d23e61a47dd4029646947c1d152614ad924..2f7f0a5a170acaf85e084cb16552b37026cbf50e 100644 (file)
@@ -1,3 +1,8 @@
+2006-08-05  Theodore Ts'o  <tytso@mit.edu>
+
+       * compile_et.sh.in: Create the generated .c and .h files read-only
+               to remind developers they shouldn't edit them.
+
 2005-12-10  Theodore Ts'o  <tytso@mit.edu>
 
        * Makefile.in: Add a dependency to make sure that the
index 27bb3cdb9c5ed971b5ae93fe5fab88f31af64d8e..2cc296f396732bab558687569799af5435f6fe7e 100644 (file)
@@ -34,13 +34,15 @@ fi
 
 $AWK -f "${DIR}/et_h.awk" "outfile=${BASE}.h.$$" "outfn=${BASE}.h" "$ROOT.et"
 if test -f ${BASE}.h && cmp -s ${BASE}.h.$$ ${BASE}.h ; then
-    rm ${BASE}.h.$$
+    rm -f ${BASE}.h.$$
 else
-    mv ${BASE}.h.$$ ${BASE}.h
+    mv -f ${BASE}.h.$$ ${BASE}.h
+    chmod -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 ${BASE}.c.$$
+    rm -f ${BASE}.c.$$
 else
-    mv ${BASE}.c.$$ ${BASE}.c
+    mv -f ${BASE}.c.$$ ${BASE}.c
+    chmod -w ${BASE}.c
 fi
index 3a4149118ba483874b5b147a028eff3caf366211..34ec8a6332ad566f1cdec283d14bdd67df7c06fc 100644 (file)
@@ -1,3 +1,8 @@
+2006-08-05  Theodore Tso  <tytso@mit.edu>
+
+       * mk_cmds.sh.in: Create the generated .c files read-only to remind
+               developers they shouldn't edit them.
+
 2005-12-10  Theodore Ts'o  <tytso@mit.edu>
 
        * Makefile.in: Add a dependency to make sure that the
index 303a73a7ae5bde29a87698b94df3abb304e8a4d1..af44bc5b1f9afc46e364e4ec9496d5ee3b1929f0 100644 (file)
@@ -43,6 +43,7 @@ if grep "^#__ERROR_IN_FILE" "${TMP}" > /dev/null; then
        exit 1
 else
        rm -f "${BASE}.c"
-       mv "${TMP}" "${BASE}.c"
+       mv -f "${TMP}" "${BASE}.c"
+       chmod -w "${BASE}.c"
        exit 0
 fi
index d345c90285ee854336afe984d8931870057975d1..59e95f4f778cdb0eaec1f35017fd0468a0ed13a3 100644 (file)
@@ -1,3 +1,8 @@
+2006-08-05  Andreas Dilger <adilger@clusterfs.com>
+
+       * subst.c (main): Create automatically-generated files be
+               read-only in order to remind developers not to end them.
+
 2005-10-26  Theodore Ts'o  <tytso@mit.edu>
 
        * Makefile.in: Use BUILD_CCFLAGS and BUILD_LDFLAGS instead of
index 4c58b91b618444b1663f70414d52a9864ddf9728..9244e62036925fabd26a4113b8a280398f9dd08a 100644 (file)
@@ -367,6 +367,7 @@ int main(int argc, char **argv)
        fclose(in);
        fclose(out);
        if (outfn) {
+               struct stat st;
                if (compare_file(outfn, newfn)) {
                        if (verbose)
                                printf("No change, keeping %s.\n", outfn);
@@ -386,6 +387,9 @@ int main(int argc, char **argv)
                                printf("Creating or replacing %s.\n", outfn);
                        rename(newfn, outfn);
                }
+               /* set read-only to alert user it is a generated file */
+               if (stat(outfn, &st) == 0)
+                       chmod(outfn, st.st_mode & ~0222);
        }
        return (0);
 }