[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#37702: Suggestion for 'df' utility
From: |
Bernhard Voelker |
Subject: |
bug#37702: Suggestion for 'df' utility |
Date: |
Sun, 31 May 2020 11:36:31 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 |
On 2020-05-31 01:07, Paul Eggert wrote:
> On 5/30/20 4:49 AM, Erik Auerswald wrote:
>> I concur that a command line option to override config file (or env var)
>> settings seems useful if a config file and/or env var approach is used.
Just to mention another alternative to control the behavior besides env
variables or
config files: it would theoretically also be possible to add a './configure'
option
to add more file system types to the list of pseudofilesystems at build time.
Obviously, such idea moves the responsibility to the packager - which is not
nice either.
> In other utilities we've been moving away from environment variables and/or
> config files for the usual security and other-hassle reasons. So I'd prefer
> having 'df' just do the "right" thing by default, and to have an option to
> override that. The "right" thing should be to ignore all these
> pseudofilesystems
> that hardly anybody cares about.
+1
What about to start with this?
$ GIT_PAGER= git -C gnulib diff
diff --git a/lib/mountlist.c b/lib/mountlist.c
index 7abe0248e..5f6249dec 100644
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -164,6 +164,9 @@
#define ME_DUMMY_0(Fs_name, Fs_type) \
(strcmp (Fs_type, "autofs") == 0 \
+ || strcmp (Fs_type, "tmpfs") == 0 \
+ || strcmp (Fs_type, "devtmpfs") == 0 \
+ || strcmp (Fs_type, "squashfs") == 0 \
|| strcmp (Fs_type, "proc") == 0 \
|| strcmp (Fs_type, "subfs") == 0 \
/* for Linux 2.6/3.x */ \
Example output (here on openSUSE:Tumbleweed):
$ src/df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda2 ext4 20G 14G 5.1G 73% /
/dev/sda5 ext4 591G 278G 313G 48% /media/big_data
/dev/loop0 ext2 31M 31M 0 100% /FULL_PARTITION_TMPDIR
/dev/sda3 ext3 109G 90G 14G 87% /home
... thus omitting those mounts:
$ diff -wu0 <(/usr/bin/df -Th) <(src/df -Th)
--- /dev/fd/63 2020-05-31 11:30:29.991664999 +0200
+++ /dev/fd/62 2020-05-31 11:30:29.987664947 +0200
@@ -2,4 +1,0 @@
-devtmpfs devtmpfs 9.8G 8.0K 9.8G 1% /dev
-tmpfs tmpfs 9.8G 640K 9.8G 1% /dev/shm
-tmpfs tmpfs 9.8G 18M 9.8G 1% /run
-tmpfs tmpfs 9.8G 0 9.8G 0% /sys/fs/cgroup
@@ -10 +5,0 @@
-tmpfs tmpfs 2.0G 44K 2.0G 1% /run/user/1000
Have a nice day,
Berny