Commit Graph

106 Commits

Author SHA1 Message Date
Ivan Zakharyaschev
e805931cf3 remark: we don't print the disttag 2019-02-26 23:19:51 +03:00
Ivan Zakharyaschev
ee2e436b00 Merge branch 'predisttag-fixes' into _BUILD/alt
# Conflicts:
#	rpm-4_0.spec
2019-02-26 22:17:43 +03:00
Ivan Zakharyaschev
e9f11c0720 rpmEVRcmp(A,B) made asymmetric wrt underspecified release
(Analoguous to the change in rpm-4.13-alt6
cfa573f99fbabf7610cec1fb0ee1993f9640b090,
made with help of Vladimir D. Seleznev <vseleznv@altlinux.org>.)

Unchanged (wanted) behavior: On the side of Requires (B), a missing
("underspecified") release means that the relative order of A and B
(result of comparison) is determined only by the speicified components
(epoch, version):

  such B is equal to any A with an equal epoch and version (and any release);
  such B is greater than A if B's epoch-version is greater than A's;
  etc.

A similar treatment of an underspecified release on the side of
Provides (A) was unwanted and it has been changed now:

  a B with a non-empty release can't be equal to such A (with a
  missing release);
  namely, a B with a non-empty release is greater than an A with equal
  epoch-version and no release.

Example of a satisfied dependency (worked before and works now):

  Provides: N = V-R
  Requires: N = V

Example of an unsatisfied dependency (previously, this satisfied the Requires):

  Provides: N = V
  Requires: N = V-R

We don't want this Requires to be satisfied in this case.
2019-02-26 22:02:56 +03:00
4efd5e5f44 Fix some harmless compilation warnings 2014-02-15 22:44:35 +00:00
ee25cc084b regionSwab: fix potential miscompilation
header.c: In function 'regionSwab':
header.c:474:6: warning: operation on 'it' may be undefined [-Wsequence-point]
   *it++ = htonl(*it);
2014-02-15 22:42:58 +00:00
4134fc39ac Fix automake warnings
Makefile.am:13: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
build/Makefile.am:5: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
lib/Makefile.am:5: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
python/Makefile.am:7: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
rpmdb/Makefile.am:5: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
rpmio/Makefile.am:9: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
tools/Makefile.am:5: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
2014-02-15 22:19:47 +00:00
Panu Matilainen
683c0b8455 Sanity check region offset range on headerLoad()
- Fixes the  first case crash of RhBug:741606 / CVE-2011-3378 where
  immutable region offset is way out of bounds.
(cherry picked from commit a48f0e20cbe2ababc88b2fc52fb7a281d6fc1656)
2011-10-10 23:02:13 +00:00
Panu Matilainen
61ff739898 Sanity check region offset in regionSwab()
- Region offsets are supposed to be negative when when an entry
  is involved, otherwise zero. Fixes some cases of crash'n'burn on
  malformed headers having bogus offsets (CVE-2011-3378)
(cherry picked from commit 11a7e5d95a8ca8c7d4eaff179094afd8bb74fc3f)
2011-10-10 22:58:48 +00:00
Alexey Tourbin
7247ecbda7 rpmdb.c: do not exclude Requires(pre) dependencies from rpmdb index
It can be observed that, while packages require their dependencies,
the dependencies in turn are not always required by their packages:

