bugGNU patch - Bugs: bug #57717, patch -R _p1 goes into loop and...

 
 

bug #57717: patch -R _p1 goes into loop and segfaults

Submitter:  Elan Ruusamäe <glen>
Submitted:  Sat 01 Feb 2020 11:59:44 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 06 Jan 2023 06:56:56 AM UTC, comment #4: 
Anonymous
Fri 06 Jan 2023 06:10:33 AM UTC, comment #3: 

Here's another recipe for triggering this:


$ cat >bad.patch <<EOF
> diff --git a/testdir/testfile b/testdir/testfile
--- a/testdir/testfile
+++ b/testdir/testfile
@@ -0,0 +0,1 @@
+This space is intentionally blank
> EOF
$ patch -p1 -t <bad.patch
The next patch would delete the file testdir/testfile,
which does not exist!  Assuming -R.
patching file testdir/testfile
Hunk #1 FAILED at 0.
1 out of 1 hunk FAILED -- saving rejects to file testdir/testfile.rej
patch: **** Can't reopen file testdir/testfile : No such file or directory
patch: **** Can't reopen file testdir/testfile : No such file or directory
patch: **** Can't reopen file testdir/testfile : No such file or directory
[..]


Anonymous
Thu 25 Jun 2020 08:35:23 AM UTC, comment #2: 

The same happens when mistyping -R as _R, as I sometimes do:

patch -p1 <some.patch _R
[...]
patch: **** Can't create file _R.orig : Too many open files
patch: **** Can't create file _R.orig : Too many open files
patch: **** Can't create file _R.orig : Too many open files
patch: **** Can't create file _R.origSegmentatiefout


Benno Schulenberg <bens>
Wed 13 May 2020 08:26:46 AM UTC, comment #1: 

This sounds similar to bug #58361

Anonymous
Sat 01 Feb 2020 11:59:44 AM UTC, original submission:  

I mistakenly type `-p1` as `_p1` which yields such flood of errors and eventually segfaults:


```
root@acai:/etc # g diff mpd.conf|patch -R _p1
patch: ** Can't create file _p1.~1~ : Too many open files
....
patch: ** Can't create file _p1.~1~ : Too many open files
patch: ** Can't create file _p1.~1~ : Too many open files
patch: ** Can't create file _p1.~1~ : Too many open files
patch: ** Can't create file _p1.~1~Segmentation fault
```

this option may also have effect on the behavior:
```
export VERSION_CONTROL=t
```

```
root@acai:/etc # patch --version
GNU patch 2.7.6
```

Elan Ruusamäe <glen>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code