bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ensure that generated files are read-only


From: Jim Meyering
Subject: Re: ensure that generated files are read-only
Date: Fri, 08 Sep 2006 14:26:04 +0200

Paul Eggert <address@hidden> wrote:
> Jim Meyering <address@hidden> writes:
>
>> alloca.h: alloca_.h
>>      rm -f address@hidden $@
>>      cp $(srcdir)/alloca_.h address@hidden
>>      chmod a-x address@hidden
>>      mv address@hidden $@
>
> One other thing -- how about if we just remove the 'chmod' entirely?
> If the source is readonly, that'd make the destination readonly.
> Plus it wouldn't bother people who prefer to have read-write files,
> and it'd save a command and a line of 'make' output.
>
> An even shorter possibility would be:
>
> alloca.h: alloca_.h
>       cp -f $(srcdir)/alloca_.h address@hidden
>       mv -f address@hidden $@
>
> This relies on 'cp -f' and 'mv -f', but that's universal nowadays, no?
> (If not, we could autoconfize it.)

I've removed the chmod commands that so many objected to,
and where possible, I've applied your suggestion to use -f:

2006-09-08  Jim Meyering  <address@hidden>

        Don't make generated files read-only.  That would bother too many
        people.  However, do retain the ability to work when targets are
        read-only: remove the destination and temporary files before writing
        them (when generated via sed or echo), or by using the -f option for
        both cp and mv commands.  Suggestion to use -f from Paul Eggert.
        * modules/alloca-opt, modules/argz, modules/arpa_inet:
        * modules/byteswap, modules/configmake, modules/fcntl:
        * modules/fnmatch, modules/getopt, modules/glob, modules/inttypes:
        * modules/localcharset, modules/netinet_in, modules/poll:
        * modules/stdbool, modules/stdint, modules/sys_select:
        * modules/sys_socket, modules/sys_stat, modules/sysexits:

Index: modules/alloca-opt
===================================================================
RCS file: /sources/gnulib/gnulib/modules/alloca-opt,v
retrieving revision 1.4
diff -u -r1.4 alloca-opt
--- modules/alloca-opt  7 Sep 2006 05:53:52 -0000       1.4
+++ modules/alloca-opt  8 Sep 2006 12:16:22 -0000
@@ -19,10 +19,8 @@
 # We need the following in order to create <alloca.h> when the system
 # doesn't have one that works with the given compiler.
 alloca.h: alloca_.h
-       rm -f address@hidden $@
-       cp $(srcdir)/alloca_.h address@hidden
-       chmod a-w address@hidden
-       mv address@hidden $@
+       cp -f $(srcdir)/alloca_.h address@hidden
+       mv -f address@hidden $@
 MOSTLYCLEANFILES += alloca.h alloca.h-t

 Include:
Index: modules/argz
===================================================================
RCS file: /sources/gnulib/gnulib/modules/argz,v
retrieving revision 1.6
diff -u -r1.6 argz
--- modules/argz        7 Sep 2006 05:53:52 -0000       1.6
+++ modules/argz        8 Sep 2006 12:16:22 -0000
@@ -18,10 +18,8 @@
 # We need the following in order to create <argz.h> when the system
 # doesn't have one that works with the given compiler.
 argz.h: argz_.h
-       rm -f address@hidden $@
-       cp $(srcdir)/argz_.h address@hidden
-       chmod a-w address@hidden
-       mv address@hidden $@
+       cp -f $(srcdir)/argz_.h address@hidden
+       mv -f address@hidden $@
 MOSTLYCLEANFILES += argz.h argz.h-t

 Include:
Index: modules/arpa_inet
===================================================================
RCS file: /sources/gnulib/gnulib/modules/arpa_inet,v
retrieving revision 1.3
diff -u -r1.3 arpa_inet
--- modules/arpa_inet   7 Sep 2006 05:53:52 -0000       1.3
+++ modules/arpa_inet   8 Sep 2006 12:16:22 -0000
@@ -19,7 +19,6 @@
        test -d arpa || mkdir arpa
        rm -f address@hidden $@
        echo '#include <sys/socket.h>' >address@hidden
