Thu 31 Dec 2009 06:25:38 PM UTC, original submission:
From http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=274079:
$ cat > ordered
1
2
3
$ cat > misordered
1
2000
3
$ chmod -w ordered ; ls -l ordered
-r--r--r-- 1 rob rob 9 Sep 29 13:55 misordered
-r--r--r-- 1 rob rob 6 Sep 29 13:54 ordered
$ diff -u ordered misordered | patch ordered
patching file ordered
$ ls -l *ordered
-r--r--r-- 1 rob rob 9 Sep 29 13:55 misordered
-r--r--r-- 1 rob rob 9 Sep 29 14:01 ordered
This is TOTALLY broken. Patch should fail with a "Permission denied,"
not change my read-only file.
-----------
From: Paul Eggert <eggert@CS.UCLA.EDU>
Subject: Re: Bug #274079: patch shouldn't operate on read-only files!
Date: Sun, 10 Oct 2004 21:25:32 -0700
Michael Fedrowitz <michaelf@debian.org> writes:
> On Wed, Sep 29, 2004 at 02:04:34PM -0400, Rob Mahurin wrote:
>> This is TOTALLY broken. Patch should fail with a "Permission denied,"
>> not change my read-only file.
I tend to agree. POSIX requires the behavior that you prefer: "patch"
does not conform to POSIX here.
> it might break any number of package's builds (it's not unusual to find
> files with all kinds of weird permissions in source tarballs).
I also agree with this. So unfortunately we are a bit stuck
between a rock and a hard place.
Clearly "patch" should conform to POSIX if POSIXLY_CORRECT is set.
(Anybody want to contribute a fix?) Other than that, I'm not sure
what it should do, to be honest.
|