Package: diffutils
Version: 1:3.3-1+b1
Severity: normal

Dear Maintainer,

I'm trying to submit a patch file in context diff format, starting from a
unified diff
patch generated by git.  So I do this:

filterdiff --format=context /tmp/mypatch.diff

and in the output I observe that the second hunk is not output, rendering the
patch corrupt.  My expectation is that all hunks that were in the input should
be present in the output also.  This doesn't happen with all patches, only some
of them.

This is my test diff:

diff --git a/src/backend/access/transam/xlog.c
b/src/backend/access/transam/xlog.c
index 22e6a21..0266d61 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -5826,19 +5826,6 @@ do { \
                                                minValue))); \
 } while(0)

-#define RecoveryRequiresBoolParameter(param_name, currValue, masterValue) \
-do { \
-       bool _currValue = (currValue); \
-       bool _masterValue = (masterValue); \
-       if (_currValue != _masterValue) \
-               ereport(ERROR, \
-                               (errcode(ERRCODE_INVALID_PARAMETER_VALUE), \
-                                errmsg("hot standby is not possible because it
requires \"%s\" to be same on master and standby (master has \"%s\", standby
has \"%s\")", \
-                                               param_name, \
-                                               _masterValue ? "true" :
"false", \
-                                               _currValue ? "true" :
"false"))); \
-} while(0)
-
 /*
  * Check to see if required parameters are set high enough on this server
  * for various aspects of recovery operation.
@@ -5885,9 +5872,6 @@ CheckRequiredParameterValues(void)
                RecoveryRequiresIntParameter("max_locks_per_transaction",
max_locks_per_xact,
ControlFile->max_locks_per_xact);
-               RecoveryRequiresBoolParameter("track_commit_timestamp",
-
track_commit_timestamp,
-
ControlFile->track_commit_timestamp);
        }
 }





This is the output -- note the second hunk which removes the
RecoveryRequiresBoolParameter() call is missing.

*** a/src/backend/access/transam/xlog.c
--- b/src/backend/access/transam/xlog.c
***************
*** 5826,5844 **** do { \
                                                minValue))); \
  } while(0)

- #define RecoveryRequiresBoolParameter(param_name, currValue, masterValue) \
- do { \
-       bool _currValue = (currValue); \
-       bool _masterValue = (masterValue); \
-       if (_currValue != _masterValue) \
-               ereport(ERROR, \
-                               (errcode(ERRCODE_INVALID_PARAMETER_VALUE), \
-                                errmsg("hot standby is not possible because it
requires \"%s\" to be same on master and standby (master has \"%s\", standby
has \"%s\")", \
-                                               param_name, \
-                                               _masterValue ? "true" :
"false", \
-                                               _currValue ? "true" :
"false"))); \
- } while(0)
-
  /*
   * Check to see if required parameters are set high enough on this server
   * for various aspects of recovery operation.
--- 5826,5831 ----



-- System Information:
Debian Release: 8.2
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=es_CL.utf8, LC_CTYPE=es_CL.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages diffutils depends on:
ii  libc6  2.19-18+deb8u1

diffutils recommends no packages.

Versions of packages diffutils suggests:
pn  diffutils-doc  <none>
pn  wdiff          <none>
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 22e6a21..0266d61 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -5826,19 +5826,6 @@ do { \
 						minValue))); \
 } while(0)
 
-#define RecoveryRequiresBoolParameter(param_name, currValue, masterValue) \
-do { \
-	bool _currValue = (currValue); \
-	bool _masterValue = (masterValue); \
-	if (_currValue != _masterValue) \
-		ereport(ERROR, \
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE), \
-				 errmsg("hot standby is not possible because it requires \"%s\" to be same on master and standby (master has \"%s\", standby has \"%s\")", \
-						param_name, \
-						_masterValue ? "true" : "false", \
-						_currValue ? "true" : "false"))); \
-} while(0)
-
 /*
  * Check to see if required parameters are set high enough on this server
  * for various aspects of recovery operation.
@@ -5885,9 +5872,6 @@ CheckRequiredParameterValues(void)
 		RecoveryRequiresIntParameter("max_locks_per_transaction",
 									 max_locks_per_xact,
 									 ControlFile->max_locks_per_xact);
-		RecoveryRequiresBoolParameter("track_commit_timestamp",
-									  track_commit_timestamp,
-									  ControlFile->track_commit_timestamp);
 	}
 }
 
*** a/src/backend/access/transam/xlog.c
--- b/src/backend/access/transam/xlog.c
***************
*** 5826,5844 **** do { \
  						minValue))); \
  } while(0)
  
- #define RecoveryRequiresBoolParameter(param_name, currValue, masterValue) \
- do { \
- 	bool _currValue = (currValue); \
- 	bool _masterValue = (masterValue); \
- 	if (_currValue != _masterValue) \
- 		ereport(ERROR, \
- 				(errcode(ERRCODE_INVALID_PARAMETER_VALUE), \
- 				 errmsg("hot standby is not possible because it requires \"%s\" to be same on master and standby (master has \"%s\", standby has \"%s\")", \
- 						param_name, \
- 						_masterValue ? "true" : "false", \
- 						_currValue ? "true" : "false"))); \
- } while(0)
- 
  /*
   * Check to see if required parameters are set high enough on this server
   * for various aspects of recovery operation.
--- 5826,5831 ----

Reply via email to