This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=ee8be1388758cb0e71cfbf7cb61d543040442f86

commit ee8be1388758cb0e71cfbf7cb61d543040442f86
Author: Guillem Jover <[email protected]>
AuthorDate: Fri Nov 29 02:22:37 2019 +0100

    libdpkg: Create the updates/ database directory on demand
---
 debian/changelog    |  1 +
 lib/dpkg/dbmodify.c | 10 +++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 11e8df6d7..589d4df3e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -53,6 +53,7 @@ dpkg (1.20.0) UNRELEASED; urgency=medium
       we are running as root:root which means the ownership should be correct
       already, or we are not which means we cannot change it anyway.
     - Create the dpkg database directory on demand.
+    - Create the updates/ database directory on demand.
   * Perl modules:
     - Dpkg::Source::Package: Verify original tarball signatures at build time.
     - Dpkg::BuildFlags: Add new unset() method.
diff --git a/lib/dpkg/dbmodify.c b/lib/dpkg/dbmodify.c
index 40340865d..a6f8a0bcc 100644
--- a/lib/dpkg/dbmodify.c
+++ b/lib/dpkg/dbmodify.c
@@ -85,8 +85,16 @@ static void cleanupdates(void) {
   *updatefnrest = '\0';
   updateslength= -1;
   cdn= scandir(updatefnbuf, &cdlist, &ulist_select, alphasort);
-  if (cdn == -1)
+  if (cdn == -1) {
+    if (errno == ENOENT) {
+      if (cstatus >= msdbrw_write &&
+          dir_make_path(updatefnbuf, 0755) < 0)
+        ohshite(_("cannot create the dpkg updates directory %s"),
+                updatefnbuf);
+      return;
+    }
     ohshite(_("cannot scan updates directory '%.255s'"), updatefnbuf);
+  }
 
   if (cdn) {
     for (i=0; i<cdn; i++) {

-- 
Dpkg.Org's dpkg

Reply via email to