Commit Graph

2170 Commits

Author SHA1 Message Date
Panu Matilainen
94ea8d6916 Always initialize tagflags to RPMSENSE_ANY
(cherry picked from commit 1ab0222b032d510f331cefa83fb0172673f89083)
2010-03-29 05:27:35 +00:00
Panu Matilainen
6d9d4fed64 Generate preamble tag lengths at build time and make it const
(cherry picked from commit 317533ce3134d05fc9f30fb29238d3fb2ed4bc6b)
2009-06-01 11:45:44 +00:00
a5760b4e0e 4.0.4-alt124
- addReqProv: fixed too aggressive merge of PreReqs introduced
  in 4.0.4-alt122.
- Applied llvm changes (by lakostis@; closes: #34671):
  + cpp.req: skip cpp checks for llvm;
  + verify-elf: bypass lint checks by request.
2019-01-14 00:32:44 +00:00
df7b7503b8 addReqProv: do not merge PreReqs with incompatible requirements
PreReqs differ from regular requirements, they need special treatment.
Also do not add RPMSENSE_FIND_REQUIRES unnecessarily.

Fixes: 4.0.4-alt122~2 ("addReqProv: implement dep flags merge")
2019-01-13 22:39:58 +00:00
Konstantin A. Lepikhov
d093bb9f0d cpp.req: skip cpp checks for llvm
Skip any cpp checks for llvm packages, anyway we don't know how to deal
with them.

Signed-off-by: Konstantin A. Lepikhov <lakostis@altlinux.ru>
2019-01-13 22:39:58 +00:00
Konstantin A. Lepikhov
169f3ece9a verify-elf: bypass lint checks by request
lld linked binaries differ by structure from GNU ld, so eu-lint will
always complaint about.  Allow to skip those checks by passing
%set_verify_elf_method lint=(skip|no)

Signed-off-by: Konstantin A. Lepikhov <lakostis@altlinux.ru>
2019-01-13 22:39:58 +00:00
dec047fee1 4.0.4-alt123
- Dropped %_allow_deps_with_beginning_dot support
  (introduced in 4.0.4-alt119).
2019-01-10 23:20:03 +00:00
f438f6b5df Revert "Add macro to allow dependencies beginning with a dot character in spec file"
These odd dependencies are no longer generated.

This reverts commit 443060d11a.
2019-01-10 23:20:03 +00:00
41f81eaa9c 4.0.4-alt122
- Dropped $RPM_STRICT_INTERDEPS support
  (introduced in 4.0.4-alt110).
- Made name, version, release, and disttag check stricter
  (by vseleznv@ and me).
- Changed the generator of package self-provides
  and the generator of strict intersubpackage dependencies
  to use [E:]V-R[:D] format instead of [E:]V-R
  (by vseleznv@ and me).
- addReqProv: implemented dep flags merge:
  when a stronger requirement is added while a weaker one already exists
  with incompatible flags, try to merge these flags to produce a new
  stronger requirement.  For example,
  "PreReq: %name = %version" + "Requires: %name = %version-%release"
  now results to "PreReq: %name = %version-%release".
2019-01-10 23:20:03 +00:00
b6be32e87e spec: downgrade "PreReq: librpmbuild = %version-%release" to Requires
as there seems to be no reason to use PreReq here.
2019-01-10 23:20:03 +00:00
bb2ead6131 addReqProv: implement dep flags merge
When a stronger requirement is added while a weaker one already exists
with incompatible flags, try to merge these flags to produce a new
stronger requirement.

For example,
"PreReq: %name = %version" + "Requires: %name = %version-%release"
now results to "PreReq: %name = %version-%release", and
"PreReq: %name = %EVR" + "Requires: %name = %EVRD"
now results to "PreReq: %name = %EVRD".
2019-01-10 23:20:03 +00: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
fa25b864cd Revert "build/interdep.c: add upgradeInterdep function"
This kind of interpackage dependencies appeared to be problematic.

This reverts commit f4d876f935.
2019-01-10 23:20:03 +00:00
75893575d7 build/parsePreamble.c: backport rpmCharCheck() from rpm-4.13.0.1-release
Backport rpmCharCheck() from rpm-4.13.0.1-release, replace rasprintf()
and risalnum() with asprintf() and isalnum() respectively, check
VERSION and RELEASE tags against whitelisted characters.  The whitelist
only contains all alphanumeric symbols as well as "._+" symbols.

[ldv:
 Rewritten, all code from rpm is terrible.
 Extended to NAME and DISTTAG.]
2019-01-10 23:20:03 +00:00
e048944ef8 Use xasprintf 2019-01-10 23:20:03 +00:00
5e8afe3990 Introduce xasprintf
As asprintf() tends to be used without proper error checking,
introduce xasprintf() that does the necessary error checking itself.
2019-01-10 23:20:03 +00:00
db62fbdc5a tools: build dump_ld_config and filesize with -D_FILE_OFFSET_BITS=64
... because they use stat().
2019-01-10 23:20:03 +00:00
17184e3759 4.0.4-alt121
- verify-elf: disabled stack verification and elflint on RISC-V (arei@).
- platform.in: removed harmless bash4 noise from %filter_from_* macros
  (closes: #35803).
2018-12-21 03:20:01 +00:00
133654713d platform.in: remove harmless bash4 noise from %filter_from_* macros (ALT#35803) 2018-12-21 03:20:01 +00:00
Nikita Ermakov (0x90)
835d775268 Disable stack verification and elflint on RISC-V 2018-12-20 11:46:01 +00:00
95a1edd1ce 4.0.4-alt120
- lib.prov, lib.req: enhanced ProvidedSymbols (glebfm@ and me).
- Added ppc64le support (glebfm@).
2018-12-16 23:44:22 +00:00
Gleb Fotengauer-Malinovskiy
4f4a1d1465 lib.prov, lib.req: enhance ProvidedSymbols
This enhances ProvidedSymbols() in two ways:
* fixes st_shndx check for the case when it is not $7 in
"readelf --wide --dyn-syms" output as it happens on some architectures
like ppc64le;
* filters out special symbols (__bss_start, _edata, _end, _fini, _init)
after stripping of versioning.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-12-16 23:09:47 +00:00
Gleb Fotengauer-Malinovskiy
3081d856c6 Add ppc64le support 2018-12-04 14:52:42 +03:00
Gleb Fotengauer-Malinovskiy
aa125cd61d 4.0.4-alt119
- Add _allow_deps_with_beginning_dot macro to allow dependencies
  beginning with a dot character (such as ones generated by replaceDeps
  function) in spec file (vseleznv@).
2018-10-03 14:41:25 +03:00
443060d11a Add macro to allow dependencies beginning with a dot character in spec file
After commit f4d876f93 rpm-build may generate dependencies beginning
with a dot character, but spec parser refuses such dependencies.
rpmrebuild fails to rebuild packages with such dependencies because it
builds packages with rpmbuild from generated spec files.
2018-10-03 14:33:17 +03:00
a2f575f8e4 4.0.4-alt118
- Added support for RPM_ADD_CHANGELOG_{NAME,TEXT,TIME} environment variables.
2018-09-24 18:07:32 +03:00
d831a6ed9a Add support for $RPM_ADD_CHANGELOG_{NAME,TEXT,TIME}
If all these environment variables are set, an entry based on their
contents is added to the changelog of source and all binary packages.
2018-09-24 18:07:32 +03:00
9d1b68fa8e 4.0.4-alt117
- 0common-files.req.list: removed /etc/syslog.d/.
2018-08-28 18:05:40 +00:00
6feb190125 0common-files.req.list: remove /etc/syslog.d
Since /etc/syslog.d has been moved from syslog-common to filesystem,
there is no need to keep /etc/syslog.d in the list.
2018-08-28 18:05:40 +00:00
f5ef46abda 4.0.4-alt116
- Removed alternatives from requirements.
2018-07-26 15:10:02 +00:00
Gleb Fotengauer-Malinovskiy
9d1cffa66c 4.0.4-alt115
- rpmrc: added mips64* and mips*r6 support.
- verify-elf: disabled stack verification and elflint on mips* (iv@).
- Fixed installation of platform macros on armh arch.
2018-07-26 18:10:02 +03:00
Ivan A. Melnikov
c038a07d61 Disable stack verification and elflint on mips*
Most of the binaries on mipsel do not contain the stack section,
so this check is not relevant for that architecture. Morover,
it fails, since it can't find the stack section, which is
(rightfully) not present.

eu-elflint does not understand mipsel binaries currently,
so here we disable that check, too.
2018-07-26 17:44:30 +03:00
Gleb Fotengauer-Malinovskiy
f835720d35 rpmrc: аdd mips64* and mips*r6 support 2018-07-26 17:44:30 +03:00
Alexey Tourbin
50f7517a73 4.0.4-alt114
- cpio.c: Fixed the conversion of 8-digit hex file sizes from cpio header.
  Packages with a 2GB+ file should now be installable.
2018-06-30 15:59:44 +03:00
Alexey Tourbin
691451d42e 4.0.4-alt101.M80P.3
- cpio.c: Fixed the conversion of 8-digit hex file sizes from cpio header.
  Packages with a 2GB+ file should now be installable.
2018-06-30 15:56:09 +03:00
Alexey Tourbin
3d9823b9a4 cpio.c: fixed the integer conversion involving cpio file size
The code in question uses an improvised "strntoul" function (hidden
behind the GET_NUM_FIELD macro) which returns "int".

int cpioHeaderRead(FSM_t fsm, struct stat * st)
...
    GET_NUM_FIELD(hdr.filesize, st->st_size);

When a file size undergoes an "int bottleneck", it cannot be safely
converted back to an unsigned 64-bit integer.  By the C rules, if the
size is in the range 2G..4G-1, int becomes negative (or this may be
undefined behaviour already, I'm not a language lawyer), and conversion
to unsigned 64-bit is performed as if by adding 2^64 to the negative
value.

So you get a huge 64-bit file size.  Funnily enough, if you truncate it
to 32 bits, it's back to normal!  That's why things worked with 32-bit
size_t.

static int expandRegular(/*@special@*/ FSM_t fsm)
...
    size_t left = st->st_size;
2018-06-30 15:36:24 +03: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
5c202f0b50 4.0.4-alt101.M80P.2
- 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 12:54:10 +03:00
Alexey Tourbin
e854592c75 rpmio.c: updated lzma compression set-up 2018-06-26 12:42:44 +03:00
Alexey Tourbin
4d777d01d2 changed a few more vars int -> uint32_t/size_t
This is probably the last change of such kind.  There are many other
instances left, and fixing them all is hopeless.  On the other hand,
the way mod 2^32 arithmetic works, although technically not always
well defined, is to our advantage.  I suggest that only user-visible
discrepancies further be fixed.

The following comparison to st_size looks particularly bad.
The code turns out to be unused!

lib/signature.c:
> verifySizeSignature(const char * datafile, int_32 size, /*@out@*/ char * result)
> [...]
>     if (size != st.st_size) {
>         sprintf(result, "Header+Archive size mismatch.\n"
2018-06-26 12:42:44 +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
5eb85a7a5e signature.c: change file size fmt %d -> %zu
Some of the preceding code is probably undefined or unspecified behavior,
but there's no easy way to fix it other than rewriting, which I'm not
going to do.  Surprisingly enough, the code just happens to work, due to
a series of mutual cancellations mod 2^32.  As they say in Russian,
the war will write off all.  Likewise, mod 2^32 arithmetic can write off
a multitude of sins (James 5:20).

> static inline rpmRC checkSize(FD_t fd, int siglen, int pad, int datalen)
[...]
>     int delta;
[...]
>     delta = (sizeof(struct rpmlead) + siglen + pad + datalen) - st.st_size;

Here, the expression in parentheses yields a different numeric value
depending on whether datalen is signed or unsigned.  However, when delta
is finally truncated to 32 bits, the result turns out to be the same.

>     switch (delta) {
>     case -32:	/* XXX rpm-4.0 packages */
>     case 32:	/* XXX Legacy headers have a HEADER_IMAGE tag added. */
>     case 0:
2018-06-26 12:42:44 +03:00
Alexey Tourbin
7db1d19fd8 verify.c: fixed RPMVERIFY_FILESIZE for 2G+ files
The diff context is just big enough to see what happens.
RPMTAG_FILESIZES are interpreted as signed integers, and st_size which
has type off_t is also signed.  So the 32-bit file size form the header
gets sign-extended, after which the equality to st_size does not hold.
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
Alexey Tourbin
d410a87e93 configure.ac: enabled large-file support
This turns out to be a bit easier than I thought yesterday.  When mmap
fails in lib/fsm.c, it falls back to file descriptor IO.  So by simply
enabling AC_SYS_LARGEFILE, I'm already able to package a 3G file, which
can be written like this:

perl -e 'seek STDOUT,3<<30,0 and print 1 or die' >out
2018-06-26 12:42:44 +03:00
Alexey Tourbin
3df35b4d63 build/pack.c: automatically downgrade lzma levels 7-9 on smaller inputs 2018-06-26 12:42:44 +03:00
Alexey Tourbin
d85641818b build/pack.c: pre-calculate cpio archive size, fail gracefully on >= 4G
The nearest goal is to be able to package files up to 4G, on both 32-bit
64-bit architectures, provided that cpio payload size also does not
exceed 4G.  More specifically, the limit is 2^32-2, while 2^32-1 remains
special (this is not my own invention, I adopt it from rpm.org).

If the limit is exceeded, rpmbuild should fail gracefully instead of
writing malformed packages with truncated integer tags.

(Supporting 4G+ files is a distant goal - neither rpm-4.0 nor apt-rpm
can handle them yet.  Besides, it's not clear if producing such big
packages is even a good idea, unless one wishes to package p0rn.)
2018-06-26 12:42:44 +03:00
Alexey Tourbin
a1a075caa2 rpmio: fixed Fwrite() truncated return value
This is the reason why files >= 2G could not be added to cpio, even on
64-bit architectures.  Fwrite was called with a buffer >= 2G, but the
return value was truncated to int (this narrowing conversion is probably
undefined behavior already; what happens next, though, is that after
casting to size_t it assumes a very big numeric value of >= 2^64-2^32).
So rpmbuild was failing with an unrelated errno, "cpio: write failed -
Bad file descriptor".

There are other reasons why this still won't work on 32-bit architectures.
For one, rpmbuild mmaps a file before feeding it to cpio, and 32-bit
architectures have a very limited ability, if any, to mmap 2G+ files.
2018-06-26 12:42:44 +03:00