1
0
Fork 0

Adding patch from Raphaël Hertzog <hertzog@debian.org> to fallback on /bin/mv when rename syscall fails with EXDEV (Closes: #836211).

Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
This commit is contained in:
Daniel Baumann 2025-06-20 21:27:43 +02:00
parent e29f3866b9
commit 7abc9dd733
Signed by: daniel.baumann
GPG key ID: BCC918A2ABD66424
2 changed files with 36 additions and 0 deletions

View file

@ -0,0 +1,35 @@
Author: Raphaël Hertzog <hertzog@debian.org>
Description: Fallback on /bin/mv when rename syscall fails with EXDEV (Closes: #836211).
Work-around EXDEV error returned by overlayfs when trying to move away a
directory by calling "mv" which will do a full copy of the tree followed
by a removal of the source tree.
diff -Naurp dpkg.orig/src/main/archives.c dpkg/src/main/archives.c
--- dpkg.orig/src/main/archives.c
+++ dpkg/src/main/archives.c
@@ -1035,6 +1035,25 @@ tarobject(struct tar_archive *tar, struc
if (rename(fnamevb.buf,fnametmpvb.buf))
ohshite(_("unable to move aside '%.255s' to install new version"),
ti->name);
+ if (rename(fnamevb.buf,fnametmpvb.buf)) {
+ if (errno == EXDEV) {
+ struct command cmd;
+ pid_t pid;
+
+ command_init(&cmd, "mv", "move directory aside");
+ command_add_args(&cmd, "mv", fnamevb.buf, fnametmpvb.buf, NULL);
+ pid = subproc_fork();
+
+ if (pid == 0)
+ command_exec(&cmd);
+
+ subproc_reap(pid, "mv", 0);
+ command_destroy(&cmd);
+ } else {
+ ohshite(_("unable to move aside '%.255s' to install new version"),
+ ti->name);
+ }
+ }
} else if (S_ISLNK(stab.st_mode)) {
ssize_t linksize;
int rc;

1
debian/patches/series vendored Normal file
View file

@ -0,0 +1 @@
progress-linux/0001-overlayfs.patch