bugGNU patch - Bugs: bug #28454, patch shouldn't operate on...

 
 

bug #28454: patch shouldn't operate on read-only files

Submitted by:  Christoph Berg <myon>
Submitted on:  Thu 31 Dec 2009 06:25:38 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 29 Apr 2010 11:21:28 PM UTC, comment #1:

I added this to the Debian bug:

> IMO an appropriate thing to do for patch would be to refuse to
> modify read-only files unless -f (--force) or -t (--batch) is
> given, and warn otherwise. The current behavior is just wrong.
>
> This will make it POSIX compliant, and hopefully it will not be
> such a big deal in build environments, which may be using -f
> already. (In build environments, the interactive questions are
> of no use, anyway.)
>
> Any objections?

Andreas Gruenbacher <agruen>
Project Administrator
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.

Christoph Berg <myon>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by agruen (Posted a comment)
  • -unavailable- added by myon (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 17 Sep 2010 11:44:41 AM UTCagruenStatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1