3'/>
<meta name='robots' content='noindex, nofollow'/>
<link rel='stylesheet' type='text/css' href='/cgit-static/cgit.css'/>
<link rel='stylesheet' type='text/css' href='/cgit-static/better-cgit-markdown-heading-color.css'/>
<link rel='shortcut icon' href='/cgit-static/favicon.ico'/>
<link rel='alternate' title='Atom feed' href='https://git.koszko.org/guix/atom/?h=koszko' type='application/atom+xml'/>
</head>
<body>
<div id='cgit'><table id='header'>
<tr>
<td class='logo' rowspan='2'><a href='/'><img src='https://git.koszko.org/cgit-static/cgit.png' alt='cgit logo'/></a></td>
<td class='main'><a href='/'>index</a> : <a href='/guix/'>guix</a></td><td class='form'><form method='get'>
<input type='hidden' name='id' value='4e01e900f43549c93d8d1836a82bcb3f7065cc2e'/><select name='h' onchange='this.form.submit();'>
<option value='koszko' selected='selected'>koszko</option>
<option value='koszko-scripts'>koszko-scripts</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>Wojtek's customized Guix</td><td class='sub right'></td></tr></table>
<table class='tabs'><tr><td>
<a class='active' href='/guix/about/'>about</a><a href='/guix/'>summary</a><a href='/guix/refs/?id=4e01e900f43549c93d8d1836a82bcb3f7065cc2e'>refs</a><a href='/guix/log/'>log</a><a href='/guix/tree/?id=4e01e900f43549c93d8d1836a82bcb3f7065cc2e'>tree</a><a href='/guix/commit/?id=4e01e900f43549c93d8d1836a82bcb3f7065cc2e'>commit</a><a href='/guix/diff/?id=4e01e900f43549c93d8d1836a82bcb3f7065cc2e'>diff</a></td><td class='form'><form class='right' method='get' action='/guix/log/'>
<input type='hidden' name='id' value='4e01e900f43549c93d8d1836a82bcb3f7065cc2e'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='content'><div id='summary'><pre>
# GNU Guix --- Functional package management for GNU
# Copyright © 2021-2023 Ludovic Courtès &lt;ludo@gnu.org&gt;
#
# This file is part of GNU Guix.
#
# GNU Guix is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# GNU Guix is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Guix.  If not, see &lt;http://www.gnu.org/licenses/&gt;.

#
# Test the &apos;guix shell&apos; alias.
#

guix shell --version

configdir=&quot;t-guix-shell-config-$$&quot;
tmpdir=&quot;t-guix-shell-$$&quot;
trap &apos;rm -r &quot;$tmpdir&quot; &quot;$configdir&quot;&apos; EXIT
mkdir &quot;$tmpdir&quot; &quot;$configdir&quot; &quot;$configdir/guix&quot;

XDG_CONFIG_HOME=&quot;$(realpath $configdir)&quot;
export XDG_CONFIG_HOME

guix shell --bootstrap --pure guile-bootstrap -- guile --version

# &apos;--symlink&apos; can only be used with --container.
guix shell --bootstrap guile-bootstrap -S /dummy=bin/guile &amp;&amp; false

# &apos;--ad-hoc&apos; is a thing of the past.
guix shell --ad-hoc guile-bootstrap &amp;&amp; false

# Rejecting unsupported packages.
guix shell -s armhf-linux intelmetool -n &amp;&amp; false

