Public bug reported:

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.

** Affects: dpkg (Ubuntu)
     Importance: Undecided
         Status: New

** Description changed:

  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 trival and looks safe to backport.
+ 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;
-       }
+    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);
- 
+   if (errno != ENOTEMPTY && errno != EEXIST) /* Huh? */
+    ohshite(_("unable to securely remove '%.255s'"), pathname);
  
  Thanks.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1865049

Title:
  Support running with read-only root on Xenial

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dpkg/+bug/1865049/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to