On 02/07/15 08:18, Benno Schulenberg wrote:
> 
> On 2015-07-01 20:47, Jim Meyering wrote:
>> On Wed, Jul 1, 2015 at 10:36 AM, Benno Schulenberg
>> <[email protected]> wrote:
>>> [...]
>>> rm: remove write-protected regular file `coreutils-8.23.245-8bf2af/THANKS'? 
>>> y
>>> rm: remove write-protected regular file 
>>> `coreutils-8.23.245-8bf2af/m4/cu-progs.m4'? y
>>>
>>> It would be nicer if these files were not read-only in the tarball.
>>
>> They are read-only to indicate that they are generated.
> 
> The files configure, po/coreutils.pot, po/LINGUAS are generated too;
> they are not read-only.  And once I run ./configure, the Makefiles
> are not read-only either...  So, the logic of 'read-only' meaning
> 'generated' is deficient.
> 
>> You can remove them without interaction by adding rm's -f option.
> 
> I know.  I just feel uneasy about that -- if I type something wrong,
> there are no questions asked any more...
> 
> Is there a way to tell tar to add write bits to all the files it
> unpacks?  I unpacked the tarball: *of course* I have write access
> to all those files.

I'm inclined to agree that tarball users should be able
to patch/remove any file without issue.

I don't think there is a way to _relax_ permissions when extracting with tar.
When creating you can use: --mode='ug+rw' so we could create like:
  TAR='tar -mode=ug+rw' make dist
However it's better to avoid needing to document that,
and the attached patch should avoid read-only files with a standard `make dist`

For completeness, here are the files that have changed perms:

$ tar -tvf coreutils-8.24.tar.xz | grep -- -r--r-
-rw-r--r-- 0/0  2015-06-03 04:19 m4/gettext.m4
-rw-r--r-- 0/0  2015-06-03 04:19 m4/nls.m4
-r--r--r-- 0/0  2015-07-03 20:31 m4/cu-progs.m4
-rw-r--r-- 0/0  2015-06-03 04:19 m4/lcmessage.m4
-rw-r--r-- 0/0  2015-06-03 04:19 m4/intlmacosx.m4
-r--r--r-- 0/0  2015-07-03 22:03 THANKS
-r--r--r-- 0/0  2015-07-03 19:35 src/primes.h
-r--r--r-- 0/0  2015-07-03 19:35 src/dircolors.h
-r--r--r-- 0/0  2015-07-03 20:31 src/cu-progs.mk
-r--r--r-- 0/0  2015-07-03 19:35 src/fs.h
-r--r--r-- 0/0  2015-07-03 19:35 src/fs-is-local.h
-r--r--r-- 0/0  2015-07-03 20:31 src/single-binary.mk
-rw-r--r-- 0/0  2015-06-16 06:03 po/Rules-quot
-rw-r--r-- 0/0  2014-07-18 22:15 po/quot.sed
-rw-r--r-- 0/0  2014-07-18 22:15 po/insert-header.sin
-rw-r--r-- 0/0  2014-07-18 22:15 po/boldquot.sed
-rw-r--r-- 0/0  2014-07-18 22:15 po/[email protected]
-rw-r--r-- 0/0  2015-07-03 20:32 po/Makefile.in.in
-rw-r--r-- 0/0  2014-07-18 22:15 po/[email protected]
-rw-r--r-- 0/0  2014-07-18 22:15 po/remove-potcdate.sin
-rw-r--r-- 0/0  2014-07-18 22:15 ABOUT-NLS

thanks,
Pádraig.
From 84fcb60045e69383806856a31f532b71e4418b5e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Wed, 16 Dec 2015 00:28:19 +0000
Subject: [PATCH] build: ensure all files are writable in the tarball

* Makefile.am (dist-hook): Ensure all files are writable
so that extracted tarballs are easy to remove, without
getting prompts about removing read-only files.
Reported by Benno Schulenberg.
---
 Makefile.am | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index d1004e1..d19b834 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -99,11 +99,13 @@ BUILT_SOURCES = .version
 .version:
 	$(AM_V_GEN)echo $(VERSION) > $@-t && mv $@-t $@
 
-# Arrange so that .tarball-version appears only in the distribution
-# tarball, and never in a checked-out repository.
+# Have no read-only files in the tarball to allow easy removal.
+# Have .tarball-version based versions only in tarball builds.
+# Have .timestamp based dates only in tarball builds.
 # The perl substitution is to change some key uses of "rm" to "/bin/rm".
 # See the rm_subst comment for details.
 dist-hook: gen-ChangeLog
+	$(AM_V_GEN)chmod -R ug+rw $(distdir)
 	$(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
 	$(AM_V_GEN)date +%s > $(distdir)/.timestamp
 	$(AM_V_at)perl -pi -e '$(rm_subst)' $(distdir)/Makefile.in
-- 
2.5.0

Reply via email to