Subject: bug#40650: ‘scandir*’ test failure

From: Ludovic Courtès <[email-masked]>
Date: Sat, 18 Apr 2020 21:53:48 +0200

Hey,

Vagrant Cascadian <[email-masked]> skribis:

> test-name: scandir*, properties
> location: /build/guix-YPdZIs/guix-1.1.0/tests/syscalls.scm:257
> source:
> + (test-assert
> +   "scandir*, properties"
> +   (let ((directory
> +           (dirname
> +             (search-path %load-path "guix/base32.scm"))))
> +     (every (lambda (entry name)
> +              (match entry
> +                     ((name2 . properties)
> +                      (and (string=? name2 name)
> +                           (let* ((full (string-append directory "/" name))
> +                                  (stat (lstat full))
> +                                  (inode (assoc-ref properties 'inode))
> +                                  (type (assoc-ref properties 'type)))
> +                             (and (= inode (stat:ino stat))
> +                                  (or (eq? type 'unknown)
> +                                      (eq? type (stat:type stat)))))))))
> +            (pk (scandir* directory))
> +            (pk (scandir directory (const #t) string<?)))))
>
> ;;; ((("." (type . directory) (inode . 656899)) (".." (type . directory) (inode . 655381)) ("base16.go" (type . regular) (inode . 673193)) ("base16.scm" (type . regular) (inode . 656947)) ("base32.go" (type . regular) (inode . 674231)) ("base32.scm" (type . regular) (inode . 656911)) ("base64.go" (type . regular) (inode . 675116)) ("base64.scm" (type . regular) (inode . 657151)) ("build" (type . directory) (inode . 657319)) ("build-system" (type . directory) (inode . 657157)) ("build-system.go" (type . regular) (inode . 673229)) ("build-system.scm" (type . regular) (inode . 656914)) ("bzr-download.go" (type . regular) (inode . 674252)) ("bzr-download.scm" (type . regular) (inode . 656932)) ("cache.go" (type . regular) (inode . 673222)) ("cache.scm" (type . regular) (inode . 657532)) ("channels.go" (type . regular) (inode . 675153)) ("channels.scm" (type . regular) (inode . 657499)) ("ci.go" (type . regular) (inode . 674235)) ("ci.scm" (type . regular) (inode . 657298)) ("colors.go" (type . regular) (inode . 673271)) ("colors.scm" (type . regular) (inode . 656965)) ("combinators.go" (type . regular) (inode . 675122)) ("combinators.scm" (type . regular) (inode . 656926)) ("config.go" (type . regular) (inode . 676566)) ("config.scm" (type . regular) (inode . 675006)) ("config.scm.in" (type . regular) (inode . 657505)) ("cpio.go" (type . regular) (inode . 675880)) ("cpio.scm" (type . regular) (inode . 656935)) ("cve.go" (type . regular) (inode . 675915)) ("cve.scm" (type . regular) (inode . 657295)) ("cvs-download.go" (type . regular) (inode . 674303)) ("cvs-download.scm" (type . regular) (inode . 657265)) ("deprecation.go" (type . regular) (inode . 674238)) ("deprecation.scm" (type . regular) (inode . 656962)) ("derivations.go" (type . regular) (inode . 675143)) ("derivations.scm" (type . regular) (inode . 657544)) ("describe.go" (type . regular) (inode . 675149)) ("describe.scm" (type . regular) (inode . 656908)) ("diagnostics.go" (type . regular) (inode . 675214)) ("diagnostics.scm" (type . regular) (inode . 656902)) ("discovery.go" (type . regular) (inode . 675897)) ("discovery.scm" (type . regular) (inode . 656971)) ("docker.go" (type . regular) (inode . 673196)) ("docker.scm" (type . regular) (inode . 656968)) ("download.go" (type . regular) (inode . 675127)) ("download.scm" (type . regular) (inode . 657310)) ("elf.go" (type . regular) (inode . 673265)) ("elf.scm" (type . regular) (inode . 657301)) ("ftp-client.go" (type . regular) (inode . 674297)) ("ftp-client.scm" (type . regular) (inode . 657538)) ("gexp.go" (type . regular) (inode . 673203)) ("gexp.scm" (type . regular) (inode . 656941)) ("git-download.go" (type . regular) (inode . 674255)) ("git-download.scm" (type . regular) (inode . 657316)) ("git.go" (type . regular) (inode . 673219)) ("git.scm" (type . regular) (inode . 656905)) ("glob.go" (type . regular) (inode . 673216)) ("glob.scm" (type . regular) (inode . 656929)) ("gnu-maintenance.go" (type . regular) (inode . 673210)) ("gnu-maintenance.scm" (type . regular) (inode . 657517)) ("gnupg.go" (type . regular) (inode . 675940)) ("gnupg.scm" (type . regular) (inode . 657292)) ("grafts.go" (type . regular) (inode . 674258)) ("grafts.scm" (type . regular) (inode . 657520)) ("graph.go" (type . regular) (inode . 675175)) ("graph.scm" (type . regular) (inode . 656917)) ("hg-download.go" (type . regular) (inode . 675900)) ("hg-download.scm" (type . regular) (inode . 657508)) ("http-client.go" (type . regular) (inode . 674300)) ("http-client.scm" (type . regular) (inode . 657526)) ("i18n.go" (type . regular) (inode . 675211)) ("i18n.scm" (type . regular) (inode . 657268)) ("import" (type . directory) (inode . 657574)) ("inferior.go" (type . regular) (inode . 675146)) ("inferior.scm" (type . regular) (inode . 657523)) ("json.go" (type . regular) (inode . 675883)) ("json.scm" (type . regular) (inode . 657145)) ("licenses.go" (type . regular) (inode . 673213)) ("licenses.scm" (type . regular) (inode . 657502)) ("lint.go" (type . regular) (inode . 675912)) ("lint.scm" (type . regular) (inode . 657277)) ("lzlib.go" (type . regular) (inode . 674267)) ("lzlib.scm" (type . regular) (inode . 656923)) ("man-db.scm" (type . regular) (inode . 657280)) ("memoization.go" (type . regular) (inode . 675889)) ("memoization.scm" (type . regular) (inode . 656956)) ("modules.go" (type . regular) (inode . 674249)) ("modules.scm" (type . regular) (inode . 657541)) ("monad-repl.go" (type . regular) (inode . 675903)) ("monad-repl.scm" (type . regular) (inode . 657529)) ("monads.go" (type . regular) (inode . 673200)) ("monads.scm" (type . regular) (inode . 657547)) ("nar.go" (type . regular) (inode . 675906)) ("nar.scm" (type . regular) (inode . 656977)) ("packages.go" (type . regular) (inode . 675997)) ("packages.scm" (type . regular) (inode . 657289)) ("pki.go" (type . regular) (inode . 674242)) ("pki.scm" (type . regular) (inode . 657571)) ("profiles.go" (type . regular) (inode . 675139)) ("profiles.scm" (type . regular) (inode . 657514)) ("profiling.go" (type . regular) (inode . 675943)) ("profiling.scm" (type . regular) (inode . 657274)) ("progress.go" (type . regular) (inode . 675886)) ("progress.scm" (type . regular) (inode . 657283)) ("records.go" (type . regular) (inode . 675119)) ("records.scm" (type . regular) (inode . 657313)) ("remote.scm" (type . regular) (inode . 657154)) ("repl.go" (type . regular) (inode . 674262)) ("repl.scm" (type . regular) (inode . 656938)) ("scripts" (type . directory) (inode . 656983)) ("scripts.go" (type . regular) (inode . 674383)) ("scripts.scm" (type . regular) (inode . 657271)) ("search-paths.go" (type . regular) (inode . 674352)) ("search-paths.scm" (type . regular) (inode . 656944)) ("self.go" (type . regular) (inode . 675167)) ("self.scm" (type . regular) (inode . 656920)) ("serialization.go" (type . regular) (inode . 673206)) ("serialization.scm" (type . regular) (inode . 657535)) ("sets.go" (type . regular) (inode . 674246)) ("sets.scm" (type . regular) (inode . 656953)) ("ssh.scm" (type . regular) (inode . 656980)) ("status.go" (type . regular) (inode . 674311)) ("status.scm" (type . regular) (inode . 657307)) ("store" (type . directory) (inode . 657553)) ("store.go" (type . regular) (inode . 673268)) ("store.scm" (type . regular) (inode . 657550)) ("svn-download.go" (type . regular) (inode . 675208)) ("svn-download.scm" (type . regular) (inode . 656974)) ("swh.go" (type . regular) (inode . 675130)) ("swh.scm" (type . regular) (inode . 657148)) ("tests" (type . directory) (inode . 657256)) ("tests.go" (type . regular) (inode . 676569)) ("tests.scm" (type . regular) (inode . 656950)) ("ui.go" (type . regular) (inode . 674307)) ("ui.scm" (type . regular) (inode . 657304)) ("upstream.go" (type . regular) (inode . 675171)) ("upstream.scm" (type . regular) (inode . 657286)) ("utils.go" (type . regular) (inode . 675892)) ("utils.scm" (type . regular) (inode . 657511)) ("workers.go" (type . regular) (inode . 673225)) ("workers.scm" (type . regular) (inode . 656959)) ("zlib.go" (type . regular) (inode . 675918)) ("zlib.scm" (type . regular) (inode . 657637))))
>
> ;;; (("." ".." "base16.go" "base16.scm" "base32.go" "base32.scm" "base64.go" "base64.scm" "build" "build-system" "build-system.go" "build-system.scm" "bzr-download.go" "bzr-download.scm" "cache.go" "cache.scm" "channels.go" "channels.scm" "ci.go" "ci.scm" "colors.go" "colors.scm" "combinators.go" "combinators.scm" "config.go" "config.scm" "config.scm.in" "cpio.go" "cpio.scm" "cve.go" "cve.scm" "cvs-download.go" "cvs-download.scm" "deprecation.go" "deprecation.scm" "derivations.go" "derivations.scm" "describe.go" "describe.scm" "diagnostics.go" "diagnostics.scm" "discovery.go" "discovery.scm" "docker.go" "docker.scm" "download.go" "download.scm" "elf.go" "elf.scm" "ftp-client.go" "ftp-client.scm" "gexp.go" "gexp.scm" "git-download.go" "git-download.scm" "git.go" "git.scm" "glob.go" "glob.scm" "gnu-maintenance.go" "gnu-maintenance.scm" "gnupg.go" "gnupg.scm" "grafts.go" "grafts.scm" "graph.go" "graph.scm" "hg-download.go" "hg-download.scm" "http-client.go" "http-client.scm" "i18n.go" "i18n.scm" "import" "inferior.go" "inferior.scm" "json.go" "json.scm" "licenses.go" "licenses.scm" "lint.go" "lint.scm" "lzlib.go" "lzlib.scm" "man-db.scm" "memoization.go" "memoization.scm" "modules.go" "modules.scm" "monad-repl.go" "monad-repl.scm" "monads.go" "monads.scm" "nar.go" "nar.scm" "packages.go" "packages.scm" "pki.go" "pki.scm" "profiles.go" "profiles.scm" "profiling.go" "profiling.scm" "progress.go" "progress.scm" "records.go" "records.scm" "remote.scm" "repl.go" "repl.scm" "scripts" "scripts.go" "scripts.scm" "search-paths.go" "search-paths.scm" "self.go" "self.scm" "serialization.go" "serialization.scm" "sets.go" "sets.scm" "ssh.scm" "status.go" "status.scm" "store" "store.go" "store.scm" "svn-download.go" "svn-download.scm" "swh.go" "swh.scm" "tests" "tests.go" "tests.scm" "ui.go" "ui.scm" "upstream.go" "upstream.scm" "utils.go" "utils.scm" "workers.go" "workers.scm" "zlib.go" "zlib.scm"))
> actual-value: #f
> result: FAIL

Looking at this test, the only way ‘every’ could return #f is (1) if
‘lstat’ returns a different inode number, or (2) if ‘lstat’ returns a
different file type than the one for ‘scandir*’.

Unfortunately it’s hard to tell more without debugging interactively on
the machine, adding ‘pk’ calls here and there to see.

Can you reproduce this test failure in a simpler environment when
interactive debugging is possible?

Thanks,
Ludo’.