Commit Graph

2146 Commits

Author SHA1 Message Date
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
Gleb Fotengauer-Malinovskiy
fb0d6bde07 4.0.4-alt112
- imz@:
  + Turned on running %__find_{conflicts,obsoletes} if they are defined.
  + shell.req.files: included #!/usr/bin/env sh.
  + verify-elf: allowed standalone use (without failing due to grep's status).
- macro.c: increased maximal macro depth.
- Introduced %_libsuff and %_is_libsuff macros.
- Added support of mips{,n32,64}{,el}, riscv64, and s390x targets.
- Added non-lfs symbols from librt.so.1 library to verify_lfs check.
- Filtered string functions from the list of non-lfs symbols.
2018-06-08 16:20:31 +03:00
11db8f897a spec: fix typo in %changelog 2018-05-29 13:13:20 +03:00
Gleb Fotengauer-Malinovskiy
e9dcdf727e Introduce mips{,n32,64}{,el}, riscv64, and s390x architectures 2018-05-29 13:13:20 +03:00
Gleb Fotengauer-Malinovskiy
0ca04d42f3 Introduce %_libsuff and %_is_libsuff macros
Previously one who wanted to use only suffix from %_lib macro (without
'lib' prefix) had to either strip it with shell or try to guess it
from %_lib macro.
New macros allow to simplify library suffix logics in spec files:
* %_libsuff is always defined (to %nil on targets where %_lib = lib);
* %_is_libsuff is defined only on those targets where suffix
is not empty (it is useful for %{?...} expressions).
2018-05-29 13:12:26 +03:00
Gleb Fotengauer-Malinovskiy
62acbd59d6 macro.c: increase maximal macro depth 2018-05-24 16:19:11 +03:00
Ivan Zakharyaschev
ea7ca90347 verify-elf(get_verify_policy): fix whitespace 2018-05-23 17:02:10 +03:00
Ivan Zakharyaschev
5b30923d48 (.spec) install -m0755 is the correct use not to inherit other mode bits
(Also a tiny tweak: install -T is safer because the destination could
be an existing directory.)
2018-05-23 17:02:10 +03:00
Ivan Zakharyaschev
4347c5f9d0 turn on running %%__find_{conflicts,obsoletes} if they are defined 2018-05-23 17:00:54 +03:00
Ivan Zakharyaschev
c8d9060245 shell.req.files: include #!/usr/bin/env sh 2018-05-23 17:00:54 +03:00
Ivan Zakharyaschev
67ec541700 verify_rpath(): distinguish grep's failure and a normal valid case
Previously (according to the exit statuses):

0. if something strange was found in $rpath, an error was reported;
1. if nothing strange was found, no error was reported;
2. if grep failed, it looked like the previous case and no error was
reported (as if $rpath was valid).

Now, the pipe (and the whole script) would abort on grep's failure.
2018-05-23 17:00:54 +03:00
Ivan Zakharyaschev
b491c783f6 verify_stack(): distinguish failures and a normal status of grep
Now, if something fails, the pipe (and the function, and the whole
script) will fail.

If the exit codes are normal, they are handled according to our logic.

Previously, a failure (which is an exceptional rare case) would lead to:

1. skipping the further exe_stack check and error_strict STACK "$f" 'STACK entry not found'
2. silently skipping the exe_stack check (which was impossible anyway because of the failure)
2018-05-23 17:00:54 +03:00
Ivan Zakharyaschev
cdefa4ab34 verify-elf(verify_unresolved): correctly treat grep's status, allow standalone use
The pipe (and the function, and the whole script) would fail when the
resulting constructed rpath was empty. But usually at least
$RPM_VERIFY_ELF_LDD_RPATH is not empty, so the bad behavior has not
been observed.

However, when verify-elf is used standalone, $RPM_VERIFY_ELF_LDD_RPATH
is empty indeed, and this improvement becomes important.

Before this improvement:

$ RPM_BUILD_ROOT=/home /usr/lib/rpm/verify-elf /bin/pwd; echo $?
1

After this improvement:

$ VERIFY_ELF_UNRESOLVED=strict RPM_BUILD_ROOT=/home /usr/lib/rpm/verify-elf /bin/pwd; echo $?
0
$ VERIFY_ELF_UNRESOLVED=strict RPM_BUILD_ROOT=/home /usr/lib/rpm/verify-elf /usr/lib64/python3/site-packages/_cffi_backend.cpython-35m.so; echo $?
verify-elf: ERROR: /usr/lib64/python3/site-packages/_cffi_backend.cpython-35m.so: undefined symbol: PyExc_SystemError
....
1
2018-05-23 17:00:54 +03:00
e687e8df8d 4.0.4-alt111
- ldd: changed to try interpreters listed in /usr/bin/ldd.
- platform: changed %__nprocs to use nproc(1) instead of /proc/stat.
2018-05-22 00:09:29 +00:00
0fa98ef233 platform.in: change %__nprocs definition to use nproc(1) instead of /proc/stat
nproc(1) based approach has two advantages over /proc/stat based
calculations.  Firstly, nproc(1) uses sched_getaffinity(2) and therefore
is not affected by /proc availability.  Secondly, nproc(1) outputs
the number of processors actually available which may be less than
the number of online processors.

nproc(1) was introduced in coreutils-8.1.
2018-05-22 00:09:29 +00:00
30d9979184 ldd.in: try interpreters listed in /usr/bin/ldd
When the given ELF file doesn't specify PT_INTERP, e.g. if it's a shared
library, we have to guess it.  We used to try the program interpreter
of dump_ld_config, but it doesn't work well enough in multilib
environments, so extend the guess by trying interpreters listed
in RTLDLIST from /usr/bin/ldd script.
2018-05-15 17:26:10 +00:00
Ivan Zakharyaschev
e8c7bc4453 find-package.in: group the pruned packages nicer in the list 2018-05-15 17:26:10 +00:00
6d004bec60 4.0.4-alt110
- Added support for RPM_STRICT_INTERDEPS environment variable.
2018-04-26 01:55:36 +03:00
f4d876f935 build/interdep.c: add upgradeInterdep function
If RPM_STRICT_INTERDEPS environment variable is set and not empty, this
function replaces every strict requirement on NEVR with
".${RPM_STRICT_INTERDEPS}-NEVR", and adds to every package which
provides NEVR ".${RPM_STRICT_INTERDEPS}-NEVR" provide if some other
package requires this ".${RPM_STRICT_INTERDEPS}-NEVR".

This is needed to able to build a source package to different repo
branches with the same NEVR, and to rebuild the source package as well
with same NEVR within one branch and avoid interdep collisions.
2018-04-18 22:51:40 +03:00
Andrew Savchenko
6ea70e0bdd
4.0.4-alt109
- Add e2k arch and subarches:
  - Modify installplatform for e2k.
  - Add e2k arch, subarches and all macros for them.
- Tag changes (by vseleznev):
  - Add RPMTAG_IDENTITY, RPMTAG_AUTOINSTALLED.
  - respect device ID when remap inodes.
2018-03-27 20:41:56 +03:00
e3dc95bf3a
Add RPMTAG_IDENTITY
This tag represents binary package build characteristic: if two binary
packages have equal RPMTAG_IDENTITY values, it means that these packages
have no significant differences.

One of the applications of RPMTAG_IDENTITY is reproducible build
verification.

Signed-off-by: Vladimir D. Seleznev <vseleznv@altlinux.org>
2018-03-27 20:37:32 +03:00
037fdfe204
Add RPMTAG_AUTOINSTALLED
This tag is needed to track automatically installed packages with
rpmdb.  Zero value means that a package was installed manually, other
values mean that the package was installed automatically as some else
package dependency.

Signed-off-by: Vladimir D. Seleznev <vseleznv@altlinux.org>
2018-03-27 20:37:32 +03:00
7161802b38
respect device ID when remap inodes
The inode collision probably would never have happened (especially in
chroot environment), but this make the code more correct.
2018-03-27 20:37:22 +03:00
Andrew Savchenko
24867100ca
Modify installplatform for e2k.
Signed-off-by: Andrew Savchenko <bircoph@altlinux.org>
2018-03-26 20:52:52 +03:00
Andrew Savchenko
b711c76819
Add e2k arch, subarches and all macros for them.
Signed-off-by: Andrew Savchenko <bircoph@altlinux.org>
2018-03-26 20:39:57 +03:00