-       chmod a-w address@hidden
        mv address@hidden $@
 MOSTLYCLEANFILES += arpa/inet.h arpa/inet.h-t
 MOSTLYCLEANDIRS += arpa
Index: modules/byteswap
===================================================================
RCS file: /sources/gnulib/gnulib/modules/byteswap,v
retrieving revision 1.5
diff -u -r1.5 byteswap
--- modules/byteswap    7 Sep 2006 05:53:52 -0000       1.5
+++ modules/byteswap    8 Sep 2006 12:16:22 -0000
@@ -17,10 +17,8 @@
 # We need the following in order to create <byteswap.h> when the system
 # doesn't have one.
 byteswap.h: byteswap_.h
-       rm -f address@hidden $@
-       cp $(srcdir)/byteswap_.h address@hidden
-       chmod a-w address@hidden
-       mv address@hidden $@
+       cp -f $(srcdir)/byteswap_.h address@hidden
+       mv -f address@hidden $@
 MOSTLYCLEANFILES += byteswap.h byteswap.h-t

 Include:
Index: modules/configmake
===================================================================
RCS file: /sources/gnulib/gnulib/modules/configmake,v
retrieving revision 1.5
diff -u -r1.5 configmake
--- modules/configmake  7 Sep 2006 05:53:52 -0000       1.5
+++ modules/configmake  8 Sep 2006 12:16:23 -0000
@@ -50,7 +50,6 @@
          echo '#define MANDIR "$(mandir)"'; \
          echo '#define MANEXT "$(manext)"'; \
        :) | sed '/""/d' >address@hidden
-       chmod a-w address@hidden
        mv address@hidden $@
 BUILT_SOURCES += configmake.h
 CLEANFILES += configmake.h configmake.h-t
Index: modules/fcntl
===================================================================
RCS file: /sources/gnulib/gnulib/modules/fcntl,v
retrieving revision 1.3
diff -u -r1.3 fcntl
--- modules/fcntl       7 Sep 2006 05:53:52 -0000       1.3
+++ modules/fcntl       8 Sep 2006 12:16:23 -0000
@@ -22,7 +22,6 @@
        rm -f address@hidden $@
        sed -e 's|@''ABSOLUTE_FCNTL_H''@|$(ABSOLUTE_FCNTL_H)|g' \
            < $(srcdir)/fcntl_.h > address@hidden
-       chmod a-w address@hidden
        mv address@hidden $@
 MOSTLYCLEANFILES += fcntl.h fcntl.h-t

Index: modules/fnmatch
===================================================================
RCS file: /sources/gnulib/gnulib/modules/fnmatch,v
retrieving revision 1.11
diff -u -r1.11 fnmatch
--- modules/fnmatch     7 Sep 2006 05:53:52 -0000       1.11
+++ modules/fnmatch     8 Sep 2006 12:16:23 -0000
@@ -22,10 +22,8 @@
 # We need the following in order to create <fnmatch.h> when the system
 # doesn't have one that supports the required API.
 fnmatch.h: fnmatch_.h
-       rm -f address@hidden $@
-       cp $(srcdir)/fnmatch_.h address@hidden
-       chmod a-w address@hidden
-       mv address@hidden $@
+       cp -f $(srcdir)/fnmatch_.h address@hidden
+       mv -f address@hidden $@
 MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t

 Include:
Index: modules/getopt
===================================================================
RCS file: /sources/gnulib/gnulib/modules/getopt,v
retrieving revision 1.12
diff -u -r1.12 getopt
--- modules/getopt      7 Sep 2006 05:53:52 -0000       1.12
+++ modules/getopt      8 Sep 2006 12:16:23 -0000
@@ -22,10 +22,8 @@
 # We need the following in order to create <getopt.h> when the system
 # doesn't have one that works with the given compiler.
 getopt.h: getopt_.h
-       rm -f address@hidden $@
-       cp $(srcdir)/getopt_.h address@hidden
-       chmod a-w address@hidden
-       mv address@hidden $@
+       cp -f $(srcdir)/getopt_.h address@hidden
+       mv -f address@hidden $@
 MOSTLYCLEANFILES += getopt.h getopt.h-t

 Include:
