This happens with GNU patch 2.7.6 and the latest Git checkout: - Save the attached patch file as "p". - Make sure file 'R' does _not_ exist - cat ~/p | patch -p3 R
patching file R Hunk #1 FAILED at 1. 1 out of 1 hunk FAILED -- saving rejects to file R.rej ./patch: **** Can't reopen file R : No such file or directory ./patch: **** Can't reopen file R : No such file or directory ./patch: **** Can't reopen file R : No such file or directory ... ./patch: **** Can't create file R.orig : Too many open files ./patch: **** Can't create file R.origzsh: done cat p | zsh: segmentation fault ./patch -p3 R Program received signal SIGSEGV, Segmentation fault. _IO_vfprintf_internal (s=s@entry=0x7ffff7fa8680 <_IO_2_1_stderr_>, format=0x7ffff7f7099f "%s%s%s\n", ap=0x7fffff7ff5a0) at vfprintf.c:1315 1315 vfprintf.c: No such file or directory. (gdb) where #0 _IO_vfprintf_internal (s=s@entry=0x7ffff7fa8680 <_IO_2_1_stderr_>, format=0x7ffff7f7099f "%s%s%s\n", ap=0x7fffff7ff5a0) at vfprintf.c:1315 #1 0x00007ffff7e5b558 in locked_vfxprintf (fp=fp@entry=0x7ffff7fa8680 <_IO_2_1_stderr_>, fmt=<optimized out>, fmt@entry=0x7ffff7f7099f "%s%s%s\n", ap=ap@entry=0x7fffff7ff5a0) at fxprintf.c:30 #2 0x00007ffff7e5b6d9 in __fxprintf (fp=fp@entry=0x7ffff7fa8680 <_IO_2_1_stderr_>, fmt=fmt@entry=0x7ffff7f7099f "%s%s%s\n") at fxprintf.c:74 #3 0x00007ffff7e58e8e in perror_internal (fp=0x7ffff7fa8680 <_IO_2_1_stderr_>, s=s@entry=0x555555579898 " ", errnum=<optimized out>) at perror.c:39 #4 0x00007ffff7e58f0b in __GI_perror (s=s@entry=0x555555579898 " ") at perror.c:67 #5 0x0000555555565c8d in pfatal (format=format@entry=0x555555577513 "Can't create file %s") at util.c:958 #6 0x0000555555565fa0 in create_file (open_flags=<optimized out>, mode=<optimized out>, to_dir_known_to_exist=<optimized out>, file=<optimized out>) at util.c:569 #7 create_file (file=0x5555555e59a0 "R.orig", open_flags=<optimized out>, mode=33188, to_dir_known_to_exist=<optimized out>) at util.c:553 #8 0x00005555555661da in copy_file (from=from@entry=0x55555558d480 "R", to=to@entry=0x5555555e59a0 "R.orig", tost=tost@entry=0x0, to_flags=to_flags@entry=0, mode=<optimized out>, to_dir_known_to_exist=to_dir_known_to_exist@entry=true) at util.c:628 #9 0x000055555556638e in create_backup_copy (from=from@entry=0x55555558d480 "R", to=to@entry=0x5555555e59a0 "R.orig", st=st@entry=0x5555555902d8, to_dir_known_to_exist=to_dir_known_to_exist@entry=true) at util.c:309 #10 0x0000555555566796 in create_backup (to=0x55555558d480 "R", to_st=0x5555555902d8, leave_original=<optimized out>) at util.c:402 #11 0x000055555555da32 in output_files (st=0x0) at patch.c:1950 #12 0x000055555555e3b8 in fatal_exit (sig=sig@entry=0) at patch.c:1979 #13 0x0000555555565ca0 in pfatal (format=format@entry=0x555555577513 "Can't create file %s") at util.c:960 #14 0x0000555555565fa0 in create_file (open_flags=<optimized out>, mode=<optimized out>, to_dir_known_to_exist=<optimized out>, file=<optimized out>) at util.c:569 #15 create_file (file=0x5555555e5980 "R.orig", open_flags=<optimized out>, mode=33188, to_dir_known_to_exist=<optimized out>) at util.c:553 #16 0x00005555555661da in copy_file (from=from@entry=0x55555558d480 "R", to=to@entry=0x5555555e5980 "R.orig", tost=tost@entry=0x0, to_flags=to_flags@entry=0, mode=<optimized out>, to_dir_known_to_exist=to_dir_known_to_exist@entry=true) at util.c:628 #17 0x000055555556638e in create_backup_copy (from=from@entry=0x55555558d480 "R", to=to@entry=0x5555555e5980 "R.orig", st=st@entry=0x5555555902d8, to_dir_known_to_exist=to_dir_known_to_exist@entry=true) at util.c:309 #18 0x0000555555566796 in create_backup (to=0x55555558d480 "R", to_st=0x5555555902d8, leave_original=<optimized out>) at util.c:402 #19 0x000055555555da32 in output_files (st=0x0) at patch.c:1950 -- Martin Michlmayr https://www.cyrius.com/
diff --git a b --- a +++ b @@ -1 +1 @@ -1 +2