bugGNU patch - Bugs: bug #62364, Backup file missing

 
 

bug #62364: Backup file missing

Submitter:  Jean Delvare <khali>
Submitted:  Mon 25 Apr 2022 11:58:17 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 10 May 2022 09:19:32 AM UTC, comment #1: 

Thank you for this fix; it must have been tricky to track this down.  Applied.

Andreas Gruenbacher <agruen>
Group administrator
Mon 25 Apr 2022 11:58:17 AM UTC, original submission:  

We have hit a case where "patch --backup" does not create all backup files. This happens only when the input is a git-style patch which fully fails to apply for at least one file, and only on filesystems of certain types (reproduced on ext4 only so far) because it depends on the inode number reallocation strategy.

The bug is pretty hard to reproduce, I have a reproducer but it is fairly large tarball which I can't upload here.

The root cause is the combination of the following factors:

  • For git-style patches, patch delays the backup of files to avoid backing up the same file twice.
  • In order to detect which files are already queued for backup, patch remembers the files by their inode number.
  • When a patch fully fails to apply for a given file, an optimized code path is used, to still backup the file in question if requested. This code path makes use of the stat structure associated with the temporary file which was created to attempt to apply the patch.
  • Before processing the following file, patch cleans up the temporary files created for the previous file, which are no longer needed. At that point, the inode number of that file can no longer be safely used as a unique identifier, because the filesystem is allowed to reuse it for a new file.


I will attach the proposed fix from my colleague Takashi Iwai.

Jean Delvare <khali>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #53147:  0001-Pass-the-correct-stat-to-backup-files.patch added by khali (2KiB - text/x-patch - [PATCH] Pass the correct stat to backup files)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by agruen (Posted a comment)
  • -email is unavailable- added by khali (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.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-05-10 agruen StatusNone Fixed
        Open/ClosedOpen Closed
    2022-04-25 khali Attached File- Added 0001-Pass-the-correct-stat-to-backup-files.patch, #53147

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code