Subject: Incorrect argument handling in "guix shell"
From: Konrad Hinsen <[email-masked]>
To: [email-masked]
Date: Thu, 25 Nov 2021 08:57:20 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

The following session illustrates that the -D option to "guix shell" is
erroneously applied to *two* package arguments rather than just one if
the first package argument takes the form of a file.

The file "empty-package.scm" is attached, it defines an empty package
with no inputs. The environment defined by the command below should thus
contain only "hello" and "bash", plus the run-time dependencies of
"bash". Instead, it contains the build dependencies of "hello".

$ guix shell --container -D -f empty-package.scm hello
[env]$ cat $GUIX_ENVIRONMENT/manifest
;; This file was automatically generated and is for internal use only.
;; It cannot be passed to the '--manifest' option.
;; Run 'guix package --export-manifest' if you want to export a file
;; suitable for '--manifest'.

(manifest
  (version 3)
  (packages
    (("tar"
      "1.32"
      "out"
      "/gnu/store/v6f44zccwh9z5zk3pjlywjybbi8n2hjh-tar-1.32"
      (propagated-inputs ())
      (search-paths ())
      (properties))
     ("gzip"
      "1.10"
      "out"
      "/gnu/store/ncydgq2znms5n1d2k5yqshhf58nsixwv-gzip-1.10"
      (propagated-inputs ())
      (search-paths ())
      (properties))
     ("bzip2"
      "1.0.8"
      "out"
      "/gnu/store/i8h2pcxqdq07ijm3ibkka8f4smn1w48v-bzip2-1.0.8"
      (propagated-inputs ())
      (search-paths ())
      (properties))
     ("xz"
      "5.2.4"
      "out"
      "/gnu/store/9860f1abqj8wjjnwl8a9v54pdcc3bhgf-xz-5.2.4"
      (propagated-inputs ())
      (search-paths ())
      (properties))
     ("file"
      "5.38"
      "out"
      "/gnu/store/60g7r3l01fd7c58yjbm6krgcwj1jkpwg-file-5.38"
      (propagated-inputs ())
      (search-paths ())
      (properties))
     ("diffutils"
      "3.7"
      "out"
      "/gnu/store/n4n560pfvvw50a9369axw5vj5rrqfj1n-diffutils-3.7"
      (propagated-inputs ())
      (search-paths ())
      (properties))
     ("patch"
      "2.7.6"
      "out"
      "/gnu/store/cd5qf3kcnlq35p9k392pjdpdzpsnds70-patch-2.7.6"
      (propagated-inputs ())
      (search-paths ())
      (properties))
     ("findutils"
      "4.7.0"
      "out"
      "/gnu/store/hic7snhayfl7m6cpfqqr73nmm19bpqkg-findutils-4.7.0"
      (propagated-inputs ())
      (search-paths ())
      (properties))
     ("gawk"
      "5.0.1"
      "out"
      "/gnu/store/swqdvwri9dbv6zssg6v0by7l05hd6wxp-gawk-5.0.1"
      (propagated-inputs ())
      (search-paths ())
      (properties))
     ("sed"
      "4.8"
      "out"
      "/gnu/store/ishk7fswcs4gkwcp8mh788z4mvvl9bxh-sed-4.8"
      (propagated-inputs ())
      (search-paths ())
      (properties))
     ("grep"
      "3.4"
      "out"
      "/gnu/store/bhs4rj58v8j1narb2454raan2ps38xd8-grep-3.4"
      (propagated-inputs ())
      (search-paths ())
      (properties))
     ("coreutils"
      "8.32"
      "out"
      "/gnu/store/57xj5gcy1jbl9ai2lnrqnpr0dald9i65-coreutils-8.32"
      (propagated-inputs ())
      (search-paths ())
      (properties))
     ("make"
      "4.3"
      "out"
      "/gnu/store/hm40bxnv8jxmbc1lpb7zfimii4xm9m81-make-4.3"
      (propagated-inputs ())
      (search-paths ())
      (properties))
     ("bash-minimal"
      "5.0.16"
      "out"
      "/gnu/store/pwcp239kjf7lnj5i4lkdzcfcxwcfyk72-bash-minimal-5.0.16"
      (propagated-inputs ())
      (search-paths
        (("BASH_LOADABLES_PATH"
          ("lib/bash")
          ":"
          directory
          #f)))
      (properties))
     ("ld-wrapper"
      "0"
      "out"
      "/gnu/store/mpa04aq8lblbcviyxywxcsb1zbi0mf39-ld-wrapper-0"
      (propagated-inputs ())
      (search-paths ())
      (properties))
     ("binutils"
      "2.34"
      "out"
      "/gnu/store/m1z7cdbqsqyp9xnjw5cvlb4a7gkcg3m4-binutils-2.34"
      (propagated-inputs ())
      (search-paths ())
      (properties))
     ("gcc"
      "7.5.0"
      "out"
      "/gnu/store/rn75fm7adgx3pw5j8pg3bczfqq1y17lk-gcc-7.5.0"
      (propagated-inputs ())
      (search-paths
        (("C_INCLUDE_PATH" ("include") ":" directory #f)
         ("CPLUS_INCLUDE_PATH"
          ("include/c++" "include")
          ":"
          directory
          #f)
         ("LIBRARY_PATH" ("lib" "lib64") ":" directory #f)))
      (properties))
     ("glibc"
      "2.31"
      "out"
      "/gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31"
      (propagated-inputs
        (("linux-libre-headers"
          "5.4.20"
          "out"
          "/gnu/store/gfapkk5c6hvl1d94m4sqnhn7f9l5gqyh-linux-libre-headers-5.4.20"
          (propagated-inputs ())
          (search-paths ())
          (properties))))
      (search-paths
        (("GUIX_LOCPATH" ("lib/locale") ":" directory #f)))
      (properties))
     ("glibc"
      "2.31"
      "static"
      "/gnu/store/s3dcqzwqaakv1yx37by9chksdbkgih17-glibc-2.31-static"
      (propagated-inputs
        (("linux-libre-headers"
          "5.4.20"
          "out"
          "/gnu/store/gfapkk5c6hvl1d94m4sqnhn7f9l5gqyh-linux-libre-headers-5.4.20"
          (propagated-inputs ())
          (search-paths ())
          (properties))))
      (search-paths
        (("GUIX_LOCPATH" ("lib/locale") ":" directory #f)))
      (properties))
     ("glibc-utf8-locales"
      "2.31"
      "out"
      "/gnu/store/hwcky7446s952w0mwchhmm211ll07zrq-glibc-utf8-locales-2.31"
      (propagated-inputs ())
      (search-paths ())
      (properties))
     ("linux-libre-headers"
      "5.4.20"
      "out"
      "/gnu/store/gfapkk5c6hvl1d94m4sqnhn7f9l5gqyh-linux-libre-headers-5.4.20"
      (propagated-inputs ())
      (search-paths ())
      (properties)))))