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
1diff --git a/debian/changelog b/debian/changelog
2index 2677be3..6d11644 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,15 @@
6+coreutils (8.30-3ubuntu3) groovy; urgency=medium
7+
8+ * d/p/treat-devtmpfs-and-squashfs-as-dummy-filesystems.patch:
9+ - Avoid displaying snaps in output from df and other tools, by
10+ excluding display of squashfs filesystems.
11+ (LP: #1219529, #1756595)
12+ - Exclude devtmpfs filesystems in output from df and other tools
13+ since it is a dummy filesystem.
14+ (LP: #1219529)
15+
16+ -- Bryce Harrington <bryce@canonical.com> Thu, 02 Jul 2020 02:30:48 +0000
17+
18 coreutils (8.30-3ubuntu2) eoan; urgency=medium
19
20 * No-change upload with strops.h and sys/strops.h removed in glibc.
21diff --git a/debian/patches/series b/debian/patches/series
22index 88fd405..c549508 100644
23--- a/debian/patches/series
24+++ b/debian/patches/series
25@@ -7,3 +7,4 @@ renameatu.patch
26 85_timer_settime.patch
27 99_kfbsd_fstat_patch.patch
28 99_float_endian_detection.patch
29+treat-devtmpfs-and-squashfs-as-dummy-filesystems.patch
30diff --git a/debian/patches/treat-devtmpfs-and-squashfs-as-dummy-filesystems.patch b/debian/patches/treat-devtmpfs-and-squashfs-as-dummy-filesystems.patch
31new file mode 100644
32index 0000000..f17c5eb
33--- /dev/null
34+++ b/debian/patches/treat-devtmpfs-and-squashfs-as-dummy-filesystems.patch
35@@ -0,0 +1,27 @@
36+From ee5ce3f0637d5533e6e1f68e6a7e7f846ff742c4 Mon Sep 17 00:00:00 2001
37+From: Bryce Harrington <bryce@canonical.com>
38+Date: Thu, 2 Jul 2020 01:50:48 +0000
39+Subject: [PATCH] Treat devtmpfs and squashfs as dummy filesystems
40+
41+Fixes: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=37702
42+Signed-off-by: Bryce Harrington <bryce@canonical.com>
43+---
44+ lib/mountlist.c | 2 ++
45+ 1 file changed, 2 insertions(+)
46+
47+diff --git a/lib/mountlist.c b/lib/mountlist.c
48+index b691f380..496672e5 100644
49+--- a/lib/mountlist.c
50++++ b/lib/mountlist.c
51+@@ -167,6 +167,8 @@
52+
53+ #define ME_DUMMY_0(Fs_name, Fs_type) \
54+ (strcmp (Fs_type, "autofs") == 0 \
55++ || strcmp (Fs_type, "devtmpfs") == 0 \
56++ || strcmp (Fs_type, "squashfs") == 0 \
57+ || strcmp (Fs_type, "proc") == 0 \
58+ || strcmp (Fs_type, "subfs") == 0 \
59+ /* for Linux 2.6/3.x */ \
60+--
61+2.25.1
62+

Subscribers

People subscribed via source and target branches