Commit Graph

416 Commits

Author SHA1 Message Date
Mike Crowe a3652af66f Make configure cope with multiple users/groups with ID 0
If /etc/passwd contains multiple users with UID 0 then user_with_uid0 will
contain a line feed which results in config.h containing:

 #define UID_0_USER "root

(i.e. without a closing quote.)

The same problem occurs with /etc/group.

Let's only emit the first match in each case so that there is only ever a
single result.
2018-01-05 15:53:52 +02:00
Panu Matilainen c4fe194556 Check for getline() as a required function in configure
This became mandatory in commit aeb58f654a.
2017-11-09 16:13:20 +02:00
Panu Matilainen 8c4bfd74b5 Error out on --enable-ndb if system doesn't support mremap() (#334)
mremap() is Linux-specific, so ndb is effectively Linux-only.
2017-11-03 13:48:41 +02:00
Panu Matilainen 014246b050 Test for lsetxattr() presence, don't try building IMA plugin without it
Came up in PR #260 review, we shouldn't assume the presence of this
Linux-specific API.
2017-10-27 12:49:29 +03:00
Neal Gompa 48eed77980 configure: Fix typo for libcrypto usability check for OpenSSL check
The typo in this check prevents rpm for correctly detecting
compatibility with OpenSSL 1.0.2.
2017-10-16 10:03:28 +03:00
Panu Matilainen eef82b0e81 Less naive version of sync-after-transaction (RhBug:1461765)
If syncfs() is available (ie on Linux), only sync modified filesystems.
In order to do this, keep the diskspace information around throughout
the transaction.

Skip the sync entirely on chroot installations for now, but this
too should be configurable (always/auto/never or so).

There's a bit of a chicken-egg problem with post-transaction plugins:
for example systemd_inhibit should only be released after syncing,
but OTOH some other plugins might be performing actions whose results
should be syncing. Leaving it alone for now.
2017-09-07 12:01:39 +03:00
Panu Matilainen 80b5c12eaa Use pkg-config for figuring python cflags and libs
Simplifies things a bit and also makes "PYTHON=python3 ./configure" work,
whereas it previously barfed on figuring the library names like
"libpython3.6m"
2017-09-05 12:00:30 +03:00
Panu Matilainen d6be2e4312 Mark ndb and lmdb experimental in configure too
Nobody reads release notes, better carry the message here...
2017-09-01 14:03:39 +03:00
Jeff Johnson ed9de1992f Add LMDB backend to RPM
v2 (Neal Gompa)
  * Switch from RPM_CHECK_LIB to PKG_CHECK_MODULES
  * Fix notation of file name in lmdb.c
  * Remove MDB_FIXEDMAP flag to prevent portability issues
  * Add comment that lmdb is an option for %_db_backend

Closes: #281
Fixes: #128
2017-08-17 12:49:06 +03:00
Panu Matilainen 7e65bec67d Revert "Only build bundled fts if system has a bad version that doesn't handle LFS"
The subtle test is too subtle for its own good, this patch breaks
thirty six testcases on 32bit architectures.

This reverts commit 1eadabe445.
2017-08-10 20:15:02 +03:00
Panu Matilainen 2321badddc Bump version to appear newer than latest stable branch (4.14.x) 2017-08-10 10:52:33 +03:00
Jeff Johnson 3684424fe2 Add support for zstd compressed payload
v2 (Igor Gnatenko):
    * Switch off from RPM_CHECK_LIB
    * Reference zstd from rpm.pc
    * Link rpmio with zstd
  v3 (Florian Festi):
    * move changes to cvtfmode into separate patches
    * do not error out on wrong compression levels
    * ifdef out zstdio
    Closes: https://github.com/rpm-software-management/rpm/issues/256
    Closes: https://github.com/rpm-software-management/rpm/issues/297
    Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-08-09 17:41:03 +02:00
Mark Wielaard 0da5cab15a config: Detect major/minor warnings and include the correct system header.
glibc 2.25 introduced (really long and annoying) warnings for each use
of the major/minor macros from the wrong header:

