Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 700097 Details for
Bug 895101
busybox's rpm-install overwrites files non-atomically
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Proposed patch
busybox-1.19.4-rpm.patch (text/plain), 2.39 KB, created by
Denys Vlasenko
on 2013-02-20 15:25:59 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Denys Vlasenko
Created:
2013-02-20 15:25:59 UTC
Size:
2.39 KB
patch
obsolete
>diff -urpN busybox-1.19.4.orig/archival/libarchive/data_extract_all.c busybox-1.19.4/archival/libarchive/data_extract_all.c >--- busybox-1.19.4.orig/archival/libarchive/data_extract_all.c 2012-02-04 20:34:24.000000000 +0100 >+++ busybox-1.19.4/archival/libarchive/data_extract_all.c 2013-02-20 16:15:48.085591753 +0100 >@@ -106,15 +106,28 @@ void FAST_FUNC data_extract_all(archive_ > switch (file_header->mode & S_IFMT) { > case S_IFREG: { > /* Regular file */ >+ char *dst_name; > int flags = O_WRONLY | O_CREAT | O_EXCL; > if (archive_handle->ah_flags & ARCHIVE_O_TRUNC) > flags = O_WRONLY | O_CREAT | O_TRUNC; >- dst_fd = xopen3(file_header->name, >+ dst_name = file_header->name; >+#ifdef ARCHIVE_REPLACE_VIA_RENAME >+ if (archive_handle->ah_flags & ARCHIVE_REPLACE_VIA_RENAME) >+ /* rpm-style temp file name */ >+ dst_name = xasprintf("%s;%x", dst_name, (int)getpid()); >+#endif >+ dst_fd = xopen3(dst_name, > flags, > file_header->mode > ); > bb_copyfd_exact_size(archive_handle->src_fd, dst_fd, file_header->size); > close(dst_fd); >+#ifdef ARCHIVE_REPLACE_VIA_RENAME >+ if (archive_handle->ah_flags & ARCHIVE_REPLACE_VIA_RENAME) { >+ xrename(dst_name, file_header->name); >+ free(dst_name); >+ } >+#endif > break; > } > case S_IFDIR: >diff -urpN busybox-1.19.4.orig/archival/rpm.c busybox-1.19.4/archival/rpm.c >--- busybox-1.19.4.orig/archival/rpm.c 2012-02-04 20:34:24.000000000 +0100 >+++ busybox-1.19.4/archival/rpm.c 2013-02-20 16:15:48.086591754 +0100 >@@ -231,8 +231,8 @@ static void extract_cpio(int fd, const c > /* compat: overwrite existing files. > * try "rpm -i foo.src.rpm" few times in a row - > * standard rpm will not complain. >- * (TODO? real rpm creates "file;1234" and then renames it) */ >- | ARCHIVE_UNLINK_OLD; >+ */ >+ | ARCHIVE_REPLACE_VIA_RENAME; > archive_handle->src_fd = fd; > /*archive_handle->offset = 0; - init_handle() did it */ > >diff -urpN busybox-1.19.4.orig/include/archive.h busybox-1.19.4/include/archive.h >--- busybox-1.19.4.orig/include/archive.h 2012-02-04 20:34:24.000000000 +0100 >+++ busybox-1.19.4/include/archive.h 2013-02-20 16:16:45.714609259 +0100 >@@ -119,6 +119,9 @@ typedef struct archive_handle_t { > #define ARCHIVE_DONT_RESTORE_PERM (1 << 6) > #define ARCHIVE_NUMERIC_OWNER (1 << 7) > #define ARCHIVE_O_TRUNC (1 << 8) >+#if ENABLE_RPM >+#define ARCHIVE_REPLACE_VIA_RENAME (1 << 10) >+#endif > > > /* POSIX tar Header Block, from POSIX 1003.1-1990 */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 895101
: 700097