[Rpm-maint] [rpm-software-management/rpm] rpm install failed:error: unpacking of archive failed on file /usr/sbin/aaa;636c6826: cpio: open failed - No such file or directory (Issue #2273)

xujing notifications at github.com
Thu Dec 15 02:16:01 UTC 2022


When I tried to fix it with the following patch, the `openat(dirfd, dest, O_WRONLY|O_CREAT, 0200)` still failed with a message "No such file or directory". In this case, the open does not seem to cover this scenario.
```
diff --git a/lib/fsm.c b/lib/fsm.c
index c9ab3e1..4ceca3d 100644
--- a/lib/fsm.c
+++ b/lib/fsm.c
@@ -282,6 +282,12 @@ static int fsmOpen(int *wfdp, int dirfd, const char *dest)
     /* Create the file with 0200 permissions (write by owner). */
     int fd = openat(dirfd, dest, O_WRONLY|O_EXCL|O_CREAT, 0200);
 
+    if (fd < 0 && errno == EEXIST) {
+	rpmlog(RPMLOG_WARNING, "xujing: %8s (%s [%d]) %s\n", __func__,
+	       dest, fd, (rc < 0 ? strerror(errno) : ""));
+	fd = openat(dirfd, dest, O_WRONLY|O_CREAT, 0200);
+    }
+
     if (fd < 0)
 	rc = RPMERR_OPEN_FAILED;
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/2273#issuecomment-1352469285
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/issues/2273/1352469285 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20221214/3e053113/attachment.html>


More information about the Rpm-maint mailing list