rpm: make install with --nosignature and --nodigest work
cover rpm: make install with --nosignature and --nodigest work
Boot a target environment with rpm:
1). With option '--nodigest --nosignature', installing package with bad signature is successful
======
root@localhost:~# rpm -ivh hello-bogus.rpm error: hello-bogus.rpm: Header V4 DSA signature: BAD, key ID 09753bca
======
2). Without option '--nodigest --nosignature', installing package with bad signature failed
======
root@localhost:~# rpm -ivh --nodigest --nosignature hello-bogus.rpm Preparing... ########################################### [100%] 1:hello ########################################### [100%] ======
BTW: the package with bad signature hello-bogus.rpm in
https://bugzilla.yoctoproject.org/show_bug.cgi?id=10308
//Hongxu
The following changes since commit 49a7839e602eac2c43415d9c8f17ad8315fd1da5:
build-appliance-image: Create image in correct location (2016-09-19 08:58:10 +0100)
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib hongxu/fix-rpm
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=hongxu/fix-rpm
Hongxu Jia (1):
rpm: make install with --nosignature and --nodigest work
...0001-system.h-query.c-support-nosignature.patch | 75 ++++++++++++++++++++-- 1 file changed, 71 insertions(+), 4 deletions(-)
Signature · 1 line
2.8.1
PATCH 1/1 rpm: make install with --nosignature and --nodigest work
It fixed the following issue:
1). With option '--nodigest --nosignature', installing package with bad signature failed
======
root@localhost:~# rpm -ivh --nodigest --nosignature hello-bogus.rpm error: hello-bogus.rpm: Header V4 DSA signature: BAD, key ID 09753bc ======
2). Without option '--nodigest --nosignature', installing package with bad signature is successful
======
root@localhost:~# rpm -ivh hello-bogus.rpm Preparing... ########################################### [100%] 1:hello ########################################### [100%] root@localhost:~# rpm -q hello hello-1.0-r1.1.x86_64 ======
[YOCTO #10308]
--- ...0001-system.h-query.c-support-nosignature.patch | 75 ++++++++++++++++++++-- 1 file changed, 71 insertions(+), 4 deletions(-)
meta/recipes-devtools/rpm/rpm/0001-system.h-query.c-support-nosignature.patch +71 -4
@@ -8,13 +8,29 @@ Subject: [PATCH] system.h/query.c: support nosignature otherwise, when use --nosignature would read database and verify signature, this is not expected. -Upstream-Status: Submitted [Sent email to [email protected]] +Upstream-Status: Rejected [Sent email to [email protected]] +http://rpm5.org/community/rpm-devel/5655.html Signed-off-by: Robert Yang <[email protected]> + +lib/rpminstall.c: support nosignature +* !QVA_ISSET -> QVA_ISSET +Reversing QVA_ISSET: +- The macro QVA_ISSET(qva->qva_flags, SIGNATURE) invoking in + lib/rpminstall.c means qva->qva_flags has bitmap VERIFY_SIGNATURE. + And the bitmap assigning in lib/poptQV.c means rpm cli have option + --nosignature. (It is weird that SIGNATURE in QVA_ISSET means + --nosignature) + + The upstream said he will remove all the SUPPORT_NOSIGNATURES code. + See upstream reply http://rpm5.org/community/rpm-devel/5655.html + +Signed-off-by: Hongxu Jia <[email protected]> --- - lib/query.c | 6 +++--- - system.h | 4 ++-- - 2 files changed, 5 insertions(+), 5 deletions(-) + lib/query.c | 6 +++--- + lib/rpminstall.c | 12 ++++++------ + system.h | 4 ++-- + 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/query.c b/lib/query.c index 50a7453..b761d76 100644
@@ -43,6 +59,56 @@ index 50a7453..b761d76 100644 VSF_SET(vsflags, NOHDRCHK); } VSF_CLR(vsflags, NEEDPAYLOAD); /* XXX needed? */ +diff --git a/lib/rpminstall.c b/lib/rpminstall.c +index af6a51b..2a23343 100644 +--- a/lib/rpminstall.c ++++ b/lib/rpminstall.c +@@ -566,19 +566,19 @@ int rpmcliInstall(rpmts ts, QVA_t ia, const char ** argv) + vsflags = (rpmVSFlags) rpmExpandNumeric("%{?_vsflags_install}"); + vsflags = (rpmVSFlags) 0; /* XXX FIXME: ignore default disablers. */ + #if defined(SUPPORT_NOSIGNATURES) +- if (!QVA_ISSET(ia->qva_flags, DIGEST)) { ++ if (QVA_ISSET(ia->qva_flags, DIGEST)) { + VSF_SET(vsflags, NOSHA1HEADER); + VSF_SET(vsflags, NOMD5HEADER); + VSF_SET(vsflags, NOSHA1); + VSF_SET(vsflags, NOMD5); + } +- if (!QVA_ISSET(ia->qva_flags, SIGNATURE)) { ++ if (QVA_ISSET(ia->qva_flags, SIGNATURE)) { + VSF_SET(vsflags, NODSAHEADER); + VSF_SET(vsflags, NORSAHEADER); + VSF_SET(vsflags, NODSA); + VSF_SET(vsflags, NORSA); + } +- if (!QVA_ISSET(ia->qva_flags, HDRCHK)) { ++ if (QVA_ISSET(ia->qva_flags, HDRCHK)) { + VSF_SET(vsflags, NOHDRCHK); + } + VSF_SET(vsflags, NEEDPAYLOAD); +@@ -784,19 +784,19 @@ int rpmErase(rpmts ts, QVA_t ia, const char ** argv) + vsflags = (rpmVSFlags) rpmExpandNumeric("%{?_vsflags_erase}"); + vsflags = (rpmVSFlags) 0; /* XXX FIXME: ignore default disablers. */ + #if defined(SUPPORT_NOSIGNATURES) +- if (!QVA_ISSET(ia->qva_flags, DIGEST)) { ++ if (QVA_ISSET(ia->qva_flags, DIGEST)) { + VSF_SET(vsflags, NOSHA1HEADER); + VSF_SET(vsflags, NOMD5HEADER); + VSF_SET(vsflags, NOSHA1); + VSF_SET(vsflags, NOMD5); + } +- if (!QVA_ISSET(ia->qva_flags, SIGNATURE)) { ++ if (QVA_ISSET(ia->qva_flags, SIGNATURE)) { + VSF_SET(vsflags, NODSAHEADER); + VSF_SET(vsflags, NORSAHEADER); + VSF_SET(vsflags, NODSA); + VSF_SET(vsflags, NORSA); + } +- if (!QVA_ISSET(ia->qva_flags, HDRCHK)) { ++ if (QVA_ISSET(ia->qva_flags, HDRCHK)) { + VSF_SET(vsflags, NOHDRCHK); + } + VSF_CLR(vsflags, NEEDPAYLOAD); /* XXX needed? */ diff --git a/system.h b/system.h index 2ff8906..ad4619a 100644 --- a/system.h
@@ -61,3 +127,4 @@ index 2ff8906..ad4619a 100644 * Permit ar(1) payloads. Disabled while rpmio/iosm.c is under development. -- 2.9.0 +
Signature · 1 line
2.8.1
BTW, as Robert suggested, I tested rpm upgrade (rpm -F), the fix also works well
Preprae two version hello with bad signature
1. Install hello with version 1.0-r1.0
root@localhost:~# rpm -ivh --nodigest --nosignature hello-1.0-r1.0.corei7_64.rpm Preparing... ########################################### [100%] 1:hello ########################################### [100%]
root@localhost:~# rpm -F --verbose hello-1.0-r2.0.corei7_64.rpm error: hello-1.0-r2.0.corei7_64.rpm: Header V4 DSA signature: BAD, key ID 8a0274fa
2. Upgrade hello with version 1.0-r2.0
root@localhost:~# rpm -F --verbose --nodigest --nosignature hello-1.0-r2.0.corei7_64.rpm Preparing packages for installation... hello-1.0-r2.0.corei7_64
root@localhost:~# rpm -q hello hello-1.0-r2.0.corei7_64
//Hongxu
Quoted 38 lines · Hongxu Jia
Boot a target environment with rpm:
1). With option '--nodigest --nosignature', installing package with bad signature is successful
======root@localhost:~# rpm -ivh hello-bogus.rpm error: hello-bogus.rpm: Header V4 DSA signature: BAD, key ID 09753bca======
2). Without option '--nodigest --nosignature', installing package with bad signature failed
======root@localhost:~# rpm -ivh --nodigest --nosignature hello-bogus.rpm Preparing... ########################################### [100%] 1:hello ########################################### [100%] ======BTW: the package with bad signature hello-bogus.rpm in
https://bugzilla.yoctoproject.org/show_bug.cgi?id=10308//Hongxu
The following changes since commit
49a7839e602eac2c43415d9c8f17ad8315fd1da5:build-appliance-image: Create image in correct location (2016-09-19 08:58:10 +0100)are available in the git repository at:
git://git.openembedded.org/openembedded-core-contribhongxu/fix-rpm
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=hongxu/fix-rpmHongxu Jia (1):
rpm: make install with --nosignature and --nodigest work...0001-system.h-query.c-support-nosignature.patch | 75 ++++++++++++++++++++-- 1 file changed, 71 insertions(+), 4 deletions(-)
meta/recipes-devtools/rpm/rpm/0001-system.h-query.c-support-nosignature.patch Subject: [PATCH] system.h/query.c: support nosignature · line 12
Quoted 4 lines · Hongxu Jia
meta/recipes-devtools/rpm/rpm/0001-system.h-query.c-support-nosignature.patch +2
-1-Upstream-Status: Submitted [Sent email to [email protected]] +Upstream-Status: Rejected [Sent email to [email protected]] +http://rpm5.org/community/rpm-devel/5655.html
Considering upstream has explicitly rejected this patch, why should we accept it?
Ross
Quoted 12 lines · Ross
On 20 September 2016 at 09:15, Hongxu Jia <[email protected] <mailto:[email protected]>> wrote:
-Upstream-Status: Submitted [Sent email to [email protected] <mailto:[email protected]>] +Upstream-Status: Rejected [Sent email to [email protected] <mailto:[email protected]>] +http://rpm5.org/community/rpm-devel/5655.html <http://rpm5.org/community/rpm-devel/5655.html>
Quoted 5 lines
Considering upstream has explicitly rejected this patch, why should we accept it?
Ross
I'm confused by what the patch is doing looking at it.
It sounds like from the description there is a bug that without the change, packages with (intentionally) bad checksums and such are allowed to be installed.
The bug is caused by a previous patch that enabled nosignature, etc -- because the comparisons turned out to be backwards.
So really nosignature, etc is already in place -- it's just not working properly?
What was rejected upstream is the use of nosignature in any context. RPM5 maintainer believes it is unwise and unsafe to permit uses to install packages that have failed basic validation. (I tend to agree.) Similarly, even being able to run queries and other operations against them may be dangerous as well.
If fixing the problem is as simple as reverting the other change -- and that doesn't cause other problems elsewhere... I'd rather see that.
--Mark
Quoted 11 lines · Ross
On 20 September 2016 at 09:15, Hongxu Jia <[email protected] <mailto:[email protected]>> wrote:
-Upstream-Status: Submitted [Sent email to [email protected] <mailto:[email protected]>] +Upstream-Status: Rejected [Sent email to [email protected] <mailto:[email protected]>] +http://rpm5.org/community/rpm-devel/5655.html <http://rpm5.org/community/rpm-devel/5655.html>
Quoted 2 lines
Considering upstream has explicitly rejected this patch, why should we accept it?
From his reply, he will remove "SUPPORT_NOSIGNATURES" code in future:
----------------
Note that all the code marked with "SUPPORT_NOSIGNATURES" is targeted for removal. RPM5 has been producing MANDATORY signed packages for more than 5 years, so all packages produced by RPM5 SHOULD have both verifiable signatures/pubkeys included for many years now.
Your alternative (of course) is to re-patch rpm to re-add --nosignatures as you wish: I will be happy to send you the needed patch when I remove all the SUPPORT_NOSIGNATURES code.
----------------
If we need to support --nosignatures, we have to re-patch rpm locally. We could drop it after upstream removes "SUPPORT_NOSIGNATURES" code.
//Hongxu
Quoted 1 line
Ross
Quoted 27 lines · Mark Hatle
Quoted 12 lines · Ross
On 20 September 2016 at 09:15, Hongxu Jia <[email protected] <mailto:[email protected]>> wrote:
-Upstream-Status: Submitted [Sent email to [email protected] <mailto:[email protected]>] +Upstream-Status: Rejected [Sent email to [email protected] <mailto:[email protected]>] +http://rpm5.org/community/rpm-devel/5655.html <http://rpm5.org/community/rpm-devel/5655.html>Quoted 5 lines
Considering upstream has explicitly rejected this patch, why should we accept it?
Ross
I'm confused by what the patch is doing looking at it.
It sounds like from the description there is a bug that without the change, packages with (intentionally) bad checksums and such are allowed to be installed.
The bug is caused by a previous patch that enabled nosignature, etc -- because the comparisons turned out to be backwards.
Quoted 6 lines
So really nosignature, etc is already in place -- it's just not working properly?
What was rejected upstream is the use of nosignature in any context. RPM5 maintainer believes it is unwise and unsafe to permit uses to install packages that have failed basic validation. (I tend to agree.) Similarly, even being able to run queries and other operations against them may be dangerous as well.
If command like "rpm5 -qp --nosignature --nodigest <file.rpm>" queries database, then it would cause rpm5 hang when more than one "rpm5 -qp" is running, so I fixed the *query* problem, and the *install* problem is not caused by the fix. Btw., *rpm4* doesn't query database when "rpm -qp file.rpm", if we are going to use dnf in next release, maybe we can consider using rpm4 as Fedora does. I did a rough statistics for oe-core's local patches, the winner is rpm, it has 77 local patches, that's not good for maintaining, and you can imagine that how many times it surprised us. rpm4 should be more stable than rpm5, I don't know how many distros use rpm5, I can't access rpm5.org atm, it seems that the web is down (It was OK yesterday), but widely used distros like Redhat and Suse uses rpm4, so maybe rpm4 will make our life much more easier, and also for yocto's user. I think that why we need rpm5 before was because we need use it to compute the package dependencies, but now we have smartpm, so we don't rely on that any more.
Here is the recipe list which has more than 10 local patches, and we have 1762 patches atm:
77 rpm
59 gcc-5.4
49 gcc-6.2
36 ltp
31 python3
30 perl
29 openssl
28 man
27 glibc
24 python
23 tcp-wrappers-7.6
23 systemd
18 busybox
14 syslinux
14 python-smartpm
14 elfutils-0.166
14 apt
13 qemu
13 libtool
13 gstreamer1.0-plugins-bad
13 glib-2.0
13 binutils
13 bind
12 coreutils-6.9
11 valgrind
11 gdb
11 dhcp
11 autoconf
10 unzip
10 dpkg
10 console-tools-0.3.2Quoted 3 lines
If fixing the problem is as simple as reverting the other change -- and that doesn't cause other problems elsewhere... I'd rather see that.
We can't revert the patch, it would break packagefeed-stability.bbclass, we will see the hang
Quoted 3 lines
--Mark
Quoted 37 lines · Robert Yang
Quoted 27 lines · Mark Hatle
Quoted 12 lines · Ross
On 20 September 2016 at 09:15, Hongxu Jia <[email protected] <mailto:[email protected]>> wrote:
-Upstream-Status: Submitted [Sent email to [email protected] <mailto:[email protected]>] +Upstream-Status: Rejected [Sent email to [email protected] <mailto:[email protected]>] +http://rpm5.org/community/rpm-devel/5655.html <http://rpm5.org/community/rpm-devel/5655.html>Quoted 5 lines
Considering upstream has explicitly rejected this patch, why should we accept it?
Ross
I'm confused by what the patch is doing looking at it.
It sounds like from the description there is a bug that without the change, packages with (intentionally) bad checksums and such are allowed to be installed.
The bug is caused by a previous patch that enabled nosignature, etc -- because the comparisons turned out to be backwards.
Quoted 6 lines
So really nosignature, etc is already in place -- it's just not working properly?
What was rejected upstream is the use of nosignature in any context. RPM5 maintainer believes it is unwise and unsafe to permit uses to install packages that have failed basic validation. (I tend to agree.) Similarly, even being able to run queries and other operations against them may be dangerous as well.
Quoted 7 lines
If command like "rpm5 -qp --nosignature --nodigest <file.rpm>" queries database, then it would cause rpm5 hang when more than one "rpm5 -qp" is running, so I fixed the *query* problem, and the *install* problem is not caused by the fix. Btw., *rpm4* doesn't query database when "rpm -qp file.rpm", if we are going to use dnf in next release, maybe we can consider using rpm4 as Fedora does. I did a rough statistics for oe-core's local patches, the winner is rpm, it has 77 local patches, that's not good for maintaining, and you can imagine that
30 patches are simply configuration changes.
42 patches are bug fixes that have been submitted and will likely go away in the next uprev.
Quoted 3 lines
how many times it surprised us. rpm4 should be more stable than rpm5, I don't know how many distros use rpm5, I can't access rpm5.org atm, it seems that the web is down (It was OK yesterday), but widely used distros like Redhat and Suse
The website is working for me today.
Quoted 2 lines
uses rpm4, so maybe rpm4 will make our life much more easier, and also for yocto's user. I think that why we need rpm5 before was because we need use it
There is a major problem with rpm4. It doesn't support cross compiling at all. We know in the past there have been significant problems with it and BerkleyDB with endian issues. Also it was not possible to do cross-architecture installs (in the past, this one might be resolved.)
The general functionality between RPM4 and RPM5 is nearly identical. RPM 4 has a plug-in interface (which I personally don't believe should be used due to security issues.) RPM 5 has a focus around specific security enhancements. Some are reasonable, some are a bit too experimental to be used.
The other main difference is software license. RPM 4 is 'GPLv2', while RPM5 is 'LGPLv2'. This doesn't sound like a big deal at first -- but RPM 4 can't be linked to OpenSSL for it's crypto library. RPM 4 is linked ONLY to NSS, while RPM5 can use beecrypt, nss, openssl and others. This makes for a significantly more flexible embedded system.
Quoted 6 lines
to compute the package dependencies, but now we have smartpm, so we don't rely on that any more.
Here is the recipe list which has more than 10 local patches, and we have 1762 patches atm:
77 rpm
I'd think it's a better comparison to say '30', the configuration items. So it's similar to perl or openssl in complexity. I'd agree that is a fair comparison.
Quoted 32 lines
59 gcc-5.4 49 gcc-6.2 36 ltp 31 python3 30 perl 29 openssl 28 man 27 glibc 24 python 23 tcp-wrappers-7.6 23 systemd 18 busybox 14 syslinux 14 python-smartpm 14 elfutils-0.166 14 apt 13 qemu 13 libtool 13 gstreamer1.0-plugins-bad 13 glib-2.0 13 binutils 13 bind 12 coreutils-6.9 11 valgrind 11 gdb 11 dhcp 11 autoconf 10 unzip 10 dpkg 10 console-tools-0.3.2Quoted 1 line
Quoted 5 lines
Quoted 2 lines
If fixing the problem is as simple as reverting the other change -- and that doesn't cause other problems elsewhere... I'd rather see that.
We can't revert the patch, it would break packagefeed-stability.bbclass, we will see the hang
Something is wrong with the implementation then.
You should not be doing the equivalent of:
list = '<all packages>'
for each in list; do rpm -qp $each ; done
This is HORRIBLY inefficient, even with rpm4.
The proper way to query a number of packages is in a single transaction. This permits RPM to load the data and validation structures once.
This is equivalent to:
rpm -qp cat list
or
echo list > /tmp/tmpfile
rpm -qp /tmp/tmpfile
(The later solving the problem of 'too many arguments')
This may seem counter intuitive, as the first way looks to be better on a multi-core machine -- but in my experience the overhead of starting rpm, setting up the data structures is very expensive, much more then the load/validate/display of the package information.
--Mark
Quoted 4 lines
Quoted 4 lines
--Mark
Quoted 136 lines · Mark Hatle
Quoted 37 lines · Robert Yang
Quoted 27 lines · Mark Hatle
Quoted 12 lines · Ross
On 20 September 2016 at 09:15, Hongxu Jia <[email protected] <mailto:[email protected]>> wrote:
-Upstream-Status: Submitted [Sent email to [email protected] <mailto:[email protected]>] +Upstream-Status: Rejected [Sent email to [email protected] <mailto:[email protected]>] +http://rpm5.org/community/rpm-devel/5655.html <http://rpm5.org/community/rpm-devel/5655.html>Quoted 5 lines
Considering upstream has explicitly rejected this patch, why should we accept it?
Ross
I'm confused by what the patch is doing looking at it.
It sounds like from the description there is a bug that without the change, packages with (intentionally) bad checksums and such are allowed to be installed.
The bug is caused by a previous patch that enabled nosignature, etc -- because the comparisons turned out to be backwards.
Quoted 6 lines
So really nosignature, etc is already in place -- it's just not working properly?
What was rejected upstream is the use of nosignature in any context. RPM5 maintainer believes it is unwise and unsafe to permit uses to install packages that have failed basic validation. (I tend to agree.) Similarly, even being able to run queries and other operations against them may be dangerous as well.
Quoted 7 lines
If command like "rpm5 -qp --nosignature --nodigest <file.rpm>" queries database, then it would cause rpm5 hang when more than one "rpm5 -qp" is running, so I fixed the *query* problem, and the *install* problem is not caused by the fix. Btw., *rpm4* doesn't query database when "rpm -qp file.rpm", if we are going to use dnf in next release, maybe we can consider using rpm4 as Fedora does. I did a rough statistics for oe-core's local patches, the winner is rpm, it has 77 local patches, that's not good for maintaining, and you can imagine that
30 patches are simply configuration changes.
42 patches are bug fixes that have been submitted and will likely go away in the next uprev.
Quoted 3 lines
how many times it surprised us. rpm4 should be more stable than rpm5, I don't know how many distros use rpm5, I can't access rpm5.org atm, it seems that the web is down (It was OK yesterday), but widely used distros like Redhat and Suse
The website is working for me today.
Quoted 2 lines
uses rpm4, so maybe rpm4 will make our life much more easier, and also for yocto's user. I think that why we need rpm5 before was because we need use it
There is a major problem with rpm4. It doesn't support cross compiling at all. We know in the past there have been significant problems with it and BerkleyDB with endian issues. Also it was not possible to do cross-architecture installs (in the past, this one might be resolved.)
The general functionality between RPM4 and RPM5 is nearly identical. RPM 4 has a plug-in interface (which I personally don't believe should be used due to security issues.) RPM 5 has a focus around specific security enhancements. Some are reasonable, some are a bit too experimental to be used.
The other main difference is software license. RPM 4 is 'GPLv2', while RPM5 is 'LGPLv2'. This doesn't sound like a big deal at first -- but RPM 4 can't be linked to OpenSSL for it's crypto library. RPM 4 is linked ONLY to NSS, while RPM5 can use beecrypt, nss, openssl and others. This makes for a significantly more flexible embedded system.
Quoted 6 lines
to compute the package dependencies, but now we have smartpm, so we don't rely on that any more.
Here is the recipe list which has more than 10 local patches, and we have 1762 patches atm:
77 rpmI'd think it's a better comparison to say '30', the configuration items. So it's similar to perl or openssl in complexity. I'd agree that is a fair comparison.
Quoted 32 lines
59 gcc-5.4 49 gcc-6.2 36 ltp 31 python3 30 perl 29 openssl 28 man 27 glibc 24 python 23 tcp-wrappers-7.6 23 systemd 18 busybox 14 syslinux 14 python-smartpm 14 elfutils-0.166 14 apt 13 qemu 13 libtool 13 gstreamer1.0-plugins-bad 13 glib-2.0 13 binutils 13 bind 12 coreutils-6.9 11 valgrind 11 gdb 11 dhcp 11 autoconf 10 unzip 10 dpkg 10 console-tools-0.3.2Quoted 1 line
Quoted 5 lines
Quoted 2 lines
If fixing the problem is as simple as reverting the other change -- and that doesn't cause other problems elsewhere... I'd rather see that.
We can't revert the patch, it would break packagefeed-stability.bbclass, we will see the hang
Something is wrong with the implementation then.
You should not be doing the equivalent of:
list = '<all packages>'
for each in list; do rpm -qp $each ; doneThis is HORRIBLY inefficient, even with rpm4.
The proper way to query a number of packages is in a single transaction. This permits RPM to load the data and validation structures once.
Quoted 7 lines
This is equivalent to:
rpm -qpcat listor
echo list >
/tmp/tmpfile
rpm -qp/tmp/tmpfile
pkg-diff.sh from build-compare can only use two rpm pkgs as arguments:
pkg-diff.sh rpm1 rpm2
So we use "for each in list; do pkg-diff.sh each1 each2; done". We need change pkg-diff.sh to make it accept files as arguments. And it works well with rpm4, so I'm not sure whether the upstream can accept such a change or not. The hang reason for rpm5 is that it reads database (/var/lib/rpm) when not needed, so I think that fix rpm5 is the correct way.
// Robert
Quoted 16 lines
(The later solving the problem of 'too many arguments')
This may seem counter intuitive, as the first way looks to be better on a multi-core machine -- but in my experience the overhead of starting rpm, setting up the data structures is very expensive, much more then the load/validate/display of the package information.
--Mark
Quoted 4 lines
Quoted 4 lines
--Mark
Quoted 142 lines · Robert Yang
Quoted 139 lines · Mark Hatle
Quoted 37 lines · Robert Yang
Quoted 27 lines · Mark Hatle
Quoted 12 lines · Ross
On 20 September 2016 at 09:15, Hongxu Jia <[email protected] <mailto:[email protected]>> wrote:
-Upstream-Status: Submitted [Sent email to [email protected] <mailto:[email protected]>] +Upstream-Status: Rejected [Sent email to [email protected] <mailto:[email protected]>] +http://rpm5.org/community/rpm-devel/5655.html <http://rpm5.org/community/rpm-devel/5655.html>Quoted 5 lines
Considering upstream has explicitly rejected this patch, why should we accept it?
Ross
I'm confused by what the patch is doing looking at it.
It sounds like from the description there is a bug that without the change, packages with (intentionally) bad checksums and such are allowed to be installed.
The bug is caused by a previous patch that enabled nosignature, etc -- because the comparisons turned out to be backwards.
Quoted 6 lines
So really nosignature, etc is already in place -- it's just not working properly?
What was rejected upstream is the use of nosignature in any context. RPM5 maintainer believes it is unwise and unsafe to permit uses to install packages that have failed basic validation. (I tend to agree.) Similarly, even being able to run queries and other operations against them may be dangerous as well.
Quoted 7 lines
If command like "rpm5 -qp --nosignature --nodigest <file.rpm>" queries database, then it would cause rpm5 hang when more than one "rpm5 -qp" is running, so I fixed the *query* problem, and the *install* problem is not caused by the fix. Btw., *rpm4* doesn't query database when "rpm -qp file.rpm", if we are going to use dnf in next release, maybe we can consider using rpm4 as Fedora does. I did a rough statistics for oe-core's local patches, the winner is rpm, it has 77 local patches, that's not good for maintaining, and you can imagine that
30 patches are simply configuration changes.
42 patches are bug fixes that have been submitted and will likely go away in the next uprev.
Quoted 3 lines
how many times it surprised us. rpm4 should be more stable than rpm5, I don't know how many distros use rpm5, I can't access rpm5.org atm, it seems that the web is down (It was OK yesterday), but widely used distros like Redhat and Suse
The website is working for me today.
Quoted 2 lines
uses rpm4, so maybe rpm4 will make our life much more easier, and also for yocto's user. I think that why we need rpm5 before was because we need use it
There is a major problem with rpm4. It doesn't support cross compiling at all. We know in the past there have been significant problems with it and BerkleyDB with endian issues. Also it was not possible to do cross-architecture installs (in the past, this one might be resolved.)
The general functionality between RPM4 and RPM5 is nearly identical. RPM 4 has a plug-in interface (which I personally don't believe should be used due to security issues.) RPM 5 has a focus around specific security enhancements. Some are reasonable, some are a bit too experimental to be used.
The other main difference is software license. RPM 4 is 'GPLv2', while RPM5 is 'LGPLv2'. This doesn't sound like a big deal at first -- but RPM 4 can't be linked to OpenSSL for it's crypto library. RPM 4 is linked ONLY to NSS, while RPM5 can use beecrypt, nss, openssl and others. This makes for a significantly more flexible embedded system.
Quoted 6 lines
to compute the package dependencies, but now we have smartpm, so we don't rely on that any more.
Here is the recipe list which has more than 10 local patches, and we have 1762 patches atm:
77 rpmI'd think it's a better comparison to say '30', the configuration items. So it's similar to perl or openssl in complexity. I'd agree that is a fair comparison.
Quoted 32 lines
59 gcc-5.4 49 gcc-6.2 36 ltp 31 python3 30 perl 29 openssl 28 man 27 glibc 24 python 23 tcp-wrappers-7.6 23 systemd 18 busybox 14 syslinux 14 python-smartpm 14 elfutils-0.166 14 apt 13 qemu 13 libtool 13 gstreamer1.0-plugins-bad 13 glib-2.0 13 binutils 13 bind 12 coreutils-6.9 11 valgrind 11 gdb 11 dhcp 11 autoconf 10 unzip 10 dpkg 10 console-tools-0.3.2Quoted 1 line
Quoted 5 lines
Quoted 2 lines
If fixing the problem is as simple as reverting the other change -- and that doesn't cause other problems elsewhere... I'd rather see that.
We can't revert the patch, it would break packagefeed-stability.bbclass, we will see the hang
Something is wrong with the implementation then.
You should not be doing the equivalent of:
list = '<all packages>'
for each in list; do rpm -qp $each ; doneThis is HORRIBLY inefficient, even with rpm4.
The proper way to query a number of packages is in a single transaction. This permits RPM to load the data and validation structures once.
This is equivalent to:
rpm -qpcat list
Quoted 8 lines
Quoted 4 lines
or
echo list >
/tmp/tmpfile
rpm -qp/tmp/tmpfile
pkg-diff.shfrom build-compare can only use two rpm pkgs as arguments:
pkg-diff.shrpm1 rpm2
Sounds like a potential -future- enhancement to build-compare.
Quoted 5 lines
So we use "for each in list; do
pkg-diff.sheach1 each2; done". We need changepkg-diff.shto make it accept files as arguments. And it works well with rpm4, so I'm not sure whether the upstream can accept such a change or not. The hang reason for rpm5 is that it reads database (/var/lib/rpm) when not needed, so I think that fix rpm5 is the correct way.
A quick and simple alternative (since quering the DB isn't desired in any case) is to simple set '--dbpath=<random tmp location>' then after the query remove
the tmp location. No database, no collision, no problem.
--Mark
Quoted 20 lines
// Robert
Quoted 16 lines
(The later solving the problem of 'too many arguments')
This may seem counter intuitive, as the first way looks to be better on a multi-core machine -- but in my experience the overhead of starting rpm, setting up the data structures is very expensive, much more then the load/validate/display of the package information.
--Mark
Quoted 4 lines
Quoted 4 lines
--Mark