Commit Graph

126 Commits

Author SHA1 Message Date
Neal Gompa (ニール・ゴンパ) ff43da89ab Add all the BSDs that support setprogname() and getprogname() 2016-02-15 10:08:25 -05:00
Peter Eisentraut 0d74691d37 Additional fixes for getprogname()/setprogname() on BSD systems 2016-02-15 15:57:55 +01:00
Florian Festi ad5ab9cf07 White space fixes 2016-02-11 14:08:58 +01:00
Kamil Rytarowski 61109446ac Reimplement setprogname() and getprogname() to be generic and portable
The RPM code contains setprogname()/getprogname() support implemented through compatiblity layer with very old GLIBC (internals supported back to '95 and earlier), before stabilization of the GNU C library. This compatiblity layer (__progname, __assert_progname, setprogname()) is supposed to support well archaic GLIBC, but on the other hand it pollutes the library namespace and introduces unpredicable compillation errors on BSD systems.

The functions setprogname() and getprogname() are natively supported in NetBSD and work the same way as __progname from the GNU C library (they are even implemented in the same way - but with a slightly changed logic). The support for very old (20 years and older) GNU C Library is obfuscating the code, because it uses defines over defines without a word of explaination why to do so.

It's important to note that the setprogname()/getprogname() was inconstiently implemented in the codebase, duplicating the code and/or functionality.

Add new generic functions getprogname() and setprogname() and bind it to:
- the current and for two decades stable GNU LIB C implementation,
- the current NetBSD implementation (introduces to NetBSD in 2002),
- fallback reimplementation functions of the setprogname() and getprogname() functionality for other systems.

Don't support anymore old GNU Lib C internals and don't support older NetBSD systems, as they aren't supported for many years.

Add to the codebase comments explaining the relevant codeparts.
2016-02-11 14:05:25 +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
Thierry Vignaud c080226a60 add short summaries to headers that miss one 2016-01-28 14:42:47 +01:00
Panu Matilainen b5e3e1efee Eliminate built-in selinux support. RIP.
- We hereby unceremoniously declare that from now on, SELinux and
  other similar mechanisms are to live in plugins, rpm doesn't need
  to know about every possible security etc mechanism there might be.
  Its a big commit but as its really just removals...
- We need to disable sepolicy collection plugin for now as it relies on
  built-in support for selinux, this not only makes no sense but
  wont work now that there is no built-in support. The sepolicy
  plugin needs to be merged into the selinux base plugin now.
- Another "breakage" is that --rebuilddb no longer relabels the database,
  this needs plugins to called in a place where they currently cannot
  be called. This needs to be resolved before next actual release.
2013-03-21 13:56:33 +02:00
Panu Matilainen 49519f2564 Acommodate to glibc 2.17 __secure_getenv() renaming
- glibc 2.17 renames __secure_getenv() to secure_getenv() so now we
  need to test for both. Meh.
2013-01-28 18:53:12 +02:00
Panu Matilainen bf088dbeb5 Bury our glob() implementation entirely inside rpmglob.c (RhBug:819680)
- Lump glob.h and glob.c into rpmglob.c in all their g(l)ory libc
  decorations and make everything static to stop overriding system
  library symbols with our own glob().
2012-05-31 16:46:40 +03:00
Ales Kozumplik 7a8b75d266 selinux: reopen label between transactions if necessary (RhBug: 746073) 2012-01-12 14:27:36 +01:00
Steve Lawrence 34b5d67c2d Use selabel interfaces instead of matchpathcon
This replaces the old matchpathcon interfaces with the new selabel
interfaces for relabeling files, storing an selabel handle in the
transaction set.

With this change, also comes an added distinction between --nocontexts
being specified and a failure to read the load file contexts.
Previously, there was no distinction, and both cases used the
RPMTRANS_FLAG_NOCONTEXTS flag.

However, with the new policy plugin, it is necessary to make such a
distinction. This is because matchpathcon_init (now selabel interfaces)
can fail at the beginning of the transaction, but succeed later after
new policy is installed. Because of this, we may need to enable/disable
RPMTRANS_FLAG_NOCONTEXTS multiple times. However, because this flag
could also mean --nocontexts, we cannot do that. By storing the selabel
handle in the rpmts, we can easily keep track if the handle has been
successfully created, rather than overloading RPMTRANS_FLAG_NOCONTEXTS
with two meanings.
2010-09-01 09:30:51 +03:00
Steve Lawrence 04bdec775a Add plugin calling support
This patch adds a simple plugin system that makes simple problems easy to
solve, and difficult problems, such as SELinux, possible.

When the transaction gets to the point where a collection action should occur,
it expands a macro of the form %__collection_<collection name> to get the path
to a plugin and any additional options. The plugin is dlopen'ed, and the
appropriate function is called in the plugin, with the additional arguments
passed in.

This also adds a --nocollections option to disable performing Collection
actions.
2010-06-22 11:12:43 +03:00
Panu Matilainen 05b2d979e8 Move <stdio.h> includes out of system.h to the places that need it 2010-01-05 16:06:02 +02:00
Panu Matilainen 71b7fb380b Lose <sys/types.h> and <sys/stat.h> includes from system.h
- these seem to be already included where needed through rpm's public
  header needs
2010-01-05 16:01:46 +02:00
Panu Matilainen 8fe27d49e1 Move <ctype.h> include out of system.h to the places that need it 2010-01-05 15:33:47 +02:00
Panu Matilainen dd58384ede Move <errno.h> include out of system.h to the places that need it 2010-01-05 15:25:31 +02:00
Panu Matilainen e3638c2c86 Remove <string.h> include from system.h into the few places that still need
- most of the places get it through <rpm/rpmstring.h> already
2010-01-05 15:17:34 +02:00
Panu Matilainen dab8a648db Loose string header compatibility goo
- <string.h> is required by C standard, we dont support ancient
  non-conformant compilers anyway
2010-01-05 15:09:08 +02:00
Panu Matilainen 0c15e5feb3 Include <stdlib.h> as necessary instead of system.h
- also loose the related ancient compatibility goo
2010-01-05 15:04:20 +02:00
Panu Matilainen 729aac4d7a Shove the mount entry include voodoo where sun doesn't ... <cough> fs.c 2010-01-05 14:39:04 +02:00
Panu Matilainen 53ab541984 Remove unnecessary NLS definitions from system.h
- all uses of dgettext() and friends are already protected by
  appropriate ifdef's, no need to provide dummy defines here
- setlocale() and <locale.h> are required by C89, C99 and POSIX .. assume
  its there and if not, one can disable the whole thing with --disable-nls
2010-01-05 14:29:48 +02:00
Panu Matilainen 6109d6388e Remove libcap stuff out of system.h
- just a few places need, avoid polluting everything with it
- make fsm->fcaps void * to avoid having to deal with fcap_t not defined
2010-01-05 13:29:52 +02:00
Panu Matilainen c50b63ba02 Remove unused selinux dummy defines 2010-01-05 12:51:56 +02:00
Panu Matilainen e10e807ce9 Move <mcheck.h> include out of system.h to the couple of places that care
- only two real users inside rpm
- remove mcheck foo from rpminject and rpmsort, we're not interested...
2010-01-05 12:36:37 +02:00
Panu Matilainen 2c6120755c Unconditionally include <sys/wait.h> where needed
- no point conditionalizing what we cant live without
2010-01-05 12:35:54 +02:00
Panu Matilainen 5085ae9923 Move sys/mman.h include out of system.h to the places that care
- just two places where needed, dont pollute system.h needlessly
- include depending on HAVE_MMAP instead of separately checking for
  sys/mman.h, if sys/mman.h doesn't exist or is broken HAVE_MMAP wont be set
2010-01-05 12:16:52 +02:00
Panu Matilainen f978dc78b4 Move libacl.h include out of system.h to the only place that cares 2010-01-05 11:52:56 +02:00
Panu Matilainen af3c8690d4 Eliminate SEEK_FOO and [RWXF]_OK definitions from system.h
- systems not defining these constants are broken beyond our caring
2010-01-05 11:45:28 +02:00
Panu Matilainen cd174374ff Remove unnecessary and broken time.h related configure + system.h checks
- the AC_HEADER_TIME check is unnecessary for any remotely recent systems,
  and the HAVE_SYS_TIME_H conditional in system.h is just broken as we
  dont even check for <sys/time.h> header in configure
- dont include from system.h, the time.h and sys/time.h get already
  included through our public headers where necessary
2010-01-05 11:37:59 +02:00
Panu Matilainen 5c084f842a Unconditionally include <netdb.h> where needed instead of system.h
- there's no fallback for missing netdb.h so there's little point
  conditionalizing it
- avoid yet more system.h pollution
2010-01-05 11:26:14 +02:00
Panu Matilainen 834551d246 Clean up poll() vs select() tests
- move the includes out of system.h, not commonly needed
- <poll.h> is conditional as we actually provide a fallback through select(),
  but for <sys/select.h> missing there's no fallback so doesn't make
  much sense to test for (and both poll.h and sys/select.h are posix anyway...)
2010-01-04 17:15:26 +02:00
Panu Matilainen 190d2b4783 Remove S_IFSOCK and S_IFLNK kludgery for ancient unixes
- these are specified by POSIX 2001, it's not really rpm's job to
  provide them if the system doesn't
2010-01-04 16:07:11 +02:00
Panu Matilainen 5f0c9a3882 Require lchown() and remove ancient broken chown kludgery
- lchown() is POSIX 2001, we dont care about older / nonconformant stuff
2010-01-04 15:58:55 +02:00
Panu Matilainen 33404070cd Remove further replacement functions for POSIX 2001 required bits
- getwd(), getcwd(), basename() and realpath() are all POSIX 2001
  defined, we dont care about older stuff
2010-01-04 15:27:05 +02:00
Panu Matilainen bb803d630c Remove unnecessary setenv() replacement function
- setenv() and unsetenv() are required by POSIX 2001, we dont care about
  older systems
2010-01-04 14:21:42 +02:00
Panu Matilainen eaeadb40ac Include <utime.h> where needed instead of system.h
- include unconditionally as we dont try to deal with utime() missing
2009-12-23 14:19:54 +02:00
Panu Matilainen 3786b6640e Move major, minor + makedev portability stuff out of system.h, simplify
- only cpio.c needs, move it there
- if none of the standard headers define these, its not our headache anymore
2009-12-23 14:14:35 +02:00
Panu Matilainen 2553ca2fe3 Move getopt() portability fiddles out of system.h
- only macro.c needs, no point polluting includes everywhere
2009-12-23 14:02:19 +02:00
Panu Matilainen 2753a5e934 Dont include <pwd.h> from system.h, dont bother checking for it either
- no much point conditionalizing something we can't live without
- just three places need, no point polluting include space everywhere
2009-12-23 13:40:10 +02:00
Panu Matilainen 68a5dd5803 Dont bother including <sys/socket.h>, we dont use anything from there 2009-12-23 13:36:29 +02:00
Panu Matilainen df3e1ce0cd Dont bother including <err.h>, we dont use anything from there 2009-12-23 13:32:53 +02:00
Panu Matilainen f70b1c76d5 Only rpmrc.c cares about utsname.h, move out of system.h 2009-12-23 13:31:57 +02:00
Panu Matilainen a39dc445fc Dont include grp.h from system.h, dont bother checking in configure either
- no much point conditionalizing something we can't live without
- just two places need, no point polluting include space everywhere
2009-12-23 13:15:59 +02:00
Panu Matilainen 0fbf88d34c Dont bother checking and including a header we dont use or need 2009-12-23 12:58:17 +02:00
Panu Matilainen 162fc36e14 Move malloc portability tweaks out of system.h
- only rpmmalloc.c needs, no need to pollute system.h
2009-12-23 12:55:45 +02:00
Panu Matilainen 4a1e75d139 We dont use memchr() anywhere 2009-12-23 12:47:59 +02:00
Panu Matilainen 9f43fee26b Move getpass() portability tweaks out of system.h
- only signature.c needs, no need to pollute system.h
2009-12-23 12:41:38 +02:00
Panu Matilainen c47b96630c Dont bother checking for a header we dont use 2009-12-23 12:37:37 +02:00
Panu Matilainen 5c31864598 Dont bother checking for functions we dont use
- some of this stuff was used in 4.4.x but not anymore
- additionally we dont even use getdomainnname(), check for gethostname()
  instead
2009-12-23 12:25:32 +02:00
Panu Matilainen 33685ef74e Kill off last remaining uses of _constfree()
- practially all the data in rpmfi needs to be treated as const, these
  are just a funky special case which point to header memory for the
  couple of cases where KEEPHEADER is still used
2009-12-22 14:36:35 +02:00