backport some fixes

OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=421
This commit is contained in:
Michael Schröder 2017-12-05 12:33:01 +00:00 committed by Git OBS Bridge
parent 9c5d0ddfdb
commit b9d34b5388
6 changed files with 222 additions and 1 deletions

20
editdwarf.diff Normal file
View File

@ -0,0 +1,20 @@
debugedit: edit_dwarf2 check lndx is in range before checking r_offset.
upstream commit 7e9af0c000868ad6272a9577f9daed991599419b
--- ./tools/debugedit.c.orig 2017-12-05 11:59:10.287010024 +0000
+++ ./tools/debugedit.c 2017-12-05 12:00:02.776862694 +0000
@@ -2171,10 +2171,10 @@ edit_dwarf2 (DSO *dso)
r_offset = rel.r_offset;
}
- while (r_offset > (dso->lines.table[lndx].old_idx
- + 4
- + dso->lines.table[lndx].unit_length)
- && lndx < dso->lines.used)
+ while (lndx < dso->lines.used
+ && r_offset > (dso->lines.table[lndx].old_idx
+ + 4
+ + dso->lines.table[lndx].unit_length))
lndx++;
if (lndx >= dso->lines.used)

156
hardlink.diff Normal file
View File

@ -0,0 +1,156 @@
Create first hard link file and keep open, write it at end
upstream commit e276991614fd127f21aba94946f81f22cb7e6b73
upstream commit 0afe0c3c6cba64d8b7adcdec6ed70f8d32961b58
upstream commit ef3ff412c33a71be6b3543a50c244377dff3d9e7
--- ./lib/fsm.c.orig 2017-10-05 10:04:56.977602149 +0000
+++ ./lib/fsm.c 2017-12-05 12:05:19.529973029 +0000
@@ -218,56 +218,76 @@ static int linkSane(FD_t wfd, const char
sb.st_dev == lsb.st_dev && sb.st_ino == lsb.st_ino);
}
-/** \ingroup payload
- * Create file from payload stream.
- * @return 0 on success
- */
-static int expandRegular(rpmfi fi, const char *dest, rpmpsm psm, int exclusive, int nodigest, int nocontent)
+static void wfd_close(FD_t *wfdp)
{
- FD_t wfd = NULL;
- int rc = 0;
+ if (wfdp && *wfdp) {
+ int myerrno = errno;
+ static int oneshot = 0;
+ static int flush_io = 0;
+ if (!oneshot) {
+ flush_io = rpmExpandNumeric("%{?_flush_io}");
+ oneshot = 1;
+ }
+ if (flush_io) {
+ int fdno = Fileno(*wfdp);
+ fsync(fdno);
+ }
+ Fclose(*wfdp);
+ *wfdp = NULL;
+ errno = myerrno;
+ }
+}
+static int wfd_open(FD_t *wfdp, const char *dest, int exclusive)
+{
+ int rc = 0;
/* Create the file with 0200 permissions (write by owner). */
{
mode_t old_umask = umask(0577);
- wfd = Fopen(dest, exclusive ? "wx.ufdio" : "a.ufdio");
+ *wfdp = Fopen(dest, exclusive ? "wx.ufdio" : "a.ufdio");
umask(old_umask);
/* If reopening, make sure the file is what we expect */
- if (!exclusive && wfd != NULL && !linkSane(wfd, dest)) {
+ if (!exclusive && *wfdp != NULL && !linkSane(*wfdp, dest)) {
rc = RPMERR_OPEN_FAILED;
goto exit;
}
}
- if (Ferror(wfd)) {
+ if (Ferror(*wfdp)) {
rc = RPMERR_OPEN_FAILED;
goto exit;
}
+ return 0;
+
+exit:
+ wfd_close(wfdp);
+ return rc;
+}
+
+/** \ingroup payload
+ * Create file from payload stream.
+ * @return 0 on success
+ */
+static int expandRegular(rpmfi fi, const char *dest, rpmpsm psm, int exclusive, int nodigest, int nocontent)
+{
+ FD_t wfd = NULL;
+ int rc;
+
+ rc = wfd_open(&wfd, dest, exclusive);
+ if (rc != 0)
+ goto exit;
+
if (!nocontent)
rc = rpmfiArchiveReadToFilePsm(fi, wfd, nodigest, psm);
+ wfd_close(&wfd);
exit:
- if (wfd) {
- int myerrno = errno;
- static int oneshot = 0;
- static int flush_io = 0;
- if (!oneshot) {
- flush_io = rpmExpandNumeric("%{?_flush_io}");
- oneshot = 1;
- }
- if (flush_io) {
- int fdno = Fileno(wfd);
- fsync(fdno);
- }
- Fclose(wfd);
- errno = myerrno;
- }
return rc;
}
static int fsmMkfile(rpmfi fi, const char *dest, rpmfiles files,
rpmpsm psm, int nodigest, int *setmeta,
- int * firsthardlink)
+ int * firsthardlink, FD_t *firstlinkfile)
{
int rc = 0;
int numHardlinks = rpmfiFNlink(fi);
@@ -276,7 +296,7 @@ static int fsmMkfile(rpmfi fi, const cha
/* Create first hardlinked file empty */
if (*firsthardlink < 0) {
*firsthardlink = rpmfiFX(fi);
- rc = expandRegular(fi, dest, psm, 1, nodigest, 1);
+ rc = wfd_open(firstlinkfile, dest, 1);
} else {
/* Create hard links for others */
char *fn = rpmfilesFN(files, *firsthardlink);
@@ -294,7 +314,8 @@ static int fsmMkfile(rpmfi fi, const cha
rc = expandRegular(fi, dest, psm, 1, nodigest, 0);
} else if (rpmfiArchiveHasContent(fi)) {
if (!rc)
- rc = expandRegular(fi, dest, psm, 0, nodigest, 0);
+ rc = rpmfiArchiveReadToFilePsm(fi, *firstlinkfile, nodigest, psm);
+ wfd_close(firstlinkfile);
*firsthardlink = -1;
} else {
*setmeta = 0;
@@ -861,6 +882,7 @@ int rpmPackageFilesInstall(rpmts ts, rpm
int nodigest = (rpmtsFlags(ts) & RPMTRANS_FLAG_NOFILEDIGEST) ? 1 : 0;
int nofcaps = (rpmtsFlags(ts) & RPMTRANS_FLAG_NOCAPS) ? 1 : 0;
int firsthardlink = -1;
+ FD_t firstlinkfile = NULL;
int skip;
rpmFileAction action;
char *tid = NULL;
@@ -932,7 +954,7 @@ int rpmPackageFilesInstall(rpmts ts, rpm
if (S_ISREG(sb.st_mode)) {
if (rc == RPMERR_ENOENT) {
rc = fsmMkfile(fi, fpath, files, psm, nodigest,
- &setmeta, &firsthardlink);
+ &setmeta, &firsthardlink, &firstlinkfile);
}
} else if (S_ISDIR(sb.st_mode)) {
if (rc == RPMERR_ENOENT) {
@@ -970,7 +992,8 @@ int rpmPackageFilesInstall(rpmts ts, rpm
/* we skip the hard linked file containing the content */
/* write the content to the first used instead */
char *fn = rpmfilesFN(files, firsthardlink);
- rc = expandRegular(fi, fn, psm, 0, nodigest, 0);
+ rc = rpmfiArchiveReadToFilePsm(fi, firstlinkfile, nodigest, psm);
+ wfd_close(&firstlinkfile);
firsthardlink = -1;
free(fn);
}

15
rofs.diff Normal file
View File

@ -0,0 +1,15 @@
Don't bother retrying locking on read-only filesystem (RhBug:1502134)
upstream commit f25752a8cd6b161f3002dc7839242872ecb59547
--- ./lib/rpmlock.c.orig 2017-08-10 08:08:07.122108699 +0000
+++ ./lib/rpmlock.c 2017-12-05 12:02:26.248459858 +0000
@@ -30,7 +30,8 @@ static rpmlock rpmlock_new(const char *l
(void) umask(oldmask);
if (lock->fd == -1) {
- lock->fd = open(lock_path, O_RDONLY);
+ if (errno != EROFS)
+ lock->fd = open(lock_path, O_RDONLY);
if (lock->fd == -1) {
free(lock);
lock = NULL;

View File

@ -21,6 +21,11 @@ Fri Dec 1 17:15:13 CET 2017 - mls@suse.de
* perlprov.diff
* python3-abi-kind.diff
* rpmrctests.diff
- new patches (backports from master):
* editdwarf.diff
* rofs.diff
* transfiletriggerpostun.diff
* hardlink.diff
-------------------------------------------------------------------
Thu Nov 23 13:41:13 UTC 2017 - rbrown@suse.com

View File

@ -127,6 +127,10 @@ Patch99: enable-postin-scripts-error.diff
Patch100: rpm-findlang-inject-metainfo.patch
Patch102: emptymanifest.diff
Patch103: find-lang-qt-qm.patch
Patch104: editdwarf.diff
Patch105: rofs.diff
Patch106: transfiletriggerpostun.diff
Patch107: hardlink.diff
Patch6464: auto-config-update-aarch64-ppc64le.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#
@ -222,7 +226,7 @@ rm -f rpmdb/db.h
%patch -P 70 -P 71 -P 73 -P 74 -P 75 -P 77 -P 78
%patch -P 85
%patch -P 93 -P 94 -P 99
%patch -P 100 -P 102 -P 103
%patch -P 100 -P 102 -P 103 -P 104 -P 105 -P 106 -P 107
%ifarch aarch64 ppc64le
%patch6464

View File

@ -0,0 +1,21 @@
Fix not all %transfiletriggerpostun triggers executing (RhBug:1514085)
upstream commit db1b99db2543b2c2526a2e116daeffa0498d5de4
--- ./lib/rpmtriggers.c.orig 2017-10-05 10:04:57.121602122 +0000
+++ ./lib/rpmtriggers.c 2017-12-05 12:04:35.448096904 +0000
@@ -106,7 +106,6 @@ void rpmtriggersPrepPostUnTransFileTrigs
rpmfiles files;
rpmds rpmdsTriggers;
rpmds rpmdsTrigger;
- int tix = 0;
ii = rpmdbIndexIteratorInit(rpmtsGetRdb(ts), RPMDBI_TRANSFILETRIGGERNAME);
mi = rpmdbNewIterator(rpmtsGetRdb(ts), RPMDBI_PACKAGES);
@@ -131,6 +130,7 @@ void rpmtriggersPrepPostUnTransFileTrigs
if (rpmdbGetIteratorCount(mi)) {
/* Filter triggers and save only trans postun triggers into ts */
while ((trigH = rpmdbNextIterator(mi)) != NULL) {
+ int tix = 0;
rpmdsTriggers = rpmdsNew(trigH, RPMTAG_TRANSFILETRIGGERNAME, 0);
while ((rpmdsTrigger = rpmdsFilterTi(rpmdsTriggers, tix))) {
if ((rpmdsNext(rpmdsTrigger) >= 0) &&