lib/cpio.c: In function ‘rpmcpioHeaderWrite’:
lib/cpio.c:245:13: warning: In the GNU C Library, "major" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "major", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "major", you should undefine it after including <sys/types.h>.
     dev = major(st->st_dev); SET_NUM_FIELD(hdr->devMajor, dev, field);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Adjust the configure check to correctly detect the header to include
that doesn't produce those warning producing macros.

Tested against RHEL7 (glibc 2.17) and Fedora 26 (glibc 2.25).

Signed-off-by: Mark Wielaard <mark@klomp.org>
2017-07-21 15:35:18 +02:00
Panu Matilainen e9227ffb55 Check for libimaevm availability/usability in configure
Commit edd709e453 introduced a
dependency on ima-evm-utils >= 1.0, silently breaking build with
older versions that eg Fedora has. Explicitly test for sign_hash()
that takes all the necessary arguments and error out cleanly if
not present/too old.
2017-06-09 11:13:47 +03:00
Panu Matilainen a63bd11c16 Only librpmsign needs libimaevm, dont link to EVERYTHING... 2017-06-08 17:20:37 +03:00
Ayappan 2329af6667 Generalize primary user/group for platforms (#210) 2017-05-18 16:50:18 +03:00
Panu Matilainen 11323f335b Actually test for __progname too
Hopefully resurrecting whatever got broken by the round of changes
surrounding this, __progname is not an entirely glibc/linux thing.
2017-03-24 14:20:48 +02:00
Panu Matilainen 2a7e395f01 Determine setprogname() availability by actually testing for it
This way we dont need to include separate tests for the entire
BSD'ish family tree and who knows, might even cover some other
cases too.
2017-03-24 13:41:04 +02:00
Gleb Fotengauer-Malinovskiy 1eadabe445 Only build bundled fts if system has a bad version that doesn't handle LFS
Older versions of glibc included an fts implementation that didn't have
Large File Support on 32-bit systems.  We worked that around by bundling
fts into rpm codebase.  Thanks to Mark Wielaard, glibc >= 2.23 has LFS
support in fts.

Unfortunately, we can't drop bundled fts because we have to support
build with other libcs which do not implement fts at all or their
implementations do not provide Large File Support.

Signed-off-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>

[pmatilai: Added comment to configure.ac as the test is rather subtle,
           thanks for Mark Wielaard for the explanation]
2017-03-24 12:42:40 +02:00
Mark Wielaard 88989572ff debugedit: Support String/Line table rewriting for larger/smaller paths.
debugedit --base to --dest rewriting of debug source file paths only
supported dest paths that were smaller or equal than the base path
(and the size should differ more than 1 character for correct debug lines).
All paths were changed "in place". Which could in theory mess up debug str
sharing.

This rewrite supports base and dest strings of any size (some limitations,
see below). This is done by reconstructing the debug_str and debug_line
tables and updating the references in the debug_info attributes pointing
to these tables. Plus, if necessary (only for ET_REL kernel modules),
updating any relocations for the debug_info and debug_line sections.

This has the nice benefit of merging any duplicate strings in the
debug_str table which might resulting on slightly smaller files.
kernel modules are ET_REL files that often contain a lot of duplicate
strings.

The rewrite uses elfutils (either libebl or libdw) to reconstruct the
debug_str table. Since we are changing some section sizes now we cannot
just use mmap and rawdata to poke the values, but need to read in and
write out the changed sections. This does take a bit more memory because
we now also need to keep track of all string/line references.

There are still some limitations (already in the original debugedit)
not fixed by this rewrite:
- DW_AT_comp_dir in .debug_info using DW_FORM_string can not be made
  larger. We only warn about that now instead of failing. The only
  producer of DW_FORM_string comp_dirs is binutils gas. It seems simpler
  to fix gas than to try to support resizing the debug_info section.
- A DW_AT_name on a DW_TAG_compile_unit is only rewritten for DW_FORM_strp
  not for DW_FORM_string. Probably no problem in practice since this
  wasn't supported originally either.
- The debug_line program isn't scanned for DW_LNE_define_file which
  could in theory define an absolute path that might need rewriting.
  Again probably not a problem because this wasn't supported before
  and there are no know producers for this construct.

To support the upcoming DWARFv5 in gcc 7 (not on by default), we will
need to add support for the new debug_line format and scan the new
debug_macro section that can have references to the debug_str table.

Signed-off-by: Mark Wielaard <mark@klomp.org>
2017-03-06 15:17:20 +02:00
Stephen Gallagher 64028f9a1c Add OpenSSL support for digest and signatures
Autotools: add --with-crypto=openssl
This enables RPM to locate the appropriate flags for compiling
against OpenSSL for digest and hash functions.

This implementation changes the old behavior of
--with[out]-beecrypt toggling between beecrypt and nss. It will
now throw an error if attempting to use --with-beecrypt
indicating that the user should instead use --with-crypto=

See also:
https://github.com/rpm-software-management/rpm/issues/119
2017-02-16 11:26:55 +01:00
Mark Wielaard 3d4db6f99f Define AM_CFLAGS inside the Makefile.am files themselves.
Trying to include AM_CFLAGS through a configure generated rpm.am file
doesn't really work because at the time automake runs configure doesn't
exist yet to process rpm.am.in. Just define the AM_CFLAGS substitution
inside the Makefile.am files themselves.

Rename rpm.am.in back to rpm.am.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2016-12-09 11:35:38 +02:00
Panu Matilainen bd3eb21336 Stop messing with CFLAGS from configure
CFLAGS is a user variable that software is supposed to honor but not
touch, that's what AM_CFLAGS and friends are for. rpm.am is
included by all our makefiles so that's a handy place to set defaults
centrally, do so by AC_SUBST'ing the rpm cflags into AM_CFLAGS there.
2016-12-08 12:53:54 +02:00
Panu Matilainen 0584101e15 Unbreak gcc options checking
Commit c810a0aca3 changed the gcc flag
test to include a call to alloca() which at least on GCC 6.2 just
causes all the tests to fail with implicit declaration warnings
which are errors since we test with -Werror. Include <alloca.h>
to avoid the warnings and thus make the test functional again.
2016-12-08 10:09:35 +02:00
Neal Gompa c04ff511a0 configure.ac: Support detecting gpg2 for %__gpg and prefer gpg2
For a number of years, various Linux distributions (notably Fedora and
RHEL) have been overriding this to set it to use gnupg2, with no ill
effects. Now that most distributions are switching to gnupg2 by default,
we will, too.
2016-11-30 18:26:29 +01:00
James Knight c810a0aca3 configure.ac: correct stack protector check
If a used toolchain accepts the `-fstack-protector` option but does not
provide a stack smashing protector implementation (ex. libssp), linking
will fail:

 .libs/rpmio.o: In function `Fdescr':
 rpmio.c:(.text+0x672): undefined reference to `__stack_chk_fail_local'
 .libs/rpmio.o: In function `Fdopen':
 rpmio.c:(.text+0xce9): undefined reference to `__stack_chk_fail_local'
 .libs/rpmio.o: In function `ufdCopy':
 rpmio.c:(.text+0x10f7): undefined reference to `__stack_chk_fail_local'
 ...

This is a result of testing for `-fstack-protector` support using a main
that GCC does not inject guards. GCC's manual notes that stack protector
code is only added when "[functions] that call alloca, and functions
with buffers larger than 8 bytes" [1]. This commit adjusts the stack
protector check to allocate memory on the stack (via `alloca`).

[1]: https://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html

Signed-off-by: James Knight <james.knight@rockwellcollins.com>
2016-11-18 14:38:46 +01:00
Panu Matilainen 73a8f43b2b Bump version to appear newer than latest stable branch 2016-10-03 14:47:58 +03:00
Thomas Petazzoni b5f1895aae configure.ac: use link instead of compile for gcc flags test
The logic that tests whether gcc supports or not certain flags uses
AC_COMPILE_IFELSE(). However, when checking for stack smashing
protection support, an AC_LINK_IFELSE() test is needed, since the
build might work but not the link stage if certain libraries are
missing for proper stack smashing protection support.

Therefore, this commit switches to use AC_LINK_IFELSE().

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: James Knight <james.d.knight@live.com>
2016-09-12 23:33:02 -04:00
Mark Wielaard 10633641ec Fix libdw configure check.
commit a82119 "configure.ac: use LIBDW always conditionally" contained
a typo that caused WITH_LIBDW_LIB never to be set when you were using
libelf. Fixed by reverting the "!=" to "=" again.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2016-08-24 18:22:49 +02:00
Igor Gnatenko a82119bf35 configure.ac: use LIBDW always conditionally
References: https://bugzilla.redhat.com/show_bug.cgi?id=1365278
Reported-and-tested-by: Neal Gompa <ngompa13@gmail.com>
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-08-24 14:07:22 +02:00
Mark Wielaard bbfe1f86b2 Add build-id links to rpm for all ELF files.
This patch moves the main ELF file build-id symlinks from the
debuginfo package into the main package. And uses different
base directories for the main ELF file build-id symlink.
For the main build-id use /usr/lib/.build-id and for the debug
build-id use /usr/lib/debug/.build-id.

There are two reasons for doing this. The main package and the
debuginfo package might get out of sync, or the debuginfo package
might not be installed at all. In which case finding the main ELF
file through the build-id symlink becomes impossible. Secondly by
moving the main ELF build-id symlink in its own directory the
/usr/lib/debug directory gets populated with only debuginfo files
which is convenient if the user might want to have that directory
populated through a network mountpoint.

To support the new logic the symlink code has been moved from
find-debuginfo.sh to build/files.c.

This also includes support for a new config %_build_id_links that
defaults to compat. The other settings are none, alldebug (the old
style) and separate. compat is like separate, but adds a compatibility
link under /usr/lib/debug/.build-id for the main build-id symlink.

There are several new testcases added to test the various settings
using the new keyword "buildid".

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2016-07-29 18:28:53 +02:00
Mark Wielaard 9e64f8d5b7 configure --with-external-db should fall back to external if unspecified.
configure.ac implies that there is a fall back to the internal db if
no external one is specified or found. But that doesn't work since
with_external_db defaults to no when not --with[out]-external-db isn't
given. Fix that by defaulting to "maybe" and then after the check for an
internal db fails fall back to the external db.h if available.

This keeps the current behavior of defaulting to --without-external-db (no)
if nothing is specified, but falls back to trying with the external one if
there is no in tree internal db. Giving an explicit --with-external-db or
--without-external-db doesn't change and produces an error if no external
or no internal db is found.
2016-03-22 11:49:52 +01:00
Mark Wielaard 64b6cbbb44 Make sure CPPFLAGS are setup correctly for finding nspr.h
If we have pkgconfig make sure CPPFLAGS are setup correctly for the nss
-I include path. Otherwise the checks to find nspr.h will fail.
2016-03-22 09:51:38 +01:00
Peter Eisentraut 92ed1c43a4 Supply declaration of fdatasync if missing
OS X has the function but doesn't have a declaration for it.
2016-02-11 11:06:26 +01:00
Vít Ondruch 89d1dd0a7c Add RubyGems support.
Allow to expand RubyGems .gem file using regular %setup macro and in
addition generate also associated .gemspec file.
2015-11-12 10:51:30 +01:00
fin@linux.vnet.ibm.com 12e5e52242 Configure option to build with imaevm support
This patch adds a config option to build with libimaevm which is needed
for file signing.

Changelog:
- Add AM_CONDITIONAL WITH_IMAEVM

Signed-off-by: Lubos Kardos <lkardos@redhat.com>
2015-08-12 13:59:20 +02:00
Michael Schroeder b50d2adb3b Add experimental ndb database support
Use --enable-ndb for testing. Handle with care.
2015-07-16 17:20:51 +02:00
Lubos Kardos a283c737ed Eliminate leftover, macro HAVE_GETPASSPHRASE is not used any more. 2015-06-25 16:45:57 +02:00
Guillem Jover 148e82833a Use setexecfilecon() from libselinux instead of ad-hoc code
This function was factored out from rpm_execcon() upstream to make it
easier to use by its users, by making it not call execve() directly. It
is now also used by dpkg since 1.17.11.

Preserve the ad-hoc code for now so that it can be compiled against old
libselinux versions.
2015-02-16 11:24:10 +01:00
Panu Matilainen 35a7b29421 Add utf-8 validation to librpmbuild, take 1 (ticket #30, RhBug:948712, ...)
- This adds brutally simple utf-8 validation to spec parse & package
  construction: all string-class tags in headers are checked regardless
  of other tag semantics.
- Parse-time validation is optional via RPMSPEC_NOUTF8
  flag, but package construction time is required as we want to
  stomp RPMTAG_ENCODING to all packages that pass. What is always
  optional is whether non-valid utf-8 strings fail the build, defaulting
  to off (but distros probably want to enable it)
- Note we dont give a damn about the spec itself, only what ends up in
  packages: strings can come from numerous other sources than spec
  directly, and OTOH who cares if eg spec comments are non-utf?
2014-09-08 14:00:19 +03:00
Panu Matilainen 4c62ae4a5b Bump version to appear newer than 4.12.x branch 2014-08-27 11:38:09 +03:00
Panu Matilainen f8868f11d7 Check for sys/auxv.h header, always include if present
- We'll need this to access any HWCAP_* bits for platforms that need it,
  regardless of whether getauxval() is present or not. On glibc
  systems this is likely to be equivalent, on others dunno (Solaris
  appears to have sys/auxv.h header as well)
2014-06-27 10:24:07 +03:00
Panu Matilainen 713914bde1 Drop the experimental collection support
- The basic concept is not without merit but what was implemented here
  has been stuck in experimental state in middle of two sorta conflicting
  goals for four years now, and world has moved onward in the meanwhile.
  The sepolicy part is better handled in the new selinux plugin, and other
  action business belongs to packages (in the form of some trigger-like
  scripts or such) rather than rpm plugins.
- Deleted here, but the sepolicy plugin functionality still needs
  merging into the new selinux plugin...
- RPMTAG_COLLECTIONS left in place but tagged unimplemented as per policy
  to never actually remove tags
2014-06-17 16:27:24 +03:00
Michael Schroeder 13a1ef9fb5 Add a %_rundir macro to the platform files.
The default value is /run, it can be changed with the --with-rundir
configure option.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2014-05-07 09:12:46 +03:00
Panu Matilainen d07af12947 Use pax format for dist tarballs.
- Last year somebody decided that uid/gid stored in automake'd archives
  is somehow important, causing ustar format to be unusable with large
  uid/gid :(
  https://lists.gnu.org/archive/html/automake/2013-02/msg00075.html
2014-04-07 12:47:55 +03:00
Panu Matilainen 48e94a1247 Dont bother looking for platform specific dependency generator scripts
- These scripts fell out of fashion more than ten years ago...
2014-03-31 17:01:05 +03:00
Florian Festi d24a1f8eec Add rpm2archive utility for converting rpm payload to tar archives.
This is needed as the new payload format for large files is not compatible with
rpm2cpio which basically just dumps the payload which happened to be cpio.

Use configure parameter --without-archive to not build this tool and get rid of the libarchive requirement.
2014-03-11 10:49:55 +01:00
Ville Skyttä e4191162e1 Search for 7za and 7z for 7-zip.
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2013-08-15 07:44:48 +03:00
Kirill A. Shutemov 60835b2018 Use getauxval(3) to read auxv data
glibc >= 2.16 provides getauxval(): a reliable way to retrieve a value
from the auxiliary vector. It doesn't rely on /proc filesystem.

Let's switch to it and get rid of /proc dependency.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2013-07-02 12:43:53 +03:00
Panu Matilainen 7c8faacf0d Remove bundled mergesort() copy, use one from the system if available
- The mergesort() implementation we've carried all this time (even if
  not compiled in when glibc is used) is one with the nasty BSD
  advertisement clause, ugh. Better remove it late than never,
  but let systems having mergesort() in their system libraries
  (such as OSX) use it instead of qsort().
2013-03-19 08:25:14 +02:00