]> git.proxmox.com Git - pve-common.git/commitdiff
fix bug #264: use option pipefail for shell commands
authorDietmar Maurer <dietmar@proxmox.com>
Mon, 29 Oct 2012 08:45:50 +0000 (09:45 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 29 Oct 2012 08:45:50 +0000 (09:45 +0100)
Normal unix shell pipe return the exits status of the last command.
If pipefail is enabled, the pipeline's return status is the value of
the last  (rightmost)  command to  exit  with a non-zero status, or zero
if all commands exit successfully.

Makefile
data/PVE/Tools.pm
debian/changelog

index f6571e7d18eb17fe7141c3817ebc12d4b566f13c..94fcaf79761289260d3b3f18355f7f80f237b699 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 RELEASE=2.2
 
 VERSION=1.0
-PKGREL=36
+PKGREL=37
 
 PACKAGE=libpve-common-perl
 
index 43b30b14bd7c913145036270210a37298850ced1..27b4361f7f11c9a6d76d3a48b0a9a465bc86c074 100644 (file)
@@ -207,7 +207,12 @@ sub run_command {
 
     if (!ref($cmd)) {
        $cmdstr = $cmd;
-       $cmd = [ $cmd ];
+       if ($cmd =~ m/|/) {
+           # see 'man bash' for option pipefail
+           $cmd = [ '/bin/bash', '-c', "set -o pipefail && $cmd" ];
+       } else {
+           $cmd = [ $cmd ];
+       }
     } else {
        $cmdstr = cmd2string($cmd);
     }
index fc27fdf264841b2cbd3607e0ca89380e560c7231..3d3261177d1241db872d6108a556d92144ad0123 100644 (file)
@@ -1,3 +1,9 @@
+libpve-common-perl (1.0-37) unstable; urgency=low
+
+  * fix bug #264: use option pipefail for shell commands
+
+ -- Proxmox Support Team <support@proxmox.com>  Mon, 29 Oct 2012 09:45:11 +0100
+
 libpve-common-perl (1.0-36) unstable; urgency=low
 
   * new helper wait_for_vnc_port()