Subject: store test fail in pure environment

From: Fredrik Salomonsson <[email-masked]>
Date: Sun, 04 Oct 2020 17:07:04 -0700

Hi,

I've been trying to build guix from git, following the steps in the
manual but a test in tests/store.scm is failing:

```
make  check-recursive
make[1]: Entering directory '/home/plattfot/projects/guix'
Making check in po/guix
make[2]: Entering directory '/home/plattfot/projects/guix/po/guix'
make[2]: Leaving directory '/home/plattfot/projects/guix/po/guix'
Making check in po/packages
make[2]: Entering directory '/home/plattfot/projects/guix/po/packages'
make[2]: Leaving directory '/home/plattfot/projects/guix/po/packages'
make[2]: Entering directory '/home/plattfot/projects/guix'
Compiling Scheme modules...
make  check-TESTS check-local
make[3]: Entering directory '/home/plattfot/projects/guix'
make[4]: Entering directory '/home/plattfot/projects/guix'
PASS: tests/accounts.scm
PASS: tests/base16.scm
PASS: tests/base32.scm
PASS: tests/base64.scm
PASS: tests/bournish.scm
PASS: tests/builders.scm
PASS: tests/build-utils.scm
PASS: tests/cache.scm
PASS: tests/challenge.scm
PASS: tests/channels.scm
PASS: tests/combinators.scm
PASS: tests/containers.scm
PASS: tests/cpan.scm
SKIP: tests/cpio.scm
PASS: tests/cran.scm
PASS: tests/crate.scm
PASS: tests/cve.scm
PASS: tests/debug-link.scm
PASS: tests/derivations.scm
PASS: tests/discovery.scm
PASS: tests/elpa.scm
PASS: tests/file-systems.scm
PASS: tests/gem.scm
PASS: tests/gexp.scm
PASS: tests/git.scm
PASS: tests/git-authenticate.scm
PASS: tests/glob.scm
PASS: tests/gnu-maintenance.scm
PASS: tests/grafts.scm
PASS: tests/graph.scm
PASS: tests/gremlin.scm
SKIP: tests/hackage.scm
PASS: tests/import-utils.scm
PASS: tests/inferior.scm
PASS: tests/lint.scm
PASS: tests/modules.scm
PASS: tests/monads.scm
PASS: tests/nar.scm
PASS: tests/networking.scm
PASS: tests/opam.scm
PASS: tests/openpgp.scm
PASS: tests/packages.scm
PASS: tests/pack.scm
PASS: tests/pki.scm
PASS: tests/print.scm
PASS: tests/processes.scm
PASS: tests/profiles.scm
PASS: tests/publish.scm
PASS: tests/pypi.scm
PASS: tests/records.scm
PASS: tests/scripts.scm
PASS: tests/scripts-build.scm
PASS: tests/search-paths.scm
PASS: tests/services.scm
PASS: tests/services/linux.scm
PASS: tests/sets.scm
PASS: tests/size.scm
SKIP: tests/snix.scm
PASS: tests/status.scm
PASS: tests/store-database.scm
PASS: tests/store-deduplication.scm
PASS: tests/store-roots.scm
make[4]: *** [Makefile:5365: tests/store.log] Error 1
make[4]: Leaving directory '/home/plattfot/projects/guix'
make[3]: *** [Makefile:5347: check-TESTS] Error 2
make[3]: Leaving directory '/home/plattfot/projects/guix'
make[2]: *** [Makefile:5596: check-am] Error 2
make[2]: Leaving directory '/home/plattfot/projects/guix'
make[1]: *** [Makefile:5124: check-recursive] Error 1
make[1]: Leaving directory '/home/plattfot/projects/guix'
make: *** [Makefile:5598: check] Error 2
```

