Merge ~bryce/ubuntu/+source/coreutils:project-c2439-ignore-snaps-groovy into ubuntu/+source/coreutils:ubuntu/devel

Proposed by Bryce Harrington
Status: Merged
Approved by: Bryce Harrington
Approved revision: 410833f805dd31d02d9fd6e4709075ff4b51956f
Merge reported by: Sergio Durigan Junior
Merged at revision: 410833f805dd31d02d9fd6e4709075ff4b51956f
Proposed branch: ~bryce/ubuntu/+source/coreutils:project-c2439-ignore-snaps-groovy
Merge into: ubuntu/+source/coreutils:ubuntu/devel
Diff against target: 62 lines (+40/-0)
3 files modified
debian/changelog (+12/-0)
debian/patches/series (+1/-0)
debian/patches/treat-devtmpfs-and-squashfs-as-dummy-filesystems.patch (+27/-0)
Reviewer Review Type Date Requested Status
Sergio Durigan Junior (community) Approve
Ubuntu Core Development Team Pending
Review via email: mp+386911@code.launchpad.net

Description of the change

This excludes squashfs and devtmpfs filesystems. A better fix would distinguish between snap squashfs and other squashfs usages by filtering on the 'x-gdu.hide' tag, which can be seen via `mount`. This tag is visible via libmount, however unfortunately coreutils (and gnulib) avoid dependence on libmount because it depends on selinux which in turn depends on a lot of extraneous stuff.

I was not able to identify an alternate way to access this tag from within the gnulib codebase, however that would be a helpful refinement to the fix. I plan to continue investigation into that, but meanwhile this patch will improve df usability considerably. The patch is what upstream appears to be considering, and I suspect is close to what will be landed there.

PPA:
  https://launchpad.net/~bryce/+archive/ubuntu/coreutils-project-c2439-ignore-snaps/+packages

Test case:

  $ multipass launch --name ubuntu-groovy daily:20.10
  $ multipass exec ubuntu-groovy -- bash

  Inside vm:
  $ df -h
  Filesystem Size Used Avail Use% Mounted on
  udev 474M 0 474M 0% /dev
  tmpfs 99M 944K 98M 1% /run
  /dev/sda1 4.7G 1.3G 3.5G 26% /
  tmpfs 491M 0 491M 0% /dev/shm
  tmpfs 5.0M 0 5.0M 0% /run/lock
  tmpfs 491M 0 491M 0% /sys/fs/cgroup
  /dev/sda15 105M 3.9M 101M 4% /boot/efi
  tmpfs 99M 0 99M 0% /run/user/1000
  /dev/loop0 30M 30M 0 100% /snap/snapd/8140
  /dev/loop1 55M 55M 0 100% /snap/core18/1754
  /dev/loop2 72M 72M 0 100% /snap/lxd/15913

  Install fix
  ¢ sudo add-apt-repository ppa:bryce/coreutils-project-c2439-ignore-snaps
  ¢ apt-get install coreutils
  ...
  Setting up coreutils (8.30-3ubuntu3~ppa1) ...
  ...
  ¢ df
  Filesystem 1K-blocks Used Available Use% Mounted on
  tmpfs 100480 948 99532 1% /run
  /dev/sda1 4901996 1423260 3462352 30% /
  tmpfs 502388 0 502388 0% /dev/shm
  tmpfs 5120 0 5120 0% /run/lock
  tmpfs 502388 0 502388 0% /sys/fs/cgroup
  /dev/sda15 106858 3934 102924 4% /boot/efi
  tmpfs 100476 0 100476 0% /run/user/1000

To post a comment you must log in.
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks for the patch, Bryce!

After following the discussions on ubuntu-devel and the developments of the upstream bug, I decided I'd review it.

