bugGNU patch - Bugs: bug #31795, Fails to patch a broken symlink...

 
 

bug #31795: Fails to patch a broken symlink when using --backup and multiple filesystems

Submitted by:  Loïc Minier <lool>
Submitted on:  Mon 06 Dec 2010 12:15:36 AM 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.

 

Mon 06 Dec 2010 11:00:59 AM UTC, comment #2:

Oh right, sorry about that; I'm using Debian/Ubuntu's patch which is from version 2.6 (Debian version 2.6-3).

Sorry for not checking against trunk, I should have thought of that

Loïc Minier <lool>
Mon 06 Dec 2010 10:46:36 AM UTC, comment #1:

This bug no longer exists in the latest Alpha versions; patch will now refuse to patch symlinks:

$ patch --version
GNU patch 2.6.1.108-7fae
[...]
$ patch -p0 --backup [...]
File bar is not a regular file -- can't patch

Next time, please report which version of patch the bug is against. Thanks.

Andreas Gruenbacher <agruen>
Project Administrator
Mon 06 Dec 2010 12:15:36 AM UTC, original submission:

Hi there

While working with "quilt" on a Debian package, it would fail in my home dir but not in /tmp. I could create a small test case with patch alone.

When patching a symlink to a non-existent directory and using --backup, patch renames some files from TMPDIR (/tmp by default) into the current directory. This fails if it's not on the same filesystem.

Here's a test case:
mkdir test; cd test
ln -sf foo/foo bar
patch -p0 --backup <<EOF
diff bar bar
--- /dev/null
+++ bar
@@ -0,0 +1 @@
+coin
EOF

This fails with:
patching file bar
patch: **** Can't create file bar : No such file or directory

/!\ This only fails if your current directory is in a different filesystem than /tmp.

This works around the bug: mkdir ./tmp; TMPDIR=./tmp

I've also filed this at https://bugs.launchpad.net/ubuntu/+source/patch/+bug/685538

Cheers,

Loïc Minier <lool>

 

(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 lool (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
    Mon 06 Dec 2010 10:46:36 AM UTCagruenStatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1