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

guillem pushed a commit to branch main
in repository dpkg.

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

commit 8836d34908602aef8e468c596fd81f838feff794
Author: Guillem Jover <[email protected]>
AuthorDate: Sat Mar 19 19:47:37 2022 +0100

    dpkg-deb: Fix movecontrol() to take a directory argument
    
    Since the chdir(2) got moved into the child, the global cwd is not the
    target directory, so we were trying to move files from the wrong
    directory.
    
    Fixes: commit 87809163331a320f9562d75591fcc6c954b9f80c
---
 src/deb/extract.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/deb/extract.c b/src/deb/extract.c
index a23cd4cb2..89819eaf3 100644
--- a/src/deb/extract.c
+++ b/src/deb/extract.c
@@ -50,11 +50,13 @@
 
 #include "dpkg-deb.h"
 
-static void movecontrolfiles(const char *thing) {
+static void
+movecontrolfiles(const char *dir, const char *thing)
+{
   char buf[200];
   pid_t pid;
 
-  sprintf(buf, "mv %s/* . && rmdir %s", thing, thing);
+  sprintf(buf, "mv %s/%s/* %s/ && rmdir %s/%s", dir, thing, dir, dir, thing);
   pid = subproc_fork();
   if (pid == 0) {
     command_shell(buf, _("shell command to move files"));
@@ -368,9 +370,9 @@ extracthalf(const char *debar, const char *dir,
       version.minor /= 10;
 
     if (version.minor ==  931)
-      movecontrolfiles(OLDOLDDEBDIR);
+      movecontrolfiles(dir, OLDOLDDEBDIR);
     else if (version.minor == 932 || version.minor == 933)
-      movecontrolfiles(OLDDEBDIR);
+      movecontrolfiles(dir, OLDDEBDIR);
   }
 }
 

-- 
Dpkg.Org's dpkg

Reply via email to