$ rpm -qa --requires |awk '{print$1}' |sort -u |xargs rpm -q --whatrequires >/dev/null
warning: no package requires /bin/chgrp
warning: no package requires /bin/chmod
warning: no package requires /bin/mv
warning: no package requires /etc/rc.d/init.d/postfix
warning: no package requires /sbin/pidof
warning: no package requires /sbin/post_ldconfig
warning: no package requires /usr/bin/alt-docs-genextras
warning: no package requires /usr/bin/gpasswd
warning: no package requires /usr/bin/gtk-query-immodules-2.0
warning: no package requires /usr/bin/mkfontdir
warning: no package requires /usr/sbin/alternatives-update
warning: no package requires /usr/sbin/control-dump
warning: no package requires /usr/sbin/control-restore
warning: no package requires /usr/sbin/gconf_install_schema
warning: no package requires /usr/sbin/groupadd
warning: no package requires /usr/sbin/indexhtml-update
warning: no package requires /usr/sbin/post_service
warning: no package requires /usr/sbin/useradd
warning: no package requires /usr/sbin/usermod
warning: no package requires /usr/share/php/scripts/php_postin.sh
warning: no package requires dvdrwtools-control
warning: no package requires libguile-vhttpd
warning: no package requires php5-suhosin
warning: no package requires rpmlib(CompressedFileNames)
warning: no package requires rpmlib(PartialHardlinkSets)
warning: no package requires rpmlib(PayloadFilesHavePrefix)
warning: no package requires rpmlib(PayloadIsLzma)
warning: no package requires rpmlib(SetVersions)
warning: no package requires rpmlib(VersionedDependencies)
warning: no package requires x11presetdrv
$

This is because rpm removes "install prerequisites" from rpmdb index.
As a consequence, rpm will allow (but apt will not) to remove packages
with "not required" dependencies:

$ rpm -e --test x11presetdrv
$

