- update to 4.11.1-rc1

- drop upstreamed/unused patches
This commit is contained in:
Panu Matilainen 2013-06-10 12:07:08 +03:00
parent e033e9868a
commit 68ff3e10f7
10 changed files with 10 additions and 540 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@
/rpm-4.10.90.git11989.tar.bz2
/rpm-4.11.0-beta1.tar.bz2
/rpm-4.11.0.1.tar.bz2
/rpm-4.11.1-rc1.tar.bz2

View File

@ -1,117 +0,0 @@
From 96807d2f3dcec583ca54b503e7fc70014115e308 Mon Sep 17 00:00:00 2001
From: Johannes Dewender <rpm@JonnyJD.net>
Date: Thu, 4 Apr 2013 17:23:43 +0200
Subject: [PATCH] Finish lua 5.2 support, trac #865
Lua52 support was started with ac959fed0082cb253d45c7a04866e8654e962442.
Compilation tested with Lua 5.2.1 and Lua 5.1.5.
The short typerror() snippet is taken from luaL_typerror in Lua 5.1.5
(MIT license)
Signed-off-by: Johannes Dewender <rpm@JonnyJD.net>
---
luaext/lposix.c | 21 +++++++++++++++------
rpmio/rpmlua.c | 8 ++++++++
2 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/luaext/lposix.c b/luaext/lposix.c
index f3c787e..a59be3e 100644
--- a/luaext/lposix.c
+++ b/luaext/lposix.c
@@ -58,6 +58,15 @@ static const char *filetype(mode_t m)
typedef int (*Selector)(lua_State *L, int i, const void *data);
+/* implemented as luaL_typerror until lua 5.1, dropped in 5.2
+ * (C) 1994-2012 Lua.org, PUC-Rio. MIT license
+ */
+static int typerror (lua_State *L, int narg, const char *tname) {
+ const char *msg = lua_pushfstring(L, "%s expected, got %s",
+ tname, luaL_typename(L, narg));
+ return luaL_argerror(L, narg, msg);
+}
+
static int doselection(lua_State *L, int i, const char *const S[], Selector F, const void *data)
{
if (lua_isnone(L, i))
@@ -139,7 +148,7 @@ static uid_t mygetuid(lua_State *L, int i)
return (p==NULL) ? -1 : p->pw_uid;
}
else
- return luaL_typerror(L, i, "string or number");
+ return typerror(L, i, "string or number");
}
static gid_t mygetgid(lua_State *L, int i)
@@ -154,7 +163,7 @@ static gid_t mygetgid(lua_State *L, int i)
return (g==NULL) ? -1 : g->gr_gid;
}
else
- return luaL_typerror(L, i, "string or number");
+ return typerror(L, i, "string or number");
}
@@ -573,7 +582,7 @@ static int Pgetpasswd(lua_State *L) /** getpasswd(name or id) */
else if (lua_isstring(L, 1))
p = getpwnam(lua_tostring(L, 1));
else
- luaL_typerror(L, 1, "string or number");
+ typerror(L, 1, "string or number");
if (p==NULL)
lua_pushnil(L);
else
@@ -590,7 +599,7 @@ static int Pgetgroup(lua_State *L) /** getgroup(name or id) */
else if (lua_isstring(L, 1))
g = getgrnam(lua_tostring(L, 1));
else
- luaL_typerror(L, 1, "string or number");
+ typerror(L, 1, "string or number");
if (g==NULL)
lua_pushnil(L);
else
@@ -709,10 +718,10 @@ static int Puname(lua_State *L) /** uname([string]) */
luaL_buffinit(L, &b);
for (s=luaL_optstring(L, 1, "%s %n %r %v %m"); *s; s++)
if (*s!='%')
- luaL_putchar(&b, *s);
+ luaL_addchar(&b, *s);
else switch (*++s)
{
- case '%': luaL_putchar(&b, *s); break;
+ case '%': luaL_addchar(&b, *s); break;
case 'm': luaL_addstring(&b,u.machine); break;
case 'n': luaL_addstring(&b,u.nodename); break;
case 'r': luaL_addstring(&b,u.release); break;
diff --git a/rpmio/rpmlua.c b/rpmio/rpmlua.c
index 86d0408..0576318 100644
--- a/rpmio/rpmlua.c
+++ b/rpmio/rpmlua.c
@@ -7,14 +7,22 @@
#include <lposix.h>
#include <lrexlib.h>
+/* replaced in 5.1 */
#ifndef lua_open
#define lua_open() luaL_newstate()
#endif
+/* defined as lua_objlen in 5.1 */
#ifndef lua_strlen
#define lua_strlen(L,i) lua_rawlen(L, (i))
#endif
+/* deprecated in 5.1, defined as lua_objlen in 5.1 */
+#ifndef luaL_getn
+#define luaL_getn(L,i) ((int)lua_rawlen(L, i))
+#endif
+
+/* define added in 5.2 */
#ifndef lua_pushglobaltable
#define lua_pushglobaltable(L) lua_pushvalue(L, LUA_GLOBALSINDEX)
#endif
--
1.8.1.3

View File

@ -1,50 +0,0 @@
commit a712252392eca75443ca45c10a72873cabec7963
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Mon Jan 28 12:50:39 2013 +0200
Be more careful about skipping shared file/directory creation
- Only skip shared file/dir creation if its actually being created
by another package. Previously we could've decided to skip an entry
where the other file was also being skipped for some other reason.
- Ensure %ghost entries always have FA_SKIP on install, previously
they often were FA_CREATE which makes no sense for %ghost. We dont
encounter %ghosts at all during install in the FSM as they dont
exist in the payload, but the file disposition calculations need
to take them into account now that we're avoiding redundant creates.
- Fixes a regression from commit f7f5f88f9f3d6587e747b034ccb64a3f00ff4e1e
which unearthed the %ghost FA_CREATE issue, reported here:
http://lists.fedoraproject.org/pipermail/buildsys/2013-January/004047.html
diff --git a/lib/transaction.c b/lib/transaction.c
index 6e9e025..397f23d 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -572,7 +572,8 @@ assert(otherFi != NULL);
}
} else {
/* Skip create on all but the first instance of a shared file */
- if (rpmfsGetAction(otherFs, otherFileNum) != FA_UNKNOWN)
+ rpmFileAction oaction = rpmfsGetAction(otherFs, otherFileNum);
+ if (oaction != FA_UNKNOWN && !XFA_SKIPPING(oaction))
rpmfsSetAction(fs, i, FA_SKIP);
}
@@ -760,6 +761,17 @@ static void skipInstallFiles(const rpmts ts, rpmte p)
ix = rpmfiDX(fi);
drc[ix]++;
+ /*
+ * Always skip %ghosts on install.
+ * XXX: Should we skip directory creation if there are only
+ * %ghosts in it? Traditionally we create the (empty) directory, so
+ * preserving that behavior for now at least: leave the refcount alone.
+ */
+ if (rpmfiFFlags(fi) & RPMFILE_GHOST) {
+ rpmfsSetAction(fs, i, FA_SKIP);
+ continue;
+ }
+
/* Don't bother with skipped files */
if (XFA_SKIPPING(rpmfsGetAction(fs, i))) {
drc[ix]--; dff[ix] = 1;

View File

@ -1,56 +0,0 @@
commit 452553111b9929074bcbb77a49c041582daae0e8
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Tue Feb 5 10:11:19 2013 +0200
Check for stale db locks when opening write-cursors
- During long-running transactions its entirely possible for some
other player to come and go leaving stale locks behind and cause
the transaction to get stuck until the cavalry comes along in the
form of somebody else opening the rpmdb, clearing the blockage.
- Presumably dbenv->failchk() is not entirely free of cost so we only
do this for writes which are way more critical and also more prone to
getting stuck.
- dbenv->failchk() could return DB_RUNRECOVER in which case we should
abort everything but we lack a mechanism to do it... just add
a reminder comment for now.
diff --git a/lib/backend/db3.c b/lib/backend/db3.c
index 656486b..de8071b 100644
--- a/lib/backend/db3.c
+++ b/lib/backend/db3.c
@@ -248,7 +248,7 @@ dbiCursor dbiCursorInit(dbiIndex dbi, unsigned int flags)
DB * db = dbi->dbi_db;
DBC * cursor;
int cflags;
- int rc;
+ int rc = 0;
uint32_t eflags = db_envflags(db);
/* DB_WRITECURSOR requires CDB and writable db */
@@ -259,8 +259,23 @@ dbiCursor dbiCursorInit(dbiIndex dbi, unsigned int flags)
} else
cflags = 0;
- rc = db->cursor(db, NULL, &cursor, cflags);
- rc = cvtdberr(dbi, "db->cursor", rc, _debug);
+ /*
+ * Check for stale locks which could block writes "forever".
+ * XXX: Should we also do this on reads? Reads are less likely
+ * to get blocked so it seems excessive...
+ * XXX: On DB_RUNRECOVER, we should abort everything. Now
+ * we'll just fail to open a cursor again and again and again.
+ */
+ if (cflags & DB_WRITECURSOR) {
+ DB_ENV *dbenv = db->get_env(db);
+ rc = dbenv->failchk(dbenv, 0);
+ rc = cvtdberr(dbi, "dbenv->failchk", rc, _debug);
+ }
+
+ if (rc == 0) {
+ rc = db->cursor(db, NULL, &cursor, cflags);
+ rc = cvtdberr(dbi, "db->cursor", rc, _debug);
+ }
if (rc == 0) {
dbc = xcalloc(1, sizeof(*dbc));

View File

@ -1,138 +0,0 @@
commit e7d5980e2a7b091d973171144de04397204ebcd7
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Tue May 28 08:56:22 2013 +0300
Serialize BDB environment open/close (RhBug:924417 etc)
- Introduce Yet Another Broken Lock[*] to serialize BDB environment open:
otherwise we can end up calling dbenv->failchk() while another process
is just joining the environment, leading to transient "Thread died in..."
DB_RUNRECOVER errors. Also prevents races on chrooted operations where
we remove the entire environment on close.
- This should also make it possible to handle at least some cases of
real DB_RUNRECOVER errors by just nuking the environment but that's
another topic...
[*] YABL as this is nowhere near foolproof or sufficient for all
the possible variants, but better than not having it...
(cherry picked from commit ad874d60e3804f1bcd64f3510e1e2dfbf81456cd)
diff --git a/lib/backend/db3.c b/lib/backend/db3.c
index de8071b..9d385c6 100644
--- a/lib/backend/db3.c
+++ b/lib/backend/db3.c
@@ -57,10 +57,42 @@ static uint32_t db_envflags(DB * db)
return eflags;
}
+/*
+ * Try to acquire db environment open/close serialization lock.
+ * Return the open, locked fd on success, -1 on failure.
+ */
+static int serialize_env(const char *dbhome)
+{
+ char *lock_path = rstrscat(NULL, dbhome, "/.dbenv.lock", NULL);
+ mode_t oldmask = umask(022);
+ int fd = open(lock_path, (O_RDWR|O_CREAT), 0644);
+ umask(oldmask);
+
+ if (fd >= 0) {
+ int rc;
+ struct flock info;
+ memset(&info, 0, sizeof(info));
+ info.l_type = F_WRLCK;
+ info.l_whence = SEEK_SET;
+ do {
+ rc = fcntl(fd, F_SETLKW, &info);
+ } while (rc == -1 && errno == EINTR);
+
+ if (rc == -1) {
+ close(fd);
+ fd = -1;
+ }
+ }
+
+ free(lock_path);
+ return fd;
+}
+
static int db_fini(rpmdb rdb, const char * dbhome)
{
DB_ENV * dbenv = rdb->db_dbenv;
int rc;
+ int lockfd = -1;
uint32_t eflags = 0;
if (dbenv == NULL)
@@ -72,6 +104,9 @@ static int db_fini(rpmdb rdb, const char * dbhome)
}
(void) dbenv->get_open_flags(dbenv, &eflags);
+ if (!(eflags & DB_PRIVATE))
+ lockfd = serialize_env(dbhome);
+
rc = dbenv->close(dbenv, 0);
rc = dbapi_err(rdb, "dbenv->close", rc, _debug);
@@ -89,6 +124,10 @@ static int db_fini(rpmdb rdb, const char * dbhome)
rpmlog(RPMLOG_DEBUG, "removed db environment %s\n", dbhome);
}
+
+ if (lockfd >= 0)
+ close(lockfd);
+
return rc;
}
@@ -122,6 +161,7 @@ static int db_init(rpmdb rdb, const char * dbhome)
DB_ENV *dbenv = NULL;
int rc, xx;
int retry_open = 2;
+ int lockfd = -1;
struct dbConfig_s * cfg = &rdb->cfg;
/* This is our setup, thou shall not have other setups before us */
uint32_t eflags = (DB_CREATE|DB_INIT_MPOOL|DB_INIT_CDB);
@@ -176,6 +216,24 @@ static int db_init(rpmdb rdb, const char * dbhome)
}
/*
+ * Serialize shared environment open (and clock) via fcntl() lock.
+ * Otherwise we can end up calling dbenv->failchk() while another
+ * process is joining the environment, leading to transient
+ * DB_RUNRECOVER errors. Also prevents races wrt removing the
+ * environment (eg chrooted operation). Silently fall back to
+ * private environment on failure to allow non-privileged queries
+ * to "work", broken as it might be.
+ */
+ if (!(eflags & DB_PRIVATE)) {
+ lockfd = serialize_env(dbhome);
+ if (lockfd < 0) {
+ eflags |= DB_PRIVATE;
+ retry_open--;
+ rpmlog(RPMLOG_DEBUG, "serialize failed, using private dbenv\n");
+ }
+ }
+
+ /*
* Actually open the environment. Fall back to private environment
* if we dont have permission to join/create shared environment or
* system doesn't support it..
@@ -208,6 +266,8 @@ static int db_init(rpmdb rdb, const char * dbhome)
rdb->db_dbenv = dbenv;
rdb->db_opens = 1;
+ if (lockfd >= 0)
+ close(lockfd);
return 0;
errxit:
@@ -216,6 +276,8 @@ errxit:
xx = dbenv->close(dbenv, 0);
xx = dbapi_err(rdb, "dbenv->close", xx, _debug);
}
+ if (lockfd >= 0)
+ close(lockfd);
return rc;
}

View File

@ -1,20 +0,0 @@
commit 9b734cee5dc9805a6f8d24c3f30ed82a7aef5673
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Wed May 22 08:38:53 2013 +0300
Only consider files with .pm suffix as perl modules (RhBug:927211)
- Newer file is more eager to flag files as Perl module source,
causing false provides to be generated. Require both magic
and path to match for perllib classification to reduce the pain.
diff --git a/fileattrs/perllib.attr b/fileattrs/perllib.attr
index 4e54225..fcad480 100644
--- a/fileattrs/perllib.attr
+++ b/fileattrs/perllib.attr
@@ -1,3 +1,5 @@
%__perllib_provides %{_rpmconfigdir}/perl.prov
%__perllib_requires %{_rpmconfigdir}/perl.req
%__perllib_magic ^Perl[[:digit:]] module source.*
+%__perllib_path \\.pm$
+%__perllib_flags magic_and_path

View File

@ -1,13 +0,0 @@
diff --git a/macros.in b/macros.in
index 830072a..bdce7f4 100644
--- a/macros.in
+++ b/macros.in
@@ -805,6 +805,8 @@ print (t)\
export RPM_BUILD_ROOT}\
%{?_javaclasspath:CLASSPATH=\"%{_javaclasspath}\"\
export CLASSPATH}\
+ PKG_CONFIG_PATH=\"%{_libdir}/pkgconfig:%{_datadir}/pkgconfig\"\
+ export PKG_CONFIG_PATH\
\
%{verbose:set -x}%{!verbose:exec > /dev/null}\
umask 022\

View File

@ -1,127 +0,0 @@
diff --git a/lib/depends.c b/lib/depends.c
index 69aecbb..5101d32 100644
--- a/lib/depends.c
+++ b/lib/depends.c
@@ -386,6 +386,108 @@ static int rpmdbProvides(rpmts ts, depCache dcache, rpmds dep)
return rc;
}
+/*
+ * Temporary support for live-conversion of the filesystem hierarchy
+ * mailto: kay@redhat.com, harald@redhat.com
+ * https://fedoraproject.org/wiki/Features/UsrMove
+ *
+ * X-CheckUnifiedSystemdir:
+ * /bin, /sbin, /lib, /lib64 --> /usr
+ *
+ * X-CheckUnifiedBindir:
+ * /usr/sbin -> /usr/bin
+ *
+ * X-CheckMultiArchLibdir:
+ * /usr/lib64 /usr/lib/<platform tuple> (e.g. x86_64-linux-gnu)
+ *
+ * This code is not needed for new installations, it can be removed after
+ * updates from older systems are no longer supported: Fedora 19 / RHEL 8.
+ */
+
+static int CheckLink(const char *dir, const char *root)
+{
+ char *d = NULL;
+ struct stat sbuf;
+ int rc = 0;
+
+ if (!root)
+ root = "/";
+
+ rasprintf(&d, "%s%s", root, dir);
+ if (!d) {
+ rc = -1;
+ goto exit;
+ }
+
+ /* directory or symlink does not exist, all is fine */
+ if (lstat(d, &sbuf) < 0) {
+ rc = 1;
+ goto exit;
+ }
+
+ /* if it is a symlink, all is fine */
+ if (S_ISLNK(sbuf.st_mode))
+ rc = 1;
+
+exit:
+ free(d);
+ return rc;
+}
+
+static int CheckFilesystemHierarchy(rpmds * dsp, const char *root)
+{
+ static const char *dirs[] = { "bin", "sbin", "lib", "lib64" };
+ int check;
+ int i;
+ rpmds ds;
+ int rc = 0;
+
+ for (i = 0; i < sizeof(dirs) / sizeof(dirs[0]); i++) {
+ check = CheckLink(dirs[i], root);
+ if (check < 0) {
+ rc = -1;
+ goto exit;
+ }
+
+ if (check == 0)
+ goto exit;
+ }
+ ds = rpmdsSingle(RPMTAG_PROVIDENAME,
+ "rpmlib(X-CheckUnifiedSystemdir)", "1",
+ RPMSENSE_EQUAL);
+ rpmdsMerge(dsp, ds);
+ rpmdsFree(ds);
+
+ check = CheckLink("usr/lib64", root);
+ if (check < 0) {
+ rc = -1;
+ goto exit;
+ }
+ if (check > 0) {
+ ds = rpmdsSingle(RPMTAG_PROVIDENAME,
+ "rpmlib(X-CheckMultiArchLibdir)", "1",
+ RPMSENSE_EQUAL);
+ rpmdsMerge(dsp, ds);
+ rpmdsFree(ds);
+ }
+
+ check = CheckLink("usr/sbin", root);
+ if (check < 0) {
+ rc = -1;
+ goto exit;
+ }
+ if (check > 0) {
+ ds = rpmdsSingle(RPMTAG_PROVIDENAME,
+ "rpmlib(X-CheckUnifiedBindir)", "1",
+ RPMSENSE_EQUAL);
+ rpmdsMerge(dsp, ds);
+ rpmdsFree(ds);
+ }
+
+exit:
+ return rc;
+}
+
/**
* Check dep for an unsatisfied dependency.
* @param ts transaction set
@@ -410,9 +512,11 @@ retry:
*/
if (dsflags & RPMSENSE_RPMLIB) {
static int oneshot = -1;
- if (oneshot)
+ if (oneshot) {
oneshot = rpmdsRpmlib(&rpmlibP, NULL);
-
+ CheckFilesystemHierarchy(&rpmlibP, rpmtsRootDir(ts));
+ }
+
if (rpmlibP != NULL && rpmdsSearch(rpmlibP, dep) >= 0) {
rpmdsNotify(dep, "(rpmlib provides)", rc);
goto exit;

View File

@ -11,7 +11,8 @@
%define rpmhome /usr/lib/rpm
%define rpmver 4.11.0.1
%define rpmver 4.11.1
%define snapver rc1
%define srcver %{rpmver}%{?snapver:-%{snapver}}
%define bdbname libdb
@ -21,7 +22,7 @@
Summary: The RPM package management system
Name: rpm
Version: %{rpmver}
Release: %{?snapver:0.%{snapver}.}7%{?dist}
Release: %{?snapver:0.%{snapver}.}1%{?dist}
Group: System Environment/Base
Url: http://www.rpm.org/
Source0: http://rpm.org/releases/testing/%{name}-%{srcver}.tar.bz2
@ -32,7 +33,6 @@ BuildRequires: libdb-devel
%endif
Source10: libsymlink.attr
Patch1: rpm-4.5.90-pkgconfig-path.patch
# Fedora specspo is setup differently than what rpm expects, considering
# this as Fedora-specific patch for now
Patch2: rpm-4.9.90-fedora-specspo.patch
@ -45,16 +45,8 @@ Patch5: rpm-4.9.90-armhfp.patch
Patch6: rpm-4.9.0-armhfp-logic.patch
# Patches already in upstream
# http://www.rpm.org/ticket/865
Patch100: 0001-Finish-lua-5.2-support-trac-865.patch
# Check for stale locks when opening write-cursors
Patch101: rpm-4.11.x-cursor-failchk.patch
# Filter soname dependencies by name
Patch102: rpm-4.11.x-filter-soname-deps.patch
# Stricter perllib classification
Patch103: rpm-4.11.x-perllib-attr.patch
# Serialize BDB environment open+close
Patch104: rpm-4.11.x-dbenv-serialize.patch
Patch100: rpm-4.11.x-filter-soname-deps.patch
# These are not yet upstream
Patch301: rpm-4.6.0-niagara.patch
@ -228,16 +220,11 @@ packages on a system.
%prep
%setup -q -n %{name}-%{srcver} %{?with_int_bdb:-a 1}
%patch1 -p1 -b .pkgconfig-path
%patch2 -p1 -b .fedora-specspo
%patch3 -p1 -b .no-man-dirs
%patch4 -p1 -b .use-gpg2
%patch100 -p1 -b .lua-5.2
%patch101 -p1 -b .cursor-failchk
%patch102 -p1 -b .filter-soname-deps
%patch103 -p1 -b .perllib-attr
%patch104 -p1 -b .dbenv-serialize
%patch100 -p1 -b .filter-soname-deps
%patch301 -p1 -b .niagara
%patch302 -p1 -b .geode
@ -471,6 +458,9 @@ exit 0
%doc COPYING doc/librpm/html/*
%changelog
* Mon Jun 10 2013 Panu Matilainen <pmatilai@redhat.com> - 4.11.1-0.rc1.1
- update to 4.11.1-rc1 (http://rpm.org/wiki/Releases/4.11.1)
* Tue May 28 2013 Panu Matilainen <pmatilai@redhat.com> - - 4.11.0.1-7
- serialize BDB environment open/close (#924417)

View File

@ -1 +1 @@
b35f5359e0d4494d7b11e8d0c1512a0d rpm-4.11.0.1.tar.bz2
2b41ca2afade8d6cbf0afe7af0dc928e rpm-4.11.1-rc1.tar.bz2