I ran some tests on a lxd VM (I had install snapd, and then "snap install" something inside the VM so that I could see the /snap/* mountpoints), and everything works as expected :-).

The patch itself is pretty simple; I just had two nits that I thought I'd point out. Otherwise, it looks OK to me! I'm marking the MP as "Approved" because I don't think it's worth doing another round just for the sake of these two nits.

Thanks again.

review: Approve
Revision history for this message
Bryce Harrington (bryce) wrote :

Thanks for the review, I've made the two changes you suggested and uploaded the package.

$ dput ubuntu coreutils_8.30-3ubuntu3_source.changes
Checking signature on .changes
gpg: /home/bryce/ubuntu/Coreutils/project-c2439-ignore-snaps-focal/coreutils_8.30-3ubuntu3_source.changes: Valid signature from E603B2578FB8F0FB
Checking signature on .dsc
gpg: /home/bryce/ubuntu/Coreutils/project-c2439-ignore-snaps-focal/coreutils_8.30-3ubuntu3.dsc: Valid signature from E603B2578FB8F0FB
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading coreutils_8.30-3ubuntu3.dsc: done.
  Uploading coreutils_8.30-3ubuntu3.debian.tar.xz: done.
  Uploading coreutils_8.30-3ubuntu3_source.buildinfo: done.
  Uploading coreutils_8.30-3ubuntu3_source.changes: done.
Successfully uploaded packages.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index 2677be3..6d11644 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,15 @@
1coreutils (8.30-3ubuntu3) groovy; urgency=medium
2
3 * d/p/treat-devtmpfs-and-squashfs-as-dummy-filesystems.patch:
4 - Avoid displaying snaps in output from df and other tools, by
5 excluding display of squashfs filesystems.
6 (LP: #1219529, #1756595)
7 - Exclude devtmpfs filesystems in output from df and other tools
8 since it is a dummy filesystem.
9 (LP: #1219529)
10
11 -- Bryce Harrington <bryce@canonical.com> Thu, 02 Jul 2020 02:30:48 +0000
12
1coreutils (8.30-3ubuntu2) eoan; urgency=medium13coreutils (8.30-3ubuntu2) eoan; urgency=medium
214
3 * No-change upload with strops.h and sys/strops.h removed in glibc.15 * No-change upload with strops.h and sys/strops.h removed in glibc.
diff --git a/debian/patches/series b/debian/patches/series
index 88fd405..c549508 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -7,3 +7,4 @@ renameatu.patch
785_timer_settime.patch785_timer_settime.patch
899_kfbsd_fstat_patch.patch899_kfbsd_fstat_patch.patch
999_float_endian_detection.patch999_float_endian_detection.patch
10treat-devtmpfs-and-squashfs-as-dummy-filesystems.patch
diff --git a/debian/patches/treat-devtmpfs-and-squashfs-as-dummy-filesystems.patch b/debian/patches/treat-devtmpfs-and-squashfs-as-dummy-filesystems.patch
10new file mode 10064411new file mode 100644
index 0000000..f17c5eb
--- /dev/null
+++ b/debian/patches/treat-devtmpfs-and-squashfs-as-dummy-filesystems.patch
@@ -0,0 +1,27 @@
1From ee5ce3f0637d5533e6e1f68e6a7e7f846ff742c4 Mon Sep 17 00:00:00 2001
2From: Bryce Harrington <bryce@canonical.com>
3Date: Thu, 2 Jul 2020 01:50:48 +0000
4Subject: [PATCH] Treat devtmpfs and squashfs as dummy filesystems
5
6Fixes: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=37702
7Signed-off-by: Bryce Harrington <bryce@canonical.com>
8---
9 lib/mountlist.c | 2 ++
10 1 file changed, 2 insertions(+)
11
12diff --git a/lib/mountlist.c b/lib/mountlist.c
13index b691f380..496672e5 100644
14--- a/lib/mountlist.c
15+++ b/lib/mountlist.c
16@@ -167,6 +167,8 @@
17
18 #define ME_DUMMY_0(Fs_name, Fs_type) \
19 (strcmp (Fs_type, "autofs") == 0 \
20+ || strcmp (Fs_type, "devtmpfs") == 0 \
21+ || strcmp (Fs_type, "squashfs") == 0 \
22 || strcmp (Fs_type, "proc") == 0 \
23 || strcmp (Fs_type, "subfs") == 0 \
24 /* for Linux 2.6/3.x */ \
25--
262.25.1
27

Subscribers

People subscribed via source and target branches