Steve Langasek has proposed merging 
lp:~vorlon/upstart/fix-environ-order-assumption into lp:upstart.

Requested reviews:
  Upstart Reviewers (upstart-reviewers)

For more details, see:
https://code.launchpad.net/~vorlon/upstart/fix-environ-order-assumption/+merge/136045

POSIX does not guarantee any particular ordering of environ, so sort the
  contents before printing them.  This will fix the recipe build failures in
  the ppa builders.
-- 
https://code.launchpad.net/~vorlon/upstart/fix-environ-order-assumption/+merge/136045
Your team Upstart Reviewers is requested to review the proposed merge of 
lp:~vorlon/upstart/fix-environ-order-assumption into lp:upstart.
=== modified file 'ChangeLog'
--- ChangeLog	2012-11-23 11:36:47 +0000
+++ ChangeLog	2012-11-25 09:43:25 +0000
@@ -1,3 +1,10 @@
+2012-11-25  Steve Langasek <[email protected]>
+
+	* init/tests/test_job_process.c: POSIX does not guarantee any
+	  particular ordering of environ, so sort the contents before
+	  printing them.  This will fix the recipe build failures in the
+	  ppa builders.
+
 2012-11-23  James Hunt  <[email protected]>
 
 	[ Colin King <[email protected]> ]

=== modified file 'init/tests/test_job_process.c'
--- init/tests/test_job_process.c	2012-11-18 18:21:54 +0000
+++ init/tests/test_job_process.c	2012-11-25 09:43:25 +0000
@@ -163,6 +163,12 @@
 	return 1;
 }
 
+static int
+strcmp_compar (const void *a, const void *b)
+{
+	return strcmp(*(char * const *)a, *(char * const *)b);
+}
+
 static void
 child (enum child_tests  test,
        const char       *filename)
@@ -203,6 +209,10 @@
 		fprintf (out, "wd: %s\n", path);
 		break;
 	case TEST_ENVIRONMENT:
+		/* guarantee output ordering */
+		for (i = 0; environ[i]; i++);
+		qsort (environ, i, sizeof (environ[0]), strcmp_compar);
+
 		for (char **env = environ; *env; env++)
 			fprintf (out, "%s\n", *env);
 		break;
@@ -669,10 +679,10 @@
 		 * the job.
 		 */
 		output = fopen (filename, "r");
+		TEST_FILE_EQ (output, "BAR=BAZ\n");
 		TEST_FILE_EQ (output, "FOO=BAR\n");
-		TEST_FILE_EQ (output, "BAR=BAZ\n");
+		TEST_FILE_EQ (output, "UPSTART_INSTANCE=\n");
 		TEST_FILE_EQ (output, "UPSTART_JOB=test\n");
-		TEST_FILE_EQ (output, "UPSTART_INSTANCE=\n");
 		TEST_FILE_EQ (output, "UPSTART_NO_SESSIONS=1\n");
 		TEST_FILE_END (output);
 		fclose (output);
@@ -722,10 +732,10 @@
 		 * the job.
 		 */
 		output = fopen (filename, "r");
+		TEST_FILE_EQ (output, "BAR=BAZ\n");
 		TEST_FILE_EQ (output, "FOO=BAR\n");
-		TEST_FILE_EQ (output, "BAR=BAZ\n");
-		TEST_FILE_EQ (output, "UPSTART_JOB=test\n");
 		TEST_FILE_EQ (output, "UPSTART_INSTANCE=foo\n");
+		TEST_FILE_EQ (output, "UPSTART_JOB=test\n");
 		TEST_FILE_EQ (output, "UPSTART_NO_SESSIONS=1\n");
 		TEST_FILE_END (output);
 		fclose (output);
@@ -776,11 +786,11 @@
 		 * the job.
 		 */
 		output = fopen (filename, "r");
-		TEST_FILE_EQ (output, "FOO=SMACK\n");
 		TEST_FILE_EQ (output, "BAR=BAZ\n");
 		TEST_FILE_EQ (output, "CRACKLE=FIZZ\n");
+		TEST_FILE_EQ (output, "FOO=SMACK\n");
+		TEST_FILE_EQ (output, "UPSTART_INSTANCE=\n");
 		TEST_FILE_EQ (output, "UPSTART_JOB=test\n");
-		TEST_FILE_EQ (output, "UPSTART_INSTANCE=\n");
 		TEST_FILE_EQ (output, "UPSTART_NO_SESSIONS=1\n");
 		TEST_FILE_END (output);
 		fclose (output);
@@ -831,11 +841,11 @@
 		 * the job.
 		 */
 		output = fopen (filename, "r");
-		TEST_FILE_EQ (output, "FOO=SMACK\n");
 		TEST_FILE_EQ (output, "BAR=BAZ\n");
 		TEST_FILE_EQ (output, "CRACKLE=FIZZ\n");
+		TEST_FILE_EQ (output, "FOO=SMACK\n");
+		TEST_FILE_EQ (output, "UPSTART_INSTANCE=\n");
 		TEST_FILE_EQ (output, "UPSTART_JOB=test\n");
-		TEST_FILE_EQ (output, "UPSTART_INSTANCE=\n");
 		TEST_FILE_EQ (output, "UPSTART_NO_SESSIONS=1\n");
 		TEST_FILE_END (output);
 		fclose (output);
@@ -4337,8 +4347,8 @@
 	waitpid (pid, NULL, 0);
 	output = fopen (filename, "r");
 
+	TEST_FILE_EQ (output, "FOO=bar\n");
 	TEST_FILE_EQ (output, "PATH=/bin\n");
-	TEST_FILE_EQ (output, "FOO=bar\n");
 	TEST_FILE_EQ (output, "UPSTART_NO_SESSIONS=1\n");
 	TEST_FILE_END (output);
 

-- 
upstart-devel mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/upstart-devel

Reply via email to