[Bug 1865049] [NEW] Support running with read-only root on Xenial
Shengjing Zhu
1865049 at bugs.launchpad.net
Thu Feb 27 15:42:42 UTC 2020
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
Foundations Bugs, which is subscribed to dpkg in Ubuntu.
https://bugs.launchpad.net/bugs/1865049
Title:
Support running with read-only root on Xenial
Status in dpkg package in Ubuntu:
New
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.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dpkg/+bug/1865049/+subscriptions
More information about the foundations-bugs
mailing list