Index: modules/glob
===================================================================
RCS file: /sources/gnulib/gnulib/modules/glob,v
retrieving revision 1.9
diff -u -r1.9 glob
--- modules/glob        7 Sep 2006 05:53:52 -0000       1.9
+++ modules/glob        8 Sep 2006 12:16:23 -0000
@@ -30,10 +30,8 @@
 # We need the following in order to create <glob.h> when the system
 # doesn't have one that works with the given compiler.
 glob.h: glob_.h
-       rm -f address@hidden $@
-       cp $(srcdir)/glob_.h address@hidden
-       chmod a-w address@hidden
-       mv address@hidden $@
+       cp -f $(srcdir)/glob_.h address@hidden
+       mv -f address@hidden $@
 MOSTLYCLEANFILES += glob.h glob.h-t

 Include:
Index: modules/inttypes
===================================================================
RCS file: /sources/gnulib/gnulib/modules/inttypes,v
retrieving revision 1.10
diff -u -r1.10 inttypes
--- modules/inttypes    7 Sep 2006 05:53:53 -0000       1.10
+++ modules/inttypes    8 Sep 2006 12:16:23 -0000
@@ -32,7 +32,6 @@
            -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \
            -e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \
            < $(srcdir)/inttypes_.h > address@hidden
-       chmod a-w address@hidden
        mv address@hidden $@
 MOSTLYCLEANFILES += inttypes.h inttypes.h-t

Index: modules/localcharset
===================================================================
RCS file: /sources/gnulib/gnulib/modules/localcharset,v
retrieving revision 1.9
diff -u -r1.9 localcharset
--- modules/localcharset        7 Sep 2006 05:53:53 -0000       1.9
+++ modules/localcharset        8 Sep 2006 12:16:23 -0000
@@ -61,14 +61,12 @@
 charset.alias: config.charset
        rm -f t-$@ $@
        $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@
-       chmod a-w t-$@
        mv t-$@ $@

 SUFFIXES += .sed .sin
 .sin.sed:
        rm -f t-$@ $@
        sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@
-       chmod a-w t-$@
        mv t-$@ $@

 CLEANFILES += charset.alias ref-add.sed ref-del.sed
Index: modules/netinet_in
===================================================================
RCS file: /sources/gnulib/gnulib/modules/netinet_in,v
retrieving revision 1.3
diff -u -r1.3 netinet_in
--- modules/netinet_in  7 Sep 2006 05:53:53 -0000       1.3
+++ modules/netinet_in  8 Sep 2006 12:16:23 -0000
@@ -19,7 +19,6 @@
        test -d netinet || mkdir netinet
        rm -f address@hidden $@
        echo '#include <sys/socket.h>' >address@hidden
-       chmod a-w address@hidden
        mv address@hidden $@
 MOSTLYCLEANFILES += netinet/in.h netinet/in.h-t
 MOSTLYCLEANDIRS += netinet
Index: modules/poll
===================================================================
RCS file: /sources/gnulib/gnulib/modules/poll,v
retrieving revision 1.9
diff -u -r1.9 poll
--- modules/poll        7 Sep 2006 05:53:53 -0000       1.9
+++ modules/poll        8 Sep 2006 12:16:23 -0000
@@ -18,10 +18,8 @@
 # We need the following in order to create <poll.h> when the system
 # doesn't have one.
 poll.h: poll_.h
-       rm -f address@hidden $@
-       cp $(srcdir)/poll_.h address@hidden
-       chmod a-w address@hidden
-       mv address@hidden $@
+       cp -f $(srcdir)/poll_.h address@hidden
+       mv -f address@hidden $@
 MOSTLYCLEANFILES += poll.h poll.h-t

 Include:
Index: modules/stdbool
===================================================================
RCS file: /sources/gnulib/gnulib/modules/stdbool,v
retrieving revision 1.13
diff -u -r1.13 stdbool
--- modules/stdbool     7 Sep 2006 05:53:53 -0000       1.13
+++ modules/stdbool     8 Sep 2006 12:16:23 -0000
@@ -20,7 +20,6 @@
 stdbool.h: stdbool_.h
        rm -f address@hidden $@
        sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h > 
