Re: [pacman-dev] [PATCH] check localdb before upgrading package
On 11/27/18 at 09:24pm, Allan McRae wrote: > On 17/11/18 1:47 pm, Andrew Gregory wrote: > > Commit 2ee7a8d89ad693617307260604e1d58757fd2978 replaced a manual check > > for a local package with a check for the "oldpkg" member, which gets set > > at the beginning of the transaction. If the package was also in the > > remove list, such as when a package gets replaced, it would no longer be > > in the local db and pacman would try to remove it twice, resulting in > > superfluous error messages. > > > > Fixes: FS#50875, FS#5554 > > > > Signed-off-by: Andrew Gregory > > --- > > lib/libalpm/add.c | 2 +- > > test/pacman/meson.build | 1 + > > test/pacman/tests/TESTS | 1 + > > .../tests/replace-and-upgrade-package.py | 27 +++ > > 4 files changed, 30 insertions(+), 1 deletion(-) > > create mode 100644 test/pacman/tests/replace-and-upgrade-package.py > > > > Thanks! Committed with bug number typo fixed. Did this patch get lost or am I blind?
Re: [pacman-dev] [PATCH] check localdb before upgrading package
On 17/11/18 1:47 pm, Andrew Gregory wrote: > Commit 2ee7a8d89ad693617307260604e1d58757fd2978 replaced a manual check > for a local package with a check for the "oldpkg" member, which gets set > at the beginning of the transaction. If the package was also in the > remove list, such as when a package gets replaced, it would no longer be > in the local db and pacman would try to remove it twice, resulting in > superfluous error messages. > > Fixes: FS#50875, FS#5554 > > Signed-off-by: Andrew Gregory > --- > lib/libalpm/add.c | 2 +- > test/pacman/meson.build | 1 + > test/pacman/tests/TESTS | 1 + > .../tests/replace-and-upgrade-package.py | 27 +++ > 4 files changed, 30 insertions(+), 1 deletion(-) > create mode 100644 test/pacman/tests/replace-and-upgrade-package.py > Thanks! Committed with bug number typo fixed. A
Re: [pacman-dev] [PATCH] check localdb before upgrading package
On 11/17/18 at 08:02pm, Eli Schwartz wrote: > On 11/16/18 10:47 PM, Andrew Gregory wrote: > > Commit 2ee7a8d89ad693617307260604e1d58757fd2978 replaced a manual check > > for a local package with a check for the "oldpkg" member, which gets set > > at the beginning of the transaction. If the package was also in the > > remove list, such as when a package gets replaced, it would no longer be > > in the local db and pacman would try to remove it twice, resulting in > > superfluous error messages. > > > > Fixes: FS#50875, FS#5554 > Is this second one, FS#55534? Yes.
Re: [pacman-dev] [PATCH] check localdb before upgrading package
On 11/16/18 10:47 PM, Andrew Gregory wrote: > Commit 2ee7a8d89ad693617307260604e1d58757fd2978 replaced a manual check > for a local package with a check for the "oldpkg" member, which gets set > at the beginning of the transaction. If the package was also in the > remove list, such as when a package gets replaced, it would no longer be > in the local db and pacman would try to remove it twice, resulting in > superfluous error messages. > > Fixes: FS#50875, FS#5554 Is this second one, FS#55534? -- Eli Schwartz Bug Wrangler and Trusted User signature.asc Description: OpenPGP digital signature
[pacman-dev] [PATCH] check localdb before upgrading package
Commit 2ee7a8d89ad693617307260604e1d58757fd2978 replaced a manual check for a local package with a check for the "oldpkg" member, which gets set at the beginning of the transaction. If the package was also in the remove list, such as when a package gets replaced, it would no longer be in the local db and pacman would try to remove it twice, resulting in superfluous error messages. Fixes: FS#50875, FS#5554 Signed-off-by: Andrew Gregory --- lib/libalpm/add.c | 2 +- test/pacman/meson.build | 1 + test/pacman/tests/TESTS | 1 + .../tests/replace-and-upgrade-package.py | 27 +++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 test/pacman/tests/replace-and-upgrade-package.py diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index 5a3e06b8..e415bb17 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -427,7 +427,7 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg, ASSERT(trans != NULL, return -1); /* see if this is an upgrade. if so, remove the old package first */ - if((oldpkg = newpkg->oldpkg)) { + if(_alpm_db_get_pkgfromcache(db, newpkg->name) && (oldpkg = newpkg->oldpkg)) { int cmp = _alpm_pkg_compare_versions(newpkg, oldpkg); if(cmp < 0) { log_msg = "downgrading"; diff --git a/test/pacman/meson.build b/test/pacman/meson.build index dbdb429e..90885015 100644 --- a/test/pacman/meson.build +++ b/test/pacman/meson.build @@ -148,6 +148,7 @@ pacman_tests = [ { 'name': 'tests/remove060.py' }, { 'name': 'tests/remove070.py' }, { 'name': 'tests/remove071.py' }, + { 'name': 'tests/replace-and-upgrade-package.py' }, { 'name': 'tests/replace100.py' }, { 'name': 'tests/replace101.py' }, { 'name': 'tests/replace102.py' }, diff --git a/test/pacman/tests/TESTS b/test/pacman/tests/TESTS index dc0b4ec3..74c8f674 100644 --- a/test/pacman/tests/TESTS +++ b/test/pacman/tests/TESTS @@ -144,6 +144,7 @@ TESTS += test/pacman/tests/remove052.py TESTS += test/pacman/tests/remove060.py TESTS += test/pacman/tests/remove070.py TESTS += test/pacman/tests/remove071.py +TESTS += test/pacman/tests/replace-and-upgrade-package.py TESTS += test/pacman/tests/replace100.py TESTS += test/pacman/tests/replace101.py TESTS += test/pacman/tests/replace102.py diff --git a/test/pacman/tests/replace-and-upgrade-package.py b/test/pacman/tests/replace-and-upgrade-package.py new file mode 100644 index ..ef2152a7 --- /dev/null +++ b/test/pacman/tests/replace-and-upgrade-package.py @@ -0,0 +1,27 @@ +self.description = 'Simultaneously replace and upgrade a package' + +# replacement package +sp1 = pmpkg('foo1', '1-2') +sp1.replaces = ['foo=1-1'] +sp1.conflicts = ['foo=1-1'] +self.addpkg2db('sync', sp1) + +# upgrade package +sp2 = pmpkg('foo', '2-1') +self.addpkg2db('sync', sp2) + +# depend on upgraded package to pull it into transaction +sp3 = pmpkg('bar', '1-1') +sp3.depends = [ 'foo=2-1' ] +self.addpkg2db('sync', sp3) + +lp = pmpkg('foo', '1-1') +self.addpkg2db('local', lp) + +self.args = "-Su bar" + +self.addrule('PACMAN_RETCODE=0') +self.addrule('PKG_VERSION=foo1|1-2') +self.addrule('PKG_VERSION=foo|2-1') +self.addrule('PKG_VERSION=bar|1-1') +self.addrule('!PACMAN_OUTPUT=error') -- 2.19.1