Here is the section in the tests/store.log that is failing
```
test-name: add-file-tree-to-store
location: /home/plattfot/projects/guix/tests/store.scm:243
source:
+ (test-equal
+   "add-file-tree-to-store"
+   `(42
+     ("." directory #t)
+     ("./bar" directory #t)
+     ("./foo" directory #t)
+     ("./foo/a" regular "file a")
+     ("./foo/b" symlink "a")
+     ("./foo/c" directory #t)
+     ("./foo/c/p" regular "file p")
+     ("./foo/c/q" directory #t)
+     ("./foo/c/q/x"
+      regular
+      ,(string-append "#!" %shell "\nexit 42"))
+     ("./foo/c/q/y" symlink "..")
+     ("./foo/c/q/z" directory #t))
+   (let* ((tree `("file-tree"
+                  directory
+                  ("foo"
+                   directory
+                   ("a" regular (data "file a"))
+                   ("b" symlink "a")
+                   ("c"
+                    directory
+                    ("p" regular (data ,(string->utf8 "file p")))
+                    ("q"
+                     directory
+                     ("x"
+                      executable
+                      (data ,(string-append "#!" %shell "\nexit 42")))
+                     ("y" symlink "..")
+                     ("z" directory))))
+                  ("bar" directory)))
+          (result (add-file-tree-to-store %store tree)))
+     (cons (status:exit-val
+             (system* (string-append result "/foo/c/q/x")))
+           (with-directory-excursion
+             result
+             (map (lambda (file)
+                    (let ((type (stat:type (lstat file))))
+                      `(,file
+                        ,type
+                        ,(match type
+                                ((or 'regular 'executable)
+                                 (call-with-input-file file get-string-all))
+                                ('symlink (readlink file))
+                                ('directory #t)))))
+                  (find-files "." #:directories? #t))))))
Backtrace:
          14 (primitive-load-path "tests/store.scm")
In ice-9/eval.scm:
    619:8 13 (_ #(#(#<directory (test-store) 7fab3ea85d20> #<te?>) #))
   293:34 12 (_ #(#(#<directory (test-store) 7fab3ea85d20> #<te?>) #))
    159:9 11 (_ #(#(#<directory (test-store) 7fab3ea85d20> #<te?>) #))
    159:9 10 (_ #(#(#<directory (test-store) 7fab3ea85d20> #<te?>) #))
    159:9  9 (_ #(#(#<directory (test-store) 7fab3ea85d20> #<te?>) #))
    159:9  8 (_ #(#(#<directory (test-store) 7fab3ea85d20> #<te?>) #))
    159:9  7 (_ #(#(#<directory (test-store) 7fab3ea85d20> #<te?>) #))
    159:9  6 (_ #(#(#<directory (test-store) 7fab3ea85d20> #<te?>) #))
    159:9  5 (_ #(#(#<directory (test-store) 7fab3ea85d20> #<te?>) #))
    159:9  4 (_ #(#(#<directory (test-store) 7fab3ea85d20> #<te?>) #))
    159:9  3 (_ #(#(#<directory (test-store) 7fab3ea85d20> #<te?>) #))
    159:9  2 (_ #(#(#<directory (test-store) 7fab3ea85d20> #<te?>) #))
    163:9  1 (_ #(#(#<directory (test-store) 7fab3ea85d20> #<te?>) #))
In unknown file:
           0 (string-append "#!" #f "\nexit 42")

ERROR: In procedure string-append:
In procedure string-append: Wrong type (expecting string): #f
```

The steps I'm running in the local guix clone are:
```
$ sudo git clean -dfx
$ guix environment guix --pure
$ ./bootstrap && ./configure --localstatedir=/var && make -j16 && make check
```

The git commit is 435e5e27742eb71796be8a73be7a6549fd5e9582

SHELL is: `/bin/zsh` and I'm running guix on a foreign distribution
Arch Linux, kernel: 5.8.13-arch1-1

`guix describe` gives:
```
Generation 22   okt 03 2020 18:33:59    (current)
  guix 3dc064f
    repository URL: https://git.savannah.gnu.org/git/guix.git
    branch: master
    commit: 3dc064f66c72ba923aba8b1e592d949c6e6b3219
```

The environment after `guix environment guix --pure`
```
LOGNAME=plattfot
HOME=/home/plattfot
TERM=xterm-256color
USER=plattfot
DISPLAY=:1
PAGER=less
PATH=/home/plattfot/.local/bin:/home/plattfot/bin:/gnu/store/i7z4pfa0c22q0qkxyl7fy2nlp3w658yg-profile/bin:/gnu/store/i7z4pfa0c22q0qkxyl7fy2nlp3w658yg-profile/sbin:/home/plattfot/.antigen/bundles/robbyrussell/oh-my-zsh/lib:/home/plattfot/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/git:/home/plattfot/.antigen/bundles/plattfot/zsh-theme
PKG_CONFIG_PATH=/gnu/store/i7z4pfa0c22q0qkxyl7fy2nlp3w658yg-profile/lib/pkgconfig
GUILE_LOAD_PATH=/gnu/store/i7z4pfa0c22q0qkxyl7fy2nlp3w658yg-profile/share/guile/site/3.0
GUILE_LOAD_COMPILED_PATH=/gnu/store/i7z4pfa0c22q0qkxyl7fy2nlp3w658yg-profile/lib/guile/3.0/site-ccache:/gnu/store/i7z4pfa0c22q0qkxyl7fy2nlp3w658yg-profile/share/guile/site/3.0
ACLOCAL_PATH=/gnu/store/i7z4pfa0c22q0qkxyl7fy2nlp3w658yg-profile/share/aclocal
INFOPATH=/gnu/store/i7z4pfa0c22q0qkxyl7fy2nlp3w658yg-profile/share/info
C_INCLUDE_PATH=/gnu/store/i7z4pfa0c22q0qkxyl7fy2nlp3w658yg-profile/include
CPLUS_INCLUDE_PATH=/gnu/store/i7z4pfa0c22q0qkxyl7fy2nlp3w658yg-profile/include/c++:/gnu/store/i7z4pfa0c22q0qkxyl7fy2nlp3w658yg-profile/include
LIBRARY_PATH=/gnu/store/i7z4pfa0c22q0qkxyl7fy2nlp3w658yg-profile/lib
GUIX_LOCPATH=/gnu/store/i7z4pfa0c22q0qkxyl7fy2nlp3w658yg-profile/lib/locale
GUIX_ENVIRONMENT=/gnu/store/i7z4pfa0c22q0qkxyl7fy2nlp3w658yg-profile
SHLVL=1
PWD=/home/plattfot/projects/guix
OLDPWD=/home/plattfot/projects/guix
LESS=-R
LSCOLORS=Gxfxcxdxbxegedabagacad
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
EDITOR=emacsclient -a vim
GTK_IM_MODULE=ibus
XMODIFIERS=@im=ibus
QT_IM_MODULE=ibus
_=/gnu/store/i7z4pfa0c22q0qkxyl7fy2nlp3w658yg-profile/bin/env
```

I've also tested this with bash (`SHELL=$(which bash) bash` before the
steps in the repro), same error.

The test will pass if I run:

```
sudo git clean -dfx
guix environment guix -- sh -c './bootstrap && ./configure --localstatedir=/var && make -j16 && make check'
```
I.e. not a pure environment.

With that I get a testsuite summary. One test is still failing but it is
not relevant to this bug report.

Thanks

-- 
s/Fred[re]+i[ck]+/Fredrik/g