From 8d97c1dcfa44b8925c693cf605ec3ee0cf44e75f Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Mon, 23 Nov 2009 16:02:24 +0000
Subject: [PATCH] Use diff's -w switch only on Windows, to avoid problems with
 inconsistent newline representations.  Per buildfarm results and subsequent
 discussion. Sync up a couple of other places that had their own policies.

---
 src/interfaces/ecpg/test/pg_regress_ecpg.c | 12 ++----------
 src/test/mb/mbregress.sh                   |  4 ++--
 src/test/regress/pg_regress.c              | 13 +++++++++++--
 3 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/src/interfaces/ecpg/test/pg_regress_ecpg.c b/src/interfaces/ecpg/test/pg_regress_ecpg.c
index 4681d8c771b..e04e9038f38 100644
--- a/src/interfaces/ecpg/test/pg_regress_ecpg.c
+++ b/src/interfaces/ecpg/test/pg_regress_ecpg.c
@@ -11,7 +11,7 @@
  * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/interfaces/ecpg/test/pg_regress_ecpg.c,v 1.5 2009/01/01 17:24:02 momjian Exp $
+ * $PostgreSQL: pgsql/src/interfaces/ecpg/test/pg_regress_ecpg.c,v 1.6 2009/11/23 16:02:24 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -161,15 +161,7 @@ ecpg_start_test(const char *testname,
 static void
 ecpg_init(void)
 {
-	/* no reason to set -w for ecpg checks, except for when on windows */
-	if (strstr(host_platform, "-win32") || strstr(host_platform, "-mingw32"))
-		basic_diff_opts = "-w";
-	else
-		basic_diff_opts = "";
-	if (strstr(host_platform, "-win32") || strstr(host_platform, "-mingw32"))
-		pretty_diff_opts = "-C3 -w";
-	else
-		pretty_diff_opts = "-C3";
+	/* nothing to do here at the moment */
 }
 
 int
diff --git a/src/test/mb/mbregress.sh b/src/test/mb/mbregress.sh
index 8a2aca6267b..7a6e1e281c4 100644
--- a/src/test/mb/mbregress.sh
+++ b/src/test/mb/mbregress.sh
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $PostgreSQL: pgsql/src/test/mb/mbregress.sh,v 1.10 2009/05/06 16:15:21 tgl Exp $
+# $PostgreSQL: pgsql/src/test/mb/mbregress.sh,v 1.11 2009/11/23 16:02:24 tgl Exp $
 
 if echo '\c' | grep -s c >/dev/null 2>&1
 then
@@ -49,7 +49,7 @@ do
   
 	if [ `diff ${EXPECTED} results/${i}.out | wc -l` -ne 0 ]
 	then
-		( diff -wC3 ${EXPECTED} results/${i}.out; \
+		( diff -C3 ${EXPECTED} results/${i}.out; \
 		echo "";  \
 		echo "----------------------"; \
 		echo "" ) >> regression.diffs
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index c6bfbdce164..7fe472b5037 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -11,7 +11,7 @@
  * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.66 2009/11/22 17:54:23 tgl Exp $
+ * $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.67 2009/11/23 16:02:24 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -65,9 +65,18 @@ static char *makeprog = MAKEPROG;
 static char *shellprog = SHELLPROG;
 #endif
 
-/* currently we can use the same diff switches on all platforms */
+/*
+ * On Windows we use -w in diff switches to avoid problems with inconsistent
+ * newline representation.  The actual result files will generally have
+ * Windows-style newlines, but the comparison files might or might not.
+ */
+#ifndef WIN32
 const char *basic_diff_opts = "";
 const char *pretty_diff_opts = "-C3";
+#else
+const char *basic_diff_opts = "-w";
+const char *pretty_diff_opts = "-w -C3";
+#endif
 
 /* options settable from command line */
 _stringlist *dblist = NULL;
-- 
GitLab