I got a bug report recently that applying the attached simple patch
to the attached file, resulted in varying issues on different versions of patch.

> On 09/03/2013 11:02 AM, FUJIWARA Katsunori wrote:
>> With recent coreutils, "patch" command 2.5.9 causes failure of
>> "./bootstrap" as below:
>>
>>   gnulib/gnulib-tool: *** patch file gl/modules/tempname.diff didn't apply 
>> cleanly
>>   gnulib/gnulib-tool: *** Stop.
>>   missing header for unified diff at line 12 of patch
>>   The text leading up to this was:
>>   --------------------------
>>   |
>>   | Files:
>>   | lib/tempname.c
>>   --------------------------
>>   File to patch: EOF
>>   Skip this patch? [y]
>>   1 out of 1 hunk ignored

So the above failure is OK IMHO.
The attached patch is a bit mangled and needs the following
adjustment to apply cleanly:

-@@ -1,2 +1,2 @@
+@@ -1,5 +1,5 @@

So with patch < 2.6, the behavior is OK, as the ignored hunk
is diagnosed in messages and exit code.

However with patch >= 2.6 the ignored hunk is not diagnosed!
This results with default options in silent failures.
Note patch >= 2.6 does warn about fuzz for the first hunk.

So is this a bug in patch?
Why can't it apply the second hunk anyway?

thanks,
Pádraig.
Description:
gen_tempname() function: create a private temporary file or directory.

Files:
lib/tempname.c
lib/tempname.h
m4/tempname.m4

Depends-on:
extensions
fcntl-h
gettimeofday
lstat
secure_getenv
stdint
sys_stat
sys_time

configure.ac:
gl_FUNC_GEN_TEMPNAME

Makefile.am:
lib_SOURCES += tempname.c

Include:
"tempname.h"

License:
LGPLv2+

Maintainer:
Eric Blake and Jim Meyering
diff --git a/modules/tempname b/modules/tempname
index 7fafd72..4703517 100644
--- a/modules/tempname
+++ b/modules/tempname
@@ -1,2 +1,2 @@
 Description:
-gen_tempname() function: create a private temporary file or directory.
+gen_tempname, gen_tempname_len: create a private temporary file or directory.

 Files:
 lib/tempname.c
@@ -11,7 +11,9 @@ extensions
 fcntl-h
 gettimeofday
 lstat
+randint
 secure_getenv
+stdbool
 stdint
 sys_stat
 sys_time

Reply via email to