# Test approximately that the child process does not inherit extra file
# descriptors.  Ideally we&apos;d check there&apos;s nothing more than 0, 1, and 2, but
# we cannot do that because (1) we might be inheriting additional FDs, for
# example due to &lt;https://issues.guix.gnu.org/57567&gt;, and (2) Bash itself
# opens a couple of extra FDs.
initial_fd_list=&quot;$(echo /proc/$$/fd/*)&quot;
fd_list=&quot;$(guix shell --bootstrap guile-bootstrap -- \
		 bash -c &apos;echo /proc/$$/fd/*&apos;)&quot;
test &quot;$(echo $fd_list | wc -w)&quot; -le &quot;$(echo $initial_fd_list | wc -w)&quot;

# Ignoring unauthorized files.
cat &gt; &quot;$tmpdir/guix.scm&quot; &lt;&lt;EOF
This is a broken guix.scm file.
EOF
(cd &quot;$tmpdir&quot;; SHELL=&quot;$(type -P true)&quot; guix shell --bootstrap 2&gt; &quot;stderr&quot;) &amp;&amp; false
grep &quot;not authorized&quot; &quot;$tmpdir/stderr&quot;
rm &quot;$tmpdir/stderr&quot;

# Authorize the directory.
echo &quot;$(realpath &quot;$tmpdir&quot;)&quot; &gt; &quot;$configdir/guix/shell-authorized-directories&quot;

# Ignoring &apos;manifest.scm&apos; and &apos;guix.scm&apos; in non-interactive use.
(cd &quot;$tmpdir&quot;; guix shell --bootstrap -- true)
mv &quot;$tmpdir/guix.scm&quot; &quot;$tmpdir/manifest.scm&quot;
(cd &quot;$tmpdir&quot;; guix shell --bootstrap -- true)
rm &quot;$tmpdir/manifest.scm&quot;

# Honoring the local &apos;manifest.scm&apos; file.
cat &gt; &quot;$tmpdir/manifest.scm&quot; &lt;&lt;EOF
(specifications-&gt;manifest &apos;(&quot;guile-bootstrap&quot;))
EOF
cat &gt; &quot;$tmpdir/fake-shell.sh&quot; &lt;&lt;EOF
#!$SHELL
# This fake shell allows us to test interactive use.
exec echo &quot;\$GUIX_ENVIRONMENT&quot;
EOF
chmod +x &quot;$tmpdir/fake-shell.sh&quot;
profile1=&quot;$(cd &quot;$tmpdir&quot;; SHELL=&quot;$(realpath fake-shell.sh)&quot; guix shell --bootstrap)&quot;
profile2=&quot;$(guix shell --bootstrap guile-bootstrap -- &quot;$SHELL&quot; -c &apos;echo $GUIX_ENVIRONMENT&apos;)&quot;
test -n &quot;$profile1&quot;
test &quot;$profile1&quot; = &quot;$profile2&quot;
rm &quot;$tmpdir/manifest.scm&quot;

# Do not read manifest when passed &apos;-q&apos;.
echo &quot;Broken manifest.&quot; &gt; &quot;$tmpdir/manifest.scm&quot;
(cd &quot;$tmpdir&quot;; SHELL=&quot;$(realpath fake-shell.sh)&quot; guix shell --bootstrap -q)
rm &quot;$tmpdir/manifest.scm&quot;

# Make sure &apos;-D&apos; affects only the immediately following &apos;-f&apos;, and not packages
# that appear later: &lt;https://issues.guix.gnu.org/52093&gt;.
cat &gt; &quot;$tmpdir/empty-package.scm&quot; &lt;&lt;EOF
(use-modules (guix) (guix tests)
             (guix build-system trivial))

(dummy-package &quot;empty-package&quot;
  (build-system trivial-build-system))   ;zero inputs
EOF

guix shell --bootstrap --pure -D -f &quot;$tmpdir/empty-package.scm&quot; \
     guile-bootstrap -- guile --version
rm &quot;$tmpdir/empty-package.scm&quot;

# Make sure &apos;--development&apos; honors &apos;--system&apos;.
this_system=&quot;$(guile -c &apos;(use-modules (guix utils))
  (display (%current-system))&apos;)&quot;
other_system=&quot;$(guile -c &apos;(use-modules (guix utils))
  (display (if (string=? &quot;riscv64-linux&quot; (%current-system))
	       &quot;x86_64-linux&quot;
	       &quot;riscv64-linux&quot;))&apos;)&quot;
cat &gt; &quot;$tmpdir/some-package.scm&quot; &lt;&lt;EOF
(use-modules (guix utils)
             (guix packages)
             (gnu packages base))

(define unsupported-dependency
  (package
    (inherit grep)
    (name &quot;unsupported-dependency&quot;)
    (supported-systems &apos;())))

(package
  (inherit hello)
  (name &quot;phony-package&quot;)
  (inputs
    (if (string=? (%current-system) &quot;$this_system&quot;)
        (list unsupported-dependency)
        &apos;())))
EOF

guix shell -D -f &quot;$tmpdir/some-package.scm&quot; -n &amp;&amp; false
guix shell -D -f &quot;$tmpdir/some-package.scm&quot; -n -s &quot;$other_system&quot;


if guile -c &apos;(getaddrinfo &quot;www.gnu.org&quot; &quot;80&quot; AI_NUMERICSERV)&apos; 2&gt; /dev/null
then
    # Compute the build environment for the initial GNU Make.
    guix shell --bootstrap --no-substitutes --search-paths --pure \
         -D -e &apos;(@ (guix tests) gnu-make-for-tests)&apos; &gt; &quot;$tmpdir/a&quot;

    # Make sure bootstrap binaries are in the profile.
    profile=`grep &quot;^export PATH&quot; &quot;$tmpdir/a&quot; | sed -r &apos;s|^.*=&quot;(.*)/bin&quot;|\1|&apos;`

    # Make sure the bootstrap binaries are all listed where they belong.
    grep -E &quot;^export PATH=\&quot;$profile/bin\&quot;&quot;               &quot;$tmpdir/a&quot;
    grep -E &quot;^export C_INCLUDE_PATH=\&quot;$profile/include\&quot;&quot; &quot;$tmpdir/a&quot;
    grep -E &quot;^export LIBRARY_PATH=\&quot;$profile/lib\&quot;&quot;       &quot;$tmpdir/a&quot;
    for dep in bootstrap-binaries-0 gcc-bootstrap-0 glibc-bootstrap-0
    do
	guix gc --references &quot;$profile&quot; | grep &quot;$dep&quot;
    done

    # &apos;make-boot0&apos; itself must not be listed.
    guix gc --references &quot;$profile&quot; | grep make-boot0 &amp;&amp; false

    # Honoring the local &apos;guix.scm&apos; file.
    echo &apos;(@ (guix tests) gnu-make-for-tests)&apos; &gt; &quot;$tmpdir/guix.scm&quot;
    (cd &quot;$tmpdir&quot;; guix shell --bootstrap --search-paths --pure &gt; &quot;b&quot;)
    cmp &quot;$tmpdir/a&quot; &quot;$tmpdir/b&quot;
    rm &quot;$tmpdir/guix.scm&quot;
fi
</pre>
</div></div> <!-- class=content -->
                         <div class=footer>generated by
                             <a href="https://git.zx2c4.com/cgit/about/">
                                 cgit
                             </a>
                         </div>
                        </div> <!-- id=cgit -->
</body>
</html>
