summary refs log tree commit diff
path: root/gnu/packages/aux-files
diff options
context:
space:
mode:
authorLudovic Courtès <ludovic.courtes@inria.fr>2020-04-24 14:30:38 +0200
committerLudovic Courtès <ludo@gnu.org>2020-04-24 16:21:13 +0200
commit2520059bdb43fa1663ce102f3f4c442d4918c32b (patch)
tree6b5038f9e65c49c862dfae705a2eaa57b9351a1b /gnu/packages/aux-files
parent193192ca77bffddd241b6706df21b5e8bccc4cce (diff)
downloadguix-2520059bdb43fa1663ce102f3f4c442d4918c32b.tar.gz
pack: 'guix pack -R' wrapper correctly reports exit code.
Fixes <https://bugs.gnu.org/40816>.
Reported by Jan (janneke) Nieuwenhuizen <janneke@gnu.org>.

* gnu/packages/aux-files/run-in-namespace.c (main): In the 'default'
case, check 'WIFEXITED (status)' and exit with the corresponding code in
that case.  Exit with 255 in other cases.
* tests/guix-pack-relocatable.sh: Add test.
Diffstat (limited to 'gnu/packages/aux-files')
-rw-r--r--gnu/packages/aux-files/run-in-namespace.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gnu/packages/aux-files/run-in-namespace.c b/gnu/packages/aux-files/run-in-namespace.c
index 551f4db88a..160f7da1c8 100644
--- a/gnu/packages/aux-files/run-in-namespace.c
+++ b/gnu/packages/aux-files/run-in-namespace.c
@@ -1,5 +1,5 @@
 /* GNU Guix --- Functional package management for GNU
-   Copyright (C) 2018, 2019 Ludovic Courtès <ludo@gnu.org>
+   Copyright (C) 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
 
    This file is part of GNU Guix.
 
@@ -343,7 +343,13 @@ Please refer to the 'guix pack' documentation for more information.\n");
 	    chdir ("/");			  /* avoid EBUSY */
 	    rm_rf (new_root);
 	    free (new_root);
-	    exit (status);
+
+	    if (WIFEXITED (status))
+	      exit (WEXITSTATUS (status));
+	    else
+	      /* Abnormal termination cannot really be reproduced, so exit
+		 with 255.  */
+	      exit (255);
 	  }
 	}
     }