From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ting-Wei Lan Subject: bug#35776: Test guix-pack-localstatedir.sh and guix-pack-relocatable.sh crash when /gnu/store doesn't exist Date: Fri, 17 May 2019 21:47:17 +0800 Message-ID: <1e5db66d-99b3-5926-e107-5c63413eb641@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------1BDD2236DE8406A8134F077E" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:35645) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRdDS-0008Sc-Cy for bug-guix@gnu.org; Fri, 17 May 2019 09:48:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hRdDO-0003Uz-OL for bug-guix@gnu.org; Fri, 17 May 2019 09:48:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44265) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hRdDO-0003UT-6l for bug-guix@gnu.org; Fri, 17 May 2019 09:48:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hRdDO-0004ov-1s for bug-guix@gnu.org; Fri, 17 May 2019 09:48:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: Received: from eggs.gnu.org ([209.51.188.92]:35570) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRdCl-00085g-Tt for bug-guix@gnu.org; Fri, 17 May 2019 09:47:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hRdCj-0002uy-T7 for bug-guix@gnu.org; Fri, 17 May 2019 09:47:23 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]:34770) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hRdCj-0002u8-En for bug-guix@gnu.org; Fri, 17 May 2019 09:47:21 -0400 Received: by mail-pf1-x42b.google.com with SMTP id n19so3736542pfa.1 for ; Fri, 17 May 2019 06:47:21 -0700 (PDT) Received: from wn.lant.com.tw ([106.104.151.171]) by smtp.gmail.com with ESMTPSA id b16sm16589915pfd.12.2019.05.17.06.47.18 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 06:47:19 -0700 (PDT) Content-Language: en-US List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: 35776@debbugs.gnu.org This is a multi-part message in MIME format. --------------1BDD2236DE8406A8134F077E Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit When running these two tests in a clean environment without having Guix installed first, they crash when trying to obtain the value of localstatedir. + guix pack --version guix pack (GNU Guix) 1.0.0.711-f52e8-dirty Copyright (C) 2019 the Guix authors License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. ++ guile2.2 -c '(use-modules (guix config))(display %storedir)' + NIX_STORE_DIR=/gnu/store ++ guile2.2 -c '(use-modules (guix config))(display %localstatedir)' Backtrace: In ice-9/eval.scm:     619:8 19 (_ #(#(#))) In ice-9/command-line.scm:    181:18 18 (_ #) In unknown file:           17 (eval (use-modules (guix config)) #) In ice-9/eval.scm:    721:20 16 (primitive-eval (use-modules (guix config))) In ice-9/psyntax.scm:   1235:36 15 (expand-top-sequence ((use-modules (guix config))) _ _ # …)   1182:24 14 (parse _ (("placeholder" placeholder)) ((top) #(# # …)) …)    285:10 13 (parse _ (("placeholder" placeholder)) (()) _ c&e (eval) …) In ice-9/boot-9.scm:   3377:20 12 (process-use-modules _)    222:17 11 (map1 (((guix config))))   3378:31 10 (_ ((guix config)))   2800:17  9 (resolve-interface (guix config) #:select _ #:hide _ # _ …) In ice-9/threads.scm:     390:8  8 (_ _) In ice-9/boot-9.scm:   2726:13  7 (_) In ice-9/threads.scm:     390:8  6 (_ _) In ice-9/boot-9.scm:   2994:20  5 (_)    2312:4  4 (save-module-excursion #)   3014:26  3 (_) In unknown file:            2 (primitive-load-path "guix/config" #) In guix/config.scm:      71:6  1 (_) In unknown file:            0 (canonicalize-path "/gnu/store") ERROR: In procedure canonicalize-path: In procedure canonicalize-path: No such file or directory + localstatedir= FAIL tests/guix-pack-localstatedir.sh (exit status: 1) It seems to me that the reason is that NIX_STORE_DIR is exported by test-env script, so the line NIX_STORE_DIR="`guile -c '(use-modules (guix config))(display %storedir)'`" not only changes the value of shell variable NIX_STORE_DIR but also exports it to the environment. Therefore, the next line localstatedir="`guile -c '(use-modules (guix config))(display %localstatedir)'`" crashes at guix/config.scm when running the code (define %store-directory   (or (and=> (getenv "NIX_STORE_DIR") canonicalize-path)       %storedir)) because NIX_STORE_DIR points to a non-existent path /gnu/store. I attached a patch to avoid the crash by delaying the modification to NIX_STORE_DIR, but I am not sure if it is correct to do so. --------------1BDD2236DE8406A8134F077E Content-Type: text/x-patch; name="guix-1.0.0-tests-guix-pack-localstatedir.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="guix-1.0.0-tests-guix-pack-localstatedir.patch" diff --git a/tests/guix-pack-localstatedir.sh b/tests/guix-pack-localstatedir.sh index b734b0f..41afda1 100644 --- a/tests/guix-pack-localstatedir.sh +++ b/tests/guix-pack-localstatedir.sh @@ -27,8 +27,9 @@ guix pack --version # the test in the user's global store if possible, on the grounds that # binaries may already be there or can be built or downloaded inexpensively. -NIX_STORE_DIR="`guile -c '(use-modules (guix config))(display %storedir)'`" +nix_store_dir="`guile -c '(use-modules (guix config))(display %storedir)'`" localstatedir="`guile -c '(use-modules (guix config))(display %localstatedir)'`" +NIX_STORE_DIR="$nix_store_dir" GUIX_DAEMON_SOCKET="$localstatedir/guix/daemon-socket/socket" export NIX_STORE_DIR GUIX_DAEMON_SOCKET diff --git a/tests/guix-pack-relocatable.sh b/tests/guix-pack-relocatable.sh index 38dcf1e..b276fdc 100644 --- a/tests/guix-pack-relocatable.sh +++ b/tests/guix-pack-relocatable.sh @@ -27,8 +27,9 @@ guix pack --version # run it on the user's global store if possible, on the grounds that binaries # may already be there or can be built or downloaded inexpensively. -NIX_STORE_DIR="`guile -c '(use-modules (guix config))(display %storedir)'`" +nix_store_dir="`guile -c '(use-modules (guix config))(display %storedir)'`" localstatedir="`guile -c '(use-modules (guix config))(display %localstatedir)'`" +NIX_STORE_DIR="$nix_store_dir" GUIX_DAEMON_SOCKET="$localstatedir/guix/daemon-socket/socket" export NIX_STORE_DIR GUIX_DAEMON_SOCKET --------------1BDD2236DE8406A8134F077E--