This is possibly wrong, and it makes dependency optimization hard (e.g.
can't merge duplicate names with different flags).  Also, the code was
buggy: testing isInstallPreReq was not enough as it is not mutually
exclusive with isErasePreReq - e.g. Requries(pre,preun) dependencies
can be used in specfile.
2011-01-22 18:38:22 +03:00
Alexey Tourbin
42b139d1eb removed --fileid query selector and Filemd5s rpmdb index (rpm.org) 2011-01-22 17:35:13 +03:00
Alexey Tourbin
335d64cf5e header.c (headerFindI18NString): disable conversion when lang is "C" 2011-01-21 15:41:20 +03:00
Alexey Tourbin
0193cbf8b9 header.c (headerFindI18NString): avoid repeated getenv calls 2011-01-21 15:25:56 +03:00
Alexey Tourbin
a45456493b header.c (findEntry): replaced bsearch with custom routine
Headers normally have around 64 tags, which means bsearch will issue
6 callbacks, only to perform a single instruction (a->tag - b->tag).

This also removes a bogus piece of code.

Here is how these optimizations will impact apt.  I remove
/var/cache/apt/*.bin and run "apt-cache show rpm".

4.0.4-alt100.11:
3,630,479,716  PROGRAM TOTALS
399,285,303  ???:0x0000000000033150'2 [libc-2.11.3.so]
319,106,185  ???:strlen [ld-2.11.3.so]
242,215,488  ???:pkgCache::FindPackage(char const*) [libapt-pkg-libc6.9-6.so.2.1.0]
198,711,478  ???:memcpy [ld-2.11.3.so]
198,594,999  ???:0x0000000000071970 [libc-2.11.3.so]
195,473,223  header.c:regionSwab.clone.2 [librpmdb-4.0.4.so]
135,707,034  ???:strcmp [ld-2.11.3.so]
117,134,836  header.c:dataLength [librpmdb-4.0.4.so]
102,919,244  ???:0x00000000000710f0 [libc-2.11.3.so]
102,291,091  ???:stpcpy [libc-2.11.3.so]
 75,555,843  ???:bsearch [libc-2.11.3.so]
 68,014,424  ???:getenv [libc-2.11.3.so]

this commit:
3,093,300,624  PROGRAM TOTALS
319,106,185  ???:strlen [ld-2.11.3.so]
242,215,488  ???:pkgCache::FindPackage(char const*) [libapt-pkg-libc6.9-6.so.2.1.0]
197,663,758  ???:0x0000000000071970 [libc-2.11.3.so]
185,771,577  header.c:regionSwab.clone.2 [librpmdb-4.0.4.so]
136,263,419  ???:strcmp [ld-2.11.3.so]
111,934,199  ???:memcpy [ld-2.11.3.so]
102,399,027  ???:0x00000000000710f0 [libc-2.11.3.so]
102,291,091  ???:stpcpy [libc-2.11.3.so]
 95,231,406  header.c:dataLength [librpmdb-4.0.4.so]
 76,706,744  ???:0x0000000000033150'2 [libc-2.11.3.so]
 68,359,227  header.c:findEntry [librpmdb-4.0.4.so]
 68,014,424  ???:getenv [libc-2.11.3.so]
2011-01-21 15:24:54 +03:00
Alexey Tourbin
bb9e8fbede header.c (headerLoad): check if the header is already sorted 2011-01-21 03:28:12 +03:00
Alexey Tourbin
1c87e9b34f header.c (dataLength): optimize string array loops 2011-01-21 02:08:49 +03:00
Alexey Tourbin
dfd33329ab header.c (regionSwab): optimize htons and htonl loops 2011-01-21 01:24:06 +03:00
Mikhail Efremov
f92be4b40e Added SELinux support
Mostly backported from rpm-4.8
2010-08-24 16:59:07 +00:00
Alexey Tourbin
de60ab01a3 header.c: backported headerSetInstance() and headerGetInstance() from rpm.org
Header instance is its number in /var/lib/rpm/Packages database.
When a header comes from the database, it is sometimes useful to know
its instance (I need this to adjust verify.c:verifyDependencies() for
self-conflicting packages).  On the contrary, setting instance numbers
should happen only within librpmdb, which is why headerSetInstance()
comes with hidden visibility.
2010-08-22 02:16:02 +04:00
Alexey Tourbin
994c5675a8 further removed RPMDBI_DEPENDS 2010-07-12 10:02:00 +04:00
Alexey Tourbin
63da9b7043 rpmdb.c: make rpmdb index list hard-wired, remove unused require- and provideversion indexes
based rpm.org changes by Panu Matilainen:
fb2a6cb Make rpmdb index list hard-wired
e23a2bf Remove unused require- and provideversion indexes
2a52cc8 Remove unused _DBI defines
2010-04-21 11:52:25 +04:00
Panu Matilainen
afe7a56661 Remove ancient, unused code to filter duplicates on rpmdb rebuild
- enabling this as-is would be murderous to multilib systems
- getting duplicates in the db would be a bug elsewhere
2009-10-01 04:38:10 +04:00
Alexey Tourbin
6795a36bb1 great removal 2009-09-29 15:29:52 +04:00
Alexey Tourbin
23317f11b7 removed _noDirTokens (producing legacy filelist format)
Some code (e.g. apt/genpkglist) explicitly relies on the fact that
header file list is represented with baseNames+dirNames+dirIndexes
arrays.  Thus, generating legacy headers might have issues, and should
be disabled.
2009-06-17 06:32:18 +04:00
Alexey Tourbin
c57d3c753b fprint.h: turned entry.dirName into flexible array 2009-06-13 08:56:04 +04:00
Alexey Tourbin
d68195b463 fprint.c: renamed "ht" member to "dn2de" 2009-06-13 08:55:41 +04:00
Alexey Tourbin
1d7007eae4 fprint.h: moved struct fprintCache_s to fprint.c 2009-06-13 08:55:20 +04:00
dfa67f87c4 Generate strict intersubpackage dependencies in [E:]V-R[:D] format
* build/interdep.c: Generate new strict intersubpackage dependencies.
* build/reqprov.c (compare_deps): Make EVRs with DistTag stronger.
* rpmdb/legacy.c (providePackageNVR): Package provides [E]V-R[:D],
refactor and clean code up.

[ldv: Rewritten]
2019-01-10 23:20:03 +00:00
3cb012d5c3 Introduce headerNVRD()
It's similar to headerNVR() but also returns disttag.
2019-01-10 23:20:03 +00:00
9618b8946f Introduce parseEVRD()
It's similar to parseEVR() but also returns disttag.
2019-01-10 23:20:03 +00:00
e048944ef8 Use xasprintf 2019-01-10 23:20:03 +00:00
Alexey Tourbin
72ad101add 4.0.4-alt113
- Implemented limited support for large files: a 2GB+ file can now be packaged,
  but the total size of uncompressed cpio payload is capped at 4 GB.
- Automatically downgrade LZMA compression levels 7-9 -> 6 on small payloads.
2018-06-26 13:03:42 +03:00
Alexey Tourbin
4970509cb9 header.c: changed RPM_INT32_TYPE fmt %d -> %u
It seems that no integers stored in a header need to be interpreted
as signed integers; rpm.org uses PRIu64 for all RPM_NUMERIC_CLASS data.
2018-06-26 12:42:44 +03:00
Alexey Tourbin
355063e53f domd5: fall back to fd read loop on mmap failure
This completes support for building packages with 2G+ files, more or
less (packaging 4G+ files is still a distant goal).  I am able to build
a valid package with a 3G sparse file on both i586 and x86-64.  On i586,
though, such a package cannot be installed with rpm-4.0:

    error: unpacking of archive failed on file /usr/bin/6;5a70a676:
    cpio: write failed - File too large

I believe there is no obvious way to identify and mark such packages,
since rpmlib(LargeFiles) dependency is meant only for 4G+ files, which
require 07070X cpio entries.

Therefore, limited support for handling such packages shall be provided
for rpm-4.0 in branch p8 (there are issues other than simply enabling
AC_SYS_LARGEFILE).
2018-06-26 12:42:44 +03:00
e8c780c2b0 Disable build and install of unpackaged files
These are no longer packaged anyway, so no need to bother.
2017-01-14 13:42:53 +00:00
Alexey Tourbin
d141414717 db3.c (db3close): removed dobule close code (rpm5.org, RH#138589) 2009-04-23 16:48:19 +04:00
Alexey Tourbin
37bfe52994 rpmdb: include <db.h> and link with -ldb without configure check for now 2009-04-23 14:46:46 +04:00
Alexey Tourbin
2ec0a7bf9f rpmdb.c (rpmdbNextIterator): removed db1-related part 2009-04-23 13:57:36 +04:00
Alexey Tourbin
4657ef7c57 rpmdb.c (openDatabase): removed db1-related part 2009-04-23 13:57:15 +04:00
Alexey Tourbin
af4053bfa0 rpmdb: removed db1 support 2009-04-23 13:49:52 +04:00
Alexey Tourbin
1ea6ca8d22 rpmhash.c (hashEqualityString): bare strcmp call 2009-03-26 11:20:50 +03:00
Alexey Tourbin
6652e778ca rpmhash.c (hashBucket_s): added const and unsigned 2009-03-26 11:20:41 +03:00
Alexey Tourbin
34d8d48726 rpmhash.c: renamed findEntry to findBucket and made it inline 2009-03-26 11:20:34 +03:00
Alexey Tourbin
c204d6ad7a rpmhash.c: allocate hash table and its buckets in single chunk 2009-03-26 11:20:23 +03:00
Alexey Tourbin
732a880e8c fprint.h (fprintCacheEntry_s): removed isFake (unused) 2009-03-26 11:20:17 +03:00
Alexey Tourbin
6a2cc38410 fprint.c: fpCacheFree returns NULL 2009-03-26 11:20:07 +03:00
Alexey Tourbin
dba96abac5 deal with fpCacheCreate() size parameter 2009-03-26 11:19:53 +03:00
Alexey Tourbin
02104ae61f Use only one, global fingerPrintCache to save a lot of stat calls
[Based on rpm.org af80c3de by Florian Festi.]
2009-03-26 11:19:43 +03:00
Alexey Tourbin
a443927f78 fprint.c (fpHashFunction): use Jenkins hash 2009-03-26 11:19:30 +03:00
Alexey Tourbin
6d4fea769d jhash.h, rpmhash.c: switch to Jenkins One-at-a-time hash 2009-03-26 11:19:01 +03:00
Alexey Tourbin
6a9eae99c7 fprint.c: removed fpLookupHeader(), unused 2009-03-26 11:18:11 +03:00