unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David Thompson <dthompson2@worcester.edu>
To: guix-devel@gnu.org
Subject: [PATCH] build: container: Fix call-with-clean-exit.
Date: Fri, 09 Oct 2015 16:26:45 -0400	[thread overview]
Message-ID: <87a8rrrdoa.fsf@izanagi.i-did-not-set--mail-host-address--so-tickle-me> (raw)

[-- Attachment #1: Type: text/plain, Size: 92 bytes --]

An oversight on my part that I noticed while doing 'guix environment
--container' testing.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-build-container-Fix-call-with-clean-exit.patch --]
[-- Type: text/x-patch, Size: 1429 bytes --]

From dc72ee831d6c6b93cf404a7fd1abc4b8fb27b7f2 Mon Sep 17 00:00:00 2001
From: David Thompson <dthompson2@worcester.edu>
Date: Fri, 9 Oct 2015 12:33:40 -0400
Subject: [PATCH] build: container: Fix call-with-clean-exit.

Before, call-with-clean-exit would *always* return an exit code of 1.

* gnu/build/linux-container.scm (call-with-clean-exit): Exit with status
  code of 0 if thunk does not throw an exception.
* tests/containers.scm: Add test.
---
 gnu/build/linux-container.scm | 4 +++-
 tests/containers.scm          | 4 ++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gnu/build/linux-container.scm b/gnu/build/linux-container.scm
index 95220d0..e911494 100644
--- a/gnu/build/linux-container.scm
+++ b/gnu/build/linux-container.scm
@@ -36,7 +36,9 @@
   "Apply THUNK, but exit with a status code of 1 if it fails."
   (dynamic-wind
     (const #t)
-    thunk
+    (lambda ()
+      (thunk)
+      (primitive-exit 0))
     (lambda ()
       (primitive-exit 1))))
 
diff --git a/tests/containers.scm b/tests/containers.scm
index 4783f8e..0ba8149 100644
--- a/tests/containers.scm
+++ b/tests/containers.scm
@@ -34,6 +34,10 @@
 
 (test-begin "containers")
 
+(test-assert "call-with-container, exit with 0 when there is no error"
+  (zero?
+   (call-with-container '() (const #t) #:namespaces '(user))))
+
 (test-assert "call-with-container, user namespace"
   (zero?
    (call-with-container '()
-- 
2.5.0


[-- Attachment #3: Type: text/plain, Size: 38 bytes --]


-- 
David Thompson
GPG Key: 0FF1D807

             reply	other threads:[~2015-10-09 20:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-09 20:26 David Thompson [this message]
2015-10-09 21:59 ` [PATCH] build: container: Fix call-with-clean-exit Ludovic Courtès
2015-10-10 13:01   ` Thompson, David

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a8rrrdoa.fsf@izanagi.i-did-not-set--mail-host-address--so-tickle-me \
    --to=dthompson2@worcester.edu \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).