Support running with read-only root on Xenial

Bug #1865049 reported by Shengjing Zhu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
dpkg (Ubuntu)
New
Undecided
Unassigned

Bug Description

Hi,

dpkg 1.8.11 has fixed this issue when running with read-only root. The Debian bug is https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=838877

Could you backport the fix to Xenial?

The patch is trivial and looks safe to backport.

https://salsa.debian.org/dpkg-team/dpkg/commit/4daaec6

diff --git a/lib/dpkg/path-remove.c b/lib/dpkg/path-remove.c
index 3086408e8..ab26b4a8d 100644
--- a/lib/dpkg/path-remove.c
+++ b/lib/dpkg/path-remove.c
@@ -137,6 +137,13 @@ path_remove_tree(const char *pathname)
   if (errno == ENOTDIR)
    return;
  }
+ /* Trying to remove a directory or a file on a read-only filesystem,
+ * even if non-existent, always returns EROFS. */
+ if (errno == EROFS) {
+ if (access(pathname, F_OK) < 0 && errno == ENOENT)
+ return;
+ errno = EROFS;
+ }
  if (errno != ENOTEMPTY && errno != EEXIST) /* Huh? */
   ohshite(_("unable to securely remove '%.255s'"), pathname);

Thanks.

Shengjing Zhu (zhsj)
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.