- dont try to remove environment files if private env used (related to #671200)

- unbreak mono dependency extraction (#673663)
- complain instead of silent abort if cwd is not readable (#672576)
This commit is contained in:
Panu Matilainen 2011-01-31 10:14:23 +02:00
parent 637e6c8e36
commit 5430e272b0
4 changed files with 133 additions and 1 deletions

View File

@ -0,0 +1,34 @@
commit 0ee494ea672b9125171098184c702ccc3dd0163e
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Fri Jan 21 15:20:01 2011 +0200
Don't try to remove existing environment when using private environment
(cherry picked from commit 88e63b050cfd3ba28cb44e75b3ac31fdf5fe9909)
diff --git a/lib/backend/db3.c b/lib/backend/db3.c
index 365cd13..da1b602 100644
--- a/lib/backend/db3.c
+++ b/lib/backend/db3.c
@@ -51,6 +51,7 @@ static int db_fini(rpmdb rdb, const char * dbhome)
{
DB_ENV * dbenv = rdb->db_dbenv;
int rc;
+ uint32_t eflags = 0;
if (dbenv == NULL)
return 0;
@@ -60,12 +61,13 @@ static int db_fini(rpmdb rdb, const char * dbhome)
return 0;
}
+ (void) dbenv->get_open_flags(dbenv, &eflags);
rc = dbenv->close(dbenv, 0);
rc = dbapi_err(rdb, "dbenv->close", rc, _debug);
rpmlog(RPMLOG_DEBUG, "closed db environment %s\n", dbhome);
- if (rdb->db_remove_env) {
+ if (!(eflags & DB_PRIVATE) && rdb->db_remove_env) {
int xx;
xx = db_env_create(&dbenv, 0);

View File

@ -0,0 +1,30 @@
diff -up rpm-4.9.0-beta1/fileattrs/Makefile.am.monodeps rpm-4.9.0-beta1/fileattrs/Makefile.am
--- rpm-4.9.0-beta1/fileattrs/Makefile.am.monodeps 2010-12-03 14:11:57.000000000 +0200
+++ rpm-4.9.0-beta1/fileattrs/Makefile.am 2011-01-31 09:46:05.000000000 +0200
@@ -6,6 +6,6 @@ fattrsdir = $(rpmconfigdir)/fileattrs
fattrs_DATA = \
desktop.attr elf.attr font.attr libtool.attr perl.attr perllib.attr \
- pkgconfig.attr python.attr ocaml.attr script.attr
+ pkgconfig.attr python.attr ocaml.attr script.attr mono.attr
EXTRA_DIST = $(fattrs_DATA)
diff -up rpm-4.9.0-beta1/fileattrs/Makefile.in.monodeps rpm-4.9.0-beta1/fileattrs/Makefile.in
--- rpm-4.9.0-beta1/fileattrs/Makefile.in.monodeps 2011-01-31 09:56:15.000000000 +0200
+++ rpm-4.9.0-beta1/fileattrs/Makefile.in 2011-01-31 09:56:24.000000000 +0200
@@ -301,7 +301,7 @@ rpmconfigdir = $(prefix)/lib/rpm
fattrsdir = $(rpmconfigdir)/fileattrs
fattrs_DATA = \
desktop.attr elf.attr font.attr libtool.attr perl.attr perllib.attr \
- pkgconfig.attr python.attr ocaml.attr script.attr
+ pkgconfig.attr python.attr ocaml.attr script.attr mono.attr
EXTRA_DIST = $(fattrs_DATA)
all: all-am
diff -up rpm-4.9.0-beta1/fileattrs/mono.attr.monodeps rpm-4.9.0-beta1/fileattrs/mono.attr
--- rpm-4.9.0-beta1/fileattrs/mono.attr.monodeps 2011-01-31 09:46:05.000000000 +0200
+++ rpm-4.9.0-beta1/fileattrs/mono.attr 2011-01-31 09:46:05.000000000 +0200
@@ -0,0 +1,3 @@
+%__mono_provides %{_rpmconfigdir}/mono-find-provides %{_builddir}/%{?buildsubdir} %{buildroot} %{_libdir}
+%__mono_requires %{_rpmconfigdir}/mono-find-requires %{_builddir}/%{?buildsubdir} %{buildroot} %{_libdir}
+%__mono_magic ^.*Mono/.Net assembly.*$

View File

@ -0,0 +1,57 @@
commit 431afe5167675a89682eb7e07baa3a627ceb8770
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Fri Jan 28 13:15:09 2011 +0200
Add an error message + comments on open(".") behavior (RhBug:672576)
- Bail out early and complain if current directory can't be open()'ed,
as we'll need it for reliable cwd restoration after running Lua
scripts.
- Technically we'd only need open(".") succeeding for chroot operations
and running Lua-scripts, but there's no easy way to determine whether
a transaction will run Lua-scripts. They could be in-db triggers
which will only be evaluated in the middle of transaction, better
to fail early for consistent behavior.
(cherry picked from commit fbdfe8e5bf1ef7044de7a14cff9205c4d845f90b)
diff --git a/lib/rpmchroot.c b/lib/rpmchroot.c
index e91be71..81bb5e5 100644
--- a/lib/rpmchroot.c
+++ b/lib/rpmchroot.c
@@ -40,6 +40,7 @@ int rpmChrootSet(const char *rootDir)
rootState.rootDir = rstrdup(rootDir);
rootState.cwd = open(".", O_RDONLY);
if (rootState.cwd < 0) {
+ rpmlog(RPMLOG_ERR, _("Unable to open current directory: %m\n"));
rc = -1;
}
}
diff --git a/lib/rpmscript.c b/lib/rpmscript.c
index ed52608..3801873 100644
--- a/lib/rpmscript.c
+++ b/lib/rpmscript.c
@@ -55,6 +55,7 @@ static rpmRC runLuaScript(int selinux, ARGV_const_t prefixes,
rpmluaPop(lua);
/* Lua scripts can change our cwd and umask, save and restore */
+ /* XXX TODO: use cwd from chroot state to save unnecessary open here */
cwd = open(".", O_RDONLY);
if (cwd != -1) {
int xx;
diff --git a/lib/transaction.c b/lib/transaction.c
index 06e54af..628e4ea 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -1260,7 +1260,12 @@ static int rpmtsSetup(rpmts ts, rpmprobFilterFlags ignoreSet)
rpmtsSELabelInit(ts, selinux_file_context_path());
}
- /* XXX Make sure the database is open RDWR for package install/erase. */
+ /*
+ * Make sure the database is open RDWR for package install/erase.
+ * Note that we initialize chroot state here even if it's just "/" as
+ * this ensures we can successfully perform open(".") which is
+ * required to reliably restore cwd after Lua scripts.
+ */
if (rpmtsOpenDB(ts, dbmode) || rpmChrootSet(rpmtsRootDir(ts)))
return -1;

View File

@ -22,7 +22,7 @@
Summary: The RPM package management system
Name: rpm
Version: %{rpmver}
Release: %{?snapver:0.%{snapver}.}4%{?dist}
Release: %{?snapver:0.%{snapver}.}5%{?dist}
Group: System Environment/Base
Url: http://www.rpm.org/
Source0: http://rpm.org/releases/rpm-4.8.x/%{name}-%{srcver}.tar.bz2
@ -46,6 +46,9 @@ Patch101: rpm-4.9.0-beta1-index-rebuild.patch
Patch102: rpm-4.9.0-beta1-index-iteration.patch
Patch103: rpm-4.9.0-beta1-rpmdb-dsi.patch
Patch104: rpm-4.9.0-beta1-posttrans-deps.patch
Patch105: rpm-4.9.0-beta1-env-noremove.patch
Patch106: rpm-4.9.0-beta1-open-cwd.patch
Patch107: rpm-4.9.0-beta1-monodeps.patch
# These are not yet upstream
Patch301: rpm-4.6.0-niagara.patch
@ -215,6 +218,9 @@ packages on a system.
%patch102 -p1 -b .index-iteration
%patch103 -p1 -b .rpmdb-dsi
%patch104 -p1 -b .posttrans-deps
%patch105 -p1 -b .env-noremove
%patch106 -p1 -b .open-cwd
%patch107 -p1 -b .monodeps
%patch301 -p1 -b .niagara
%patch302 -p1 -b .geode
@ -425,6 +431,11 @@ exit 0
%doc COPYING doc/librpm/html/*
%changelog
* Mon Jan 31 2011 Panu Matilainen <pmatilai@redhat.com> - 4.9.0-0.beta1.5
- dont try to remove environment files if private env used (related to #671200)
- unbreak mono dependency extraction (#673663)
- complain instead of silent abort if cwd is not readable (#672576)
* Tue Jan 25 2011 Panu Matilainen <pmatilai@redhat.com> - 4.9.0-0.beta1.4
- add support for Requires(posttrans) dependencies