GNU bug report logs - #60202
tests/cpio failure

Previous Next

Package: guix;

Reported by: Christopher Baines <mail <at> cbaines.net>

Date: Mon, 19 Dec 2022 14:47:02 UTC

Severity: normal

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 60202 in the body.
You can then email your comments to 60202 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#60202; Package guix. (Mon, 19 Dec 2022 14:47:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christopher Baines <mail <at> cbaines.net>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Mon, 19 Dec 2022 14:47:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: bug-guix <at> gnu.org
Subject: tests/cpio failure
Date: Mon, 19 Dec 2022 14:44:20 +0000
[Message part 1 (text/plain, inline)]
This test seems to fail, maybe because of high inode numbers, maybe
something to with btrfs.

I saw this with the failed builds here
https://data.guix.gnu.org/gnu/store/kg93i3bmvpdfkiqyx6g9r7ywh0xpvm8w-guix-1.4.0


cbaines <at> milano-guix-1 ~$ guix repl
GNU Guile 3.0.8
Copyright (C) 1995-2021 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guix-user)> (use-modules (guix cpio))
scheme@(guix-user)> (file->cpio-header "guix/guix.scm")
$1 = #<<cpio-header> magic: 460545 ino: 5031515288 mode: 33188 uid: 1003 gid: 998 nlink: 1 mtime: 1671460627 file-size: 1452 dev-maj: 0 dev-min: 24 rdev-maj: 0 rdev-min: 0 name-size: 14 checksum: 0>
scheme@(guix-user)> (use-modules (rnrs io ports))
scheme@(guix-user)> (define header $1)
scheme@(guix-user)> (call-with-values
        (lambda ()
          (open-bytevector-output-port))
      (lambda (port get-bv)
        (write-cpio-header header port)
        (let ((port (open-bytevector-input-port (get-bv))))
          (equal? header (read-cpio-header port)))))
$2 = #f
scheme@(guix-user)>     (call-with-values
        (lambda ()
          (open-bytevector-output-port))
      (lambda (port get-bv)
        (write-cpio-header header port)
        (let ((port (open-bytevector-input-port (get-bv))))
          (equal? (peek "A" header)
                  (peek "B" (read-cpio-header port))))))

