--- Python-2.6.2/Lib/subprocess.py.orig 2009-03-04 00:55:00.000000000 +0200 +++ Python-2.6.2/Lib/subprocess.py 2009-08-14 10:18:56.000000000 +0200 @@ -990,7 +990,7 @@ args = list(args) if shell: - args = ["/bin/sh", "-c"] + args + args = ["/bin/sh", "-c"] + [" ".join(args)] if executable is None: executable = args[0] --- Python-2.6.2/Lib/test/test_subprocess.py.orig 2009-02-14 19:04:26.000000000 +0200 +++ Python-2.6.2/Lib/test/test_subprocess.py 2009-08-12 10:32:14.000000000 +0200 @@ -593,6 +593,15 @@ env=newenv) self.assertEqual(p.stdout.read().strip(), "apple") + def test_shell_sequence_args(self): + # Run command through the shell (sequence) containing arguments + newenv = os.environ.copy() + newenv["FRUIT"] = "apple" + p = subprocess.Popen(["echo", "$FRUIT"], shell=1, + stdout=subprocess.PIPE, + env=newenv) + self.assertEqual(p.stdout.read().strip(), "apple") + def test_shell_string(self): # Run command through the shell (string) newenv = os.environ.copy() @@ -693,6 +702,16 @@ env=newenv) self.assertNotEqual(p.stdout.read().find("physalis"), -1) + def test_shell_sequence_args(self): + # Run command through the shell (sequence) + newenv = os.environ.copy() + newenv["FRUIT"] = "physalis" + # this should invoke the variable-setting mode and not output anything + p = subprocess.Popen(["set", "FRUIT=silasyhp"], shell=1, + stdout=subprocess.PIPE, + env=newenv) + self.assertEqual(p.stdout.read().find("physalis"), -1) + def test_shell_string(self): # Run command through the shell (string) newenv = os.environ.copy()