bugGNU patch - Bugs: bug #44102, Patch doesn't check old file mode


bug #44102: Patch doesn't check old file mode

Submitter:  Andreas Gruenbacher <agruen>
Submitted:  Wed 28 Jan 2015 10:09:18 AM UTC
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup

Fri 13 Sep 2019 10:38:02 PM UTC, comment #1: 

While working on this issue I discovered a second, related issue. The "old mode" field of diff files was always being read in as "0". This meant we were always working with bad data on the starting point of file permissions. I've attempted to fix this.

Also, I added a warning so when file permissions do not match "old mode" the user is told. Also, if "--force" is not used, the original file permissions are maintained.

Both fixes are in the attached patch.

(file #47508)

Jesse <newguy>
Wed 28 Jan 2015 10:09:18 AM UTC, original submission:  

The following patch creates a file with mode 0644 and then changes the file mode from 0755 to 0644. Patch doesn't
recognize that the file has the wrong file mode and happily
applies the second patch as well; it should complain.

diff --git a/f b/f
new file mode 100644
index 0000000..257cc56
--- /dev/null
+++ b/f
@@ -0,0 +1 @@
diff --git a/f b/f
old mode 100755
new mode 100644

Andreas Gruenbacher <agruen>
Group administrator


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

Attach Files:

Attached Files
file #47508:  patch-44102.txt added by newguy (2KiB - text/plain)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by newguy (Updated the item)
  • -email is unavailable- added by agruen (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-09-13 newguy Attached File- Added patch-44102.txt, #47508

    Back to the top

    Powered by Savane 3.13-b921.
    Corresponding source code