;;; ("A" #<<cpio-header> magic: 460545 ino: 5031515288 mode: 33188 uid: 1003 gid: 998 nlink: 1 mtime: 1671460627 file-size: 1452 dev-maj: 0 dev-min: 24 rdev-maj: 0 rdev-min: 0 name-size: 14 checksum: 0>)

;;; ("B" #<<cpio-header> magic: 460545 ino: 736547992 mode: 33188 uid: 1003 gid: 998 nlink: 1 mtime: 1671460627 file-size: 1452 dev-maj: 0 dev-min: 24 rdev-maj: 0 rdev-min: 0 name-size: 14 checksum: 0>)
$3 = #f
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#60202; Package guix. (Mon, 19 Dec 2022 15:01:02 GMT) Full text and rfc822 format available.

Message #8 received at 60202 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Christopher Baines <mail <at> cbaines.net>
Cc: 60202 <at> debbugs.gnu.org
Subject: Re: bug#60202: tests/cpio failure
Date: Mon, 19 Dec 2022 16:00:22 +0100
[Message part 1 (text/plain, inline)]
Hi,

Christopher Baines <mail <at> cbaines.net> skribis:

> This test seems to fail, maybe because of high inode numbers, maybe
> something to with btrfs.

Uh.

> scheme@(guix-user)> (file->cpio-header "guix/guix.scm")
> $1 = #<<cpio-header> magic: 460545 ino: 5031515288 mode: 33188 uid: 1003 gid: 998 nlink: 1 mtime: 1671460627 file-size: 1452 dev-maj: 0 dev-min: 24 rdev-maj: 0 rdev-min: 0 name-size: 14 checksum: 0>

[...]

>         (let ((port (open-bytevector-input-port (get-bv))))
>           (equal? (peek "A" header)
>                   (peek "B" (read-cpio-header port))))))
>
> ;;; ("A" #<<cpio-header> magic: 460545 ino: 5031515288 mode: 33188 uid: 1003 gid: 998 nlink: 1 mtime: 1671460627 file-size: 1452 dev-maj: 0 dev-min: 24 rdev-maj: 0 rdev-min: 0 name-size: 14 checksum: 0>)
>
> ;;; ("B" #<<cpio-header> magic: 460545 ino: 736547992 mode: 33188 uid: 1003 gid: 998 nlink: 1 mtime: 1671460627 file-size: 1452 dev-maj: 0 dev-min: 24 rdev-maj: 0 rdev-min: 0 name-size: 14 checksum: 0>)
> $3 = #f

(guix cpio) defines cpio headers like this:

--8<---------------cut here---------------start------------->8---
(define-pack <cpio-header>
  %make-cpio-header cpio-header?
  write-cpio-header read-cpio-header
  (magic     6  cpio-header-magic)
  (ino       8  cpio-header-inode)
  (mode      8  cpio-header-mode)
  (uid       8  cpio-header-uid)
  (gid       8  cpio-header-gid)
  (nlink     8  cpio-header-nlink)
  (mtime     8  cpio-header-mtime)
  (file-size 8  cpio-header-file-size)
  (dev-maj   8  cpio-header-device-major)
  (dev-min   8  cpio-header-device-minor)
  (rdev-maj  8  cpio-header-rdevice-major)
  (rdev-min  8  cpio-header-rdevice-minor)
  (name-size 8  cpio-header-name-size)
  (checksum  8  cpio-header-checksum))            ;0 for "newc" format
--8<---------------cut here---------------end--------------->8---

The ‘ino’ value is stored as an 8-digit hexadecimal number—i.e., on 32
bits.  And, guess what:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> 5031515288  ;the inode number above
$15 = 5031515288
scheme@(guile-user)> (expt 2 32)
$16 = 4294967296
scheme@(guile-user)> (- $16 $15)
$17 = -736547992
--8<---------------cut here---------------end--------------->8---

Noways, libc + kernel typically use a 64-bit ‘ino_t’, so fundamentally
the cpio format is “wrong”.  But what can we do?

At least we can skip this test when that is the case (patch below).
WDYT?

Thanks,
Ludo’.

[Message part 2 (text/x-patch, inline)]
diff --git a/tests/cpio.scm b/tests/cpio.scm
index 516de0655b..832101d1bb 100644
--- a/tests/cpio.scm
+++ b/tests/cpio.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2015 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2015, 2022 Ludovic Courtès <ludo <at> gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -31,12 +31,18 @@ (define-module (test-cpio)
 (define %cpio-program
   (which "cpio"))
 
+(define %test-file
+  (search-path %load-path "guix.scm"))
+
 
 (test-begin "cpio")
 
+;; The cpio format expects 'ino' to fit in 32 bits.  If we have a bigger inode
+;; number, skip this test.
+(test-skip
+ (if (>= (stat:ino (lstat %test-file)) (expt 2 32)) 1 0))
 (test-assert "file->cpio-header + write-cpio-header + read-cpio-header"
-  (let* ((file   (search-path %load-path "guix.scm"))
-         (header (file->cpio-header file)))
+  (let* ((header (file->cpio-header %test-file)))
     (call-with-values
         (lambda ()
           (open-bytevector-output-port))

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Tue, 20 Dec 2022 16:16:02 GMT) Full text and rfc822 format available.

Notification sent to Christopher Baines <mail <at> cbaines.net>:
bug acknowledged by developer. (Tue, 20 Dec 2022 16:16:02 GMT) Full text and rfc822 format available.

Message #13 received at 60202-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Christopher Baines <mail <at> cbaines.net>
Cc: 60202-done <at> debbugs.gnu.org
Subject: Re: bug#60202: tests/cpio failure
Date: Tue, 20 Dec 2022 17:15:07 +0100
Ludovic Courtès <ludo <at> gnu.org> skribis:

> At least we can skip this test when that is the case (patch below).
> WDYT?

I went ahead with this in 2880dc3046170e9129437caca586f13956d0d811.

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 18 Jan 2023 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 232 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.