Subject: Re: [PATCH] t/lib-gpg: adjust permissions for gnupg 2.1

From: Junio C Hamano <[email-masked]>
Date: Wed, 03 Dec 2014 08:21:12 -0800

Jeff King <[email-masked]> writes:

> On Tue, Dec 02, 2014 at 03:57:50PM -0800, Junio C Hamano wrote:
>
>> Wait.  After doing this,
>> 
>>     $ mkdir -p src/a && >src/b 2>src/a/c && chmod a-w src/b src/a/c
>>     $ cp -R src dst
>>     $ ls -lR dst
>> 
>> dst/b and dst/a/c are 0440 (with umask 0027, which makes src/b and
>> src/a/c also 0440, which is copied with "cp -R").
>
> Who is running that chmod and why? I know you are trying to simulate
> "somehow they lost their 'w' bit" here, but what is that "somehow"?

The very first thing I do after downloading and extracting a tarball
for any random project, before doing configure or make, is to a-w on
its files (but not directories, as I typically build in-place in the
source tree even for projects that support VPATH build).

Some ill-mannered projects' build break with this by trying to munge
their own source files.  They are, well, badly written, and I would
want to know about them, and that is one of the reasons behind a-w.

I do not know how widespread the practice is, but that was what I
did for this project, too, when I tried out Linus's first version
;-) These days, I do "git init && git add ." instead, so it does not
matter to me personally, but "cp -R" we do will matter to people who
still care without fixing the mode bits of the copied ones that we
intend to modify inside our tests and build procedure.