address@hidden
-       chmod a-w address@hidden
        mv address@hidden $@
 MOSTLYCLEANFILES += stdbool.h stdbool.h-t

Index: modules/stdint
===================================================================
RCS file: /sources/gnulib/gnulib/modules/stdint,v
retrieving revision 1.13
diff -u -r1.13 stdint
--- modules/stdint      7 Sep 2006 05:53:53 -0000       1.13
+++ modules/stdint      8 Sep 2006 12:16:23 -0000
@@ -47,7 +47,6 @@
            -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \
            -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \
            < $(srcdir)/stdint_.h > address@hidden
-       chmod a-w address@hidden
        mv address@hidden $@
 MOSTLYCLEANFILES += stdint.h stdint.h-t

Index: modules/sys_select
===================================================================
RCS file: /sources/gnulib/gnulib/modules/sys_select,v
retrieving revision 1.3
diff -u -r1.3 sys_select
--- modules/sys_select  7 Sep 2006 05:53:53 -0000       1.3
+++ modules/sys_select  8 Sep 2006 12:16:23 -0000
@@ -19,7 +19,6 @@
        test -d sys || mkdir sys
        rm -f address@hidden $@
        echo '#include <sys/socket.h>' >address@hidden
-       chmod a-w address@hidden
        mv address@hidden $@
 MOSTLYCLEANFILES += sys/select.h sys/select.h-t
 MOSTLYCLEANDIRS += sys
Index: modules/sys_socket
===================================================================
RCS file: /sources/gnulib/gnulib/modules/sys_socket,v
retrieving revision 1.6
diff -u -r1.6 sys_socket
--- modules/sys_socket  7 Sep 2006 05:53:53 -0000       1.6
+++ modules/sys_socket  8 Sep 2006 12:16:23 -0000
@@ -19,10 +19,8 @@
 # doesn't have one that works with the given compiler.
 sys/socket.h: socket_.h
        test -d sys || mkdir sys
-       rm -f address@hidden $@
-       cp $(srcdir)/socket_.h address@hidden
-       chmod a-w address@hidden
-       mv address@hidden $@
+       cp -f $(srcdir)/socket_.h address@hidden
+       mv -f address@hidden $@
 MOSTLYCLEANFILES += sys/socket.h sys/socket.h-t
 MOSTLYCLEANDIRS += sys

Index: modules/sys_stat
===================================================================
RCS file: /sources/gnulib/gnulib/modules/sys_stat,v
retrieving revision 1.4
diff -u -r1.4 sys_stat
--- modules/sys_stat    7 Sep 2006 05:53:53 -0000       1.4
+++ modules/sys_stat    8 Sep 2006 12:16:23 -0000
@@ -22,7 +22,6 @@
        rm -f address@hidden $@
        sed -e 's|@''ABSOLUTE_SYS_STAT_H''@|$(ABSOLUTE_SYS_STAT_H)|g' \
            < $(srcdir)/stat_.h > address@hidden
-       chmod a-w address@hidden
        mv address@hidden $@
 MOSTLYCLEANFILES += sys/stat.h sys/stat.h-t
 MOSTLYCLEANDIRS += sys
Index: modules/sysexits
===================================================================
RCS file: /sources/gnulib/gnulib/modules/sysexits,v
retrieving revision 1.8
diff -u -r1.8 sysexits
--- modules/sysexits    7 Sep 2006 05:53:53 -0000       1.8
+++ modules/sysexits    8 Sep 2006 12:16:23 -0000
@@ -17,10 +17,8 @@
 # We need the following in order to create <sysexits.h> when the system
 # doesn't have one that works with the given compiler.
 sysexits.h: sysexit_.h
-       rm -f address@hidden $@
-       cp $(srcdir)/sysexit_.h address@hidden
-       chmod a-w address@hidden
-       mv address@hidden $@
+       cp -f $(srcdir)/sysexit_.h address@hidden
+       mv -f address@hidden $@
 MOSTLYCLEANFILES += sysexits.h sysexits.h-t

 Include:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]