ludo@gnu.org (Ludovic Courtès) writes: > Mark H Weaver skribis: > >> Nikita Karetnikov writes: >> >>> OK, I fetched the tarballs. Now I’m getting this error. >>> >>> >>> $ ./pre-inst-env guix build -K hello >>> >>> [...] >>> >>> make-3.82/main.c >>> make-3.82/README.OS2 >>> make-3.82/remote-cstms.c >>> phase `unpack' succeeded after 4 seconds >>> shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device >>> starting phase `patch' >>> applying patch `/nix/store/nf226injsfkw8ljjjfq1280jj530xbvv-make-impure-dirs.patch' >>> patching file read.c >>> Hunk #1 succeeded at 109 (offset 10 lines). >>> patching file remake.c >>> Hunk #1 succeeded at 1509 (offset 57 lines). >>> phase `patch' succeeded after 0 seconds >>> shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device >>> starting phase `patch-source-shebangs' >>> patch-shebang: ./config/mdate-sh: changing `/bin/sh' to >>> /nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh' >>> patch-shebang: ./config/compile: changing `/bin/sh' to >>> /nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh' >>> patch-shebang: ./config/config.guess: changing `/bin/sh' to >>> /nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh' >>> patch-shebang: ./config/missing: changing `/bin/sh' to >>> /nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh' >>> patch-shebang: ./config/mkinstalldirs: changing `/bin/sh' to >>> /nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh' >>> patch-shebang: ./config/depcomp: changing `/bin/sh' to >>> /nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh' >>> patch-shebang: ./config/config.rpath: changing `/bin/sh' to >>> /nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh' >>> patch-shebang: ./config/install-sh: changing `/bin/sh' to >>> /nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh' >>> patch-shebang: ./config/config.sub: changing `/bin/sh' to >>> /nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh' >>> patch-shebang: ./tests/scripts/targets/SECONDARY: warning: no binary for interpreter `-*-perl-*-' found in $PATH >>> patch-shebang: ./tests/run_make_tests.pl: warning: no binary for interpreter `perl' found in $PATH >>> patch-shebang: ./tests/test_driver.pl: warning: no binary for interpreter `perl' found in $PATH >>> patch-shebang: ./tests/run_make_tests: changing `/bin/sh' to >>> /nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh' >>> patch-shebang: ./tests/mkshadow: changing `/bin/sh' to >>> /nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh' >>> patch-shebang: ./build.sh.in: changing `/bin/sh' to >>> /nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh' >>> patch-shebang: ./configure: changing `/bin/sh' to >>> /nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh' >>> phase `patch-source-shebangs' succeeded after 1 seconds >>> shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device >>> starting phase `configure' >>> source directory: "/tmp/nix-build-make-boot0-3.82.drv-2/make-3.82" (relative from build: ".") >>> build directory: "/tmp/nix-build-make-boot0-3.82.drv-2/make-3.82" >>> configure flags: >>> ("CONFIG_SHELL=/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/bash" >>> "SHELL=/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/bash" >>> "--prefix=/nix/store/4ksc0dgml5158lrz3047bxn0ignw1943-make-boot0-3.82" >>> "--enable-fast-install") >>> shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device >>> configure: WARNING: unrecognized options: --enable-fast-install >>> pwd: error retrieving current directory: getcwd: cannot access parent directories: Success >>> pwd: error retrieving current directory: getcwd: cannot access parent directories: Bad address >>> configure: error: working directory cannot be determined >>> phase `configure' failed after 0 seconds >> [...] >> >> I've run into the same problem, using bootstrap binaries I cross-built >> myself based on my "wip-loongson" branch. >> >> I can run the cross-build bootstrap binaries outside of guix-builder, >> and they seem to work fine. I've tested 'bash' and 'guile', among other >> things. The "shell-init" problem seems to be specific to the >> environment within guix-builder. > > Good, that’s consistent. :-) > >> I'm at a bit of a loss of how best to debug problems that only happen >> within guix-builder. Any suggestions? > > Bruce force: > > strace -f -p $(pidof guix-daemon) -o log & > guix build -e '(@@ (gnu packages base) gnu-make-boot0)' > grep -E '(ENOTTY|getcwd)' log Thanks. Since 'strace' doesn't support MIPS N64 well, and also because I think N32 is a more desirable target for now, I started bootstrapping for MIPS N32, and ran this test again. Same problem. Using 'strace', I determined that 'pwd' is failing because the inode numbers reported by 'stat' and 'getdents64' are inconsistent. 'pwd' works (roughly) as follows: it uses 'stat' to determine the inode number of the current directory, and then reads the parent directory looking for the entry whose inode matches the inode of the current directory. It repeats this process until it reaches the root node. In this case, because the inode numbers are inconsistent, it fails to find an entry in the parent directory whose inode matches. I've looked at the inode numbers in binary and hex, and they're not getting munged in any simple way that's immediately obvious to me. See below for details. Any ideas? Mark Here are the inode numbers as reported by ls -lia: --8<---------------cut here---------------start------------->8--- mhw:/tmp$ ls -lia nix-build-make-boot0-3.82.drv-0/ total 16 7274550 drwxr-xr-x 3 guix-builder1 guix-builder 4096 Oct 8 17:19 . 7072375 drwxrwxrwt 9 root root 4096 Oct 8 17:19 .. 7272956 -rw-r--r-- 1 guix-builder1 guix-builder 1141 Oct 8 17:19 environment-variables 7274551 drwxr-xr-x 8 guix-builder1 guix-builder 4096 Oct 8 17:19 make-3.82 --8<---------------cut here---------------end--------------->8--- Here's a summary of what the 'strace' output tells me: * The initial stat(".") syscall reports inode 7274551, which corresponds to "/tmp/nix-build-make-boot0-3.82.drv-0/make-3.82", as expected. * stat("/") reports inode 1073173, which looks WRONG. * stat("..") reports inode 7274550, which corresponds to "/tmp/nix-build-make-boot0-3.82.drv-0", as expected. * reading the contents of ".." reports inode numbers that all look correct, including "make-3.82" with inode 7274551, the same as ".". Thus 'pwd' concludes that its result will end with "/make-3.82". * stat("../..") reports inode 1073174, which looks WRONG. * reading the contents of "../.." reports inode numbers that all look WRONG: "nix-build-make-boot0-3.82.drv-0" with inode 1073325 ".." with inode 1073173 "." with inode 1073174 None of these match the inode of "..", so 'pwd' fails. Note that the inode for ".." matches the inode returned by stat("/"). Also note that there are two inode numbers reported for /tmp/nix-build-make-boot0-3.82.drv-0: 7274550 (0x6F0036) and 1073325 (0x1060AD) My suspicion is that my kernel (linux-libre-2.6.39.1) and Guix's glibc are not playing nicely together. However, Guix's glibc was configured to support kernels as early as 2.6.30, and the same 'pwd' executable that fails within 'guix-daemon' seems to work outside of it, even when run within a chroot. Any ideas? Mark