Subject: bug#47379: "statfs" test in tests/syscall.scm fails with BTRFS file systems.

From: Efraim Flashner <[email-masked]>
Date: Thu, 25 Mar 2021 12:04:10 +0200

On Thu, Mar 25, 2021 at 09:49:08AM +0100, Maxime Devos wrote:
> Hi Guix,
> 
> Version:
> guix (GNU Guix) 1155a88308df7649fe74bd5bb8279a4d103ce386
> 
> The following test fails:
> 
> (start snip)
> test-name: statfs
> location: $HOME/guix/git/guix/tests/syscalls.scm:123
> source:
> + (test-assert
> +   "statfs"
> +   (let ((fs (statfs "/")))
> +     (and (file-system? fs)
> +          (> (file-system-block-size fs) 0)
> +          (>= (file-system-blocks-available fs) 0)
> +          (>= (file-system-blocks-free fs)
> +              (file-system-blocks-available fs)))))
> actual-value: #f
> result: FAIL
> (end snip)
> 
> Evaluating (statfs "/") from a REPL gives:
> 
> scheme@(guix-user)> ((@ (guix build syscalls) statfs) "/")
> $2 = #<<file-system> type: 2435016766 block-size: 4096 blocks: 244189696 blocks-free: 178549974 blocks-available: 178571318 files: 0 free-
> files: 0 identifier: (1111009624 2088757363) name-length: 255 fragment-size: 4096 mount-flags: 1056 spare: (0 0 0 0)>
> 
> It seems the following does not hold on my system:
> +          (>= (file-system-blocks-free fs)
> +              (file-system-blocks-available fs))
> 

I'm also running on btrfs
(ins)scheme@(guile-user)> (statfs "/")
$1 = #<<file-system> type: 2435016766 block-size: 4096 blocks: 244049664 blocks-free: 165299045 blocks-available: 165178857 files: 0 free-files: 0 identifier:
(2930232877 3283401406) name-length: 255 fragment-size: 4096 mount-flags: 4128 spare: (0 0 0 0)>
(cmd)scheme@(guile-user)> (>= (file-system-blocks-free (statfs "/")) (file-system-blocks-available (statfs "/")))
$5 = #t

(ins)efraim@3900XT ~$ btrfs filesystem df /
Data, single: total=289.00GiB, used=287.83GiB
System, single: total=32.00MiB, used=48.00KiB
Metadata, single: total=13.00GiB, used=12.07GiB
GlobalReserve, single: total=512.00MiB, used=0.00B

When was the last time you ran btrfs balance? Regardless, we still want
this test to pass on btrfs.

-- 
Efraim Flashner   <[email-masked]>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted