Commit Graph

63 Commits

Author SHA1 Message Date
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
Panu Matilainen 1e318f557c Make rpm2cpio exit code accurate for large packages and partial copy
- Grab the uncompressed payload size from header and compare number
  of bytes copied to that for exit code. Previously, truncated
  payloads could have returned with success. This also fixes the
  exit code for large payloads (RhBug:790396)
2012-03-14 11:20:42 +02:00
Panu Matilainen 8f7874c193 Fix up bunch of silly int vs rpmRC return code mismatches 2010-09-21 11:37:21 +03:00
Panu Matilainen 63d37be6b4 Initialize rpm earlier in rpm2cpio (RhBug:523260)
- url retrieval requires macros to be loaded
2009-09-15 12:57:51 +03:00
Panu Matilainen 4149dfa7fe Take advantage of new header string getters 2009-09-02 13:06:25 +03:00
Panu Matilainen 555af4eadb Replace equal/not equal uses of str[n]cmp() with rstreq[n] in binaries 2009-08-31 13:04:17 +03:00
Panu Matilainen 8e9662bd4c Eliminate now unnecessary compressor -> ioflags conversions 2009-08-31 10:19:45 +03:00
Panu Matilainen 69702c1de3 Kill off lclint remnants everywhere
- remove ancient and likely irrelevant LCL comments and bogus NULL checks
2009-07-23 12:24:10 +03:00
Panu Matilainen 6b6e82f8e9 Add -h/--help to rpm2cpio (ticket #63)
- patch originally from Debian, with slight adjustments to indentation
2009-06-18 14:52:45 +03:00
Panu Matilainen fa0898552d Add support for "lzma alone" compression format (lzdio)
- "lzma alone" is superseeded by XZ but it's used by Suse and Mandriva
  distros so it's nice to have as it doesn't need much, only open differs
  from XZ
- rpmlib() dependency versions are an uuuuuuuugly mess here: Suse used
  "PayloadIsLzma = 4.4.2-1" so that's what we provide to be most compatible
  (hopefully). Built packages require "PayloadIsLzma <= 4.4.6-1" however
  to be compatible with Mandriva 2008.0. Did I already say it's ugly?
- Based on similar patch in Mandriva by Per Øyvind Karlsen, but avoiding
  unnecessary renames in rpmio
2009-03-18 11:24:52 +02:00
Panu Matilainen 8078d0ba24 LZMA -> XZ renaming
- what we support now in payloads is XZ, not the former LZMA format, rename
  user- and header-visible parts to match this
- rpmlib(PayloadIsXz) dependency versioned 5.2-1 to avoid unnecessary
  incompatibility with what rpm5 has and what Mandriva is already using
- only provide the rpmlib dependency if actually built with xz support
- rpmFileIsCompressed() attempts to guess the magicless old lzma format
  by file suffix, so it can handle both right now
2009-03-18 09:42:23 +02:00
Panu Matilainen d7b6c49df2 Convert rpm2cpio to new headerGet() 2008-05-26 17:19:07 +03:00
Jindrich Novy 3626f25462 Handle lzma payload 2008-04-22 12:37:18 +02:00
Jindrich Novy 61dff28fa4 Call rpmReadConfigFiles() in rpm2cpio so that rpm2cpio won't complain like:
warning: Unknown system: (null)
warning: Please contact rpm-maint@lists.rpm.org
2008-04-10 14:43:39 +02:00
Jindrich Novy 61b008b566 Don't use stack allocations in rpm2cpio when not needed 2008-04-09 16:03:17 +02:00
Panu Matilainen 99faa2735b rpmlib.h mass eviction
- explicitly include what's really needed instead
- document remaining uses
2008-01-30 13:53:51 +02:00
Panu Matilainen addac6a86b Add rpm_data_t (and _constdata_t) for header data, use everywhere
- consistent, easy to grep for and change...
- bogus consts removed where spotted
2007-12-19 12:05:56 +02:00
Panu Matilainen 9ce13e09ef Switch to <rpm/foo.h> style for public headers
- adjust include paths accordingly
2007-12-08 14:02:32 +02:00
Ralf Corsépius abeea80a38 Use #include <x.h> syntax to include public headers. 2007-11-23 06:46:19 +01:00
Ralf Corsépius 64b30f9a12 Include "rpmts.h" instead of <rpmts.h>. 2007-10-28 06:47:46 +01:00
Ralf Corsépius f25c04c1e4 Include "rpmlib.h" instead of <rpmlib.h>. 2007-10-28 06:47:31 +01:00
Ralf Corsépius 454f5ddff8 Include "rpmpgp.h" instead of <rpmpgp.h>. 2007-10-28 06:14:27 +01:00
Ralf Corsépius 6d77a00e54 Include rpmts.h instead of depends.c. 2007-10-04 09:18:16 +02:00
Ralf Corsépius 90688278db Change main() to using char *argv[]. 2007-09-18 05:53:37 +02:00
Ralf Corsépius a5a65af57e Remove splint tags. 2007-09-11 19:04:11 +02:00
jbj 217c588baa Build on macosx.
CVS patchset: 7701
CVS date: 2005/01/17 23:58:09
2005-01-17 23:58:09 +00:00
jbj f5a546f580 - merge signature returns into rpmRC.
- python: exceptions on NOKEY/NOTTRUSTED.

CVS patchset: 5667
CVS date: 2002/08/23 21:01:59
2002-08-23 21:01:59 +00:00
jbj 035cf961d5 - add bitmask for precise control of signature/digest verification.
CVS patchset: 5604
CVS date: 2002/08/06 01:41:44
2002-08-06 01:41:44 +00:00
jbj c33342be5f - fix: --repackage repaired (#67217).
- fix: rpm2cpio disables signature checks (i.e. same behavior).

CVS patchset: 5574
CVS date: 2002/07/25 23:36:32
2002-07-25 23:36:32 +00:00
jbj 2126e4ad09 - Grand Renaming of rpm data types.
CVS patchset: 5439
CVS date: 2002/05/19 18:42:25
2002-05-19 18:42:25 +00:00
jbj 076a6e29c5 - opaque (well mostly) rpmTransactionSet using methods.
CVS patchset: 5437
CVS date: 2002/05/16 16:55:21
2002-05-16 16:55:21 +00:00
jbj 81c2a9d267 Add toy db->associate, db->join, dbcursor->c_pget wrappers.
CVS patchset: 5421
CVS date: 2002/05/04 20:13:14
2002-05-04 20:13:14 +00:00
jbj 7402ce1546 - legacy signatures always checked where possible on package read.
- wire transactions through rpmcli build modes.
- lazy rpmdb open/close through transaction methods (mostly anyways).
- no-brainer refcounts for rpmdb object.
- check added header against transaction set, replace if newer.

CVS patchset: 5135
CVS date: 2001/10/27 20:09:20
2001-10-27 20:09:20 +00:00
jbj 4a1a5e8148 - wire transactions through rpmcli install/erase modes.
- legacy signatures always checked on package read.

CVS patchset: 5134
CVS date: 2001/10/26 04:16:19
2001-10-26 04:16:19 +00:00
jbj 29ea1567e7 Sync with rpm-4_0 branch.
CVS patchset: 4876
CVS date: 2001/06/17 22:18:03
2001-06-17 22:18:03 +00:00
jbj db32ab6bea Sync with rpm-4_0 branch.
CVS patchset: 4338
CVS date: 2000/12/12 20:03:45
2000-12-12 20:03:45 +00:00
jbj 2885f536b6 Bring header reggions mods back to top of stack.
CVS patchset: 4305
CVS date: 2000/12/02 21:53:44
2000-12-02 21:53:44 +00:00
jbj 5df134128b - support for separate source/binary compression policy.
- support for bzip payloads.

CVS patchset: 3908
CVS date: 2000/06/23 01:19:45
2000-06-23 01:19:45 +00:00
jbj 4e62a322a2 lib/rpmio.c: Implement per-fd layers as a stack, add fdPush/fdPop.
lib/rpmio.c: Add fd{Get,Set}{Io,Fp,Fdno} abstraction wrappers.
lib/rpmio.c: Start rationalizing debug output by using fdbg to display the
	fd layer stack.
rpm.c: Add --nolibio to disable libio if desired.
rpm2cpio.c: Use Fdopen(..., gzdio) and ufdCopy().
build/build.c: Use Fdopen(..., fpio) rather than fdio.
build/files.c: Use Fdopen(..., fpio) rather than ufdio.
build/parseSpec.c: ditto.
lib/macro.c: ditto.
lib/rpmrc.c: ditto
lib/macro.c: Use Fopen(..., ufdio) in isCompressed() rather that fdOpen().
lib/misc.c: ditto.
lib/misc.c: Avoid fstat by using Stat.
build/pack.c: Add persist fdLink() and use fdFree() in package{Sources,Binaries}
build/pack.c: Try to remove the fdDup before cpioBuildArchive() call.
build/pack.c: Use rpmGenPath with %{_builddir}.
build/parsePreamble.c: Use fdSize rather than Stat to get icon file size.
lib/rpmrc.c: ditto
lib/ftp.c: start capturing ufdio layer syserrno/errcookie.

CVS patchset: 3424
CVS date: 1999/11/14 19:15:18
1999-11-14 19:15:18 +00:00
jbj e0b1d0be36 Swap 2nd and 3rd arg to Fread/Fwrite to preserve read/write type return.
Use Fstrerror to retrieve fd->syserrno.
Make ftpFileDoneNeeded per-fd rather than per-url.
Make data fd unique rather than per-url.
Use appropriate protocol commands for ufdio writing.

CVS patchset: 3421
CVS date: 1999/11/10 22:09:49
1999-11-10 22:09:49 +00:00
jbj 3363604c70 Use Fopen almost everywhere.
Rip out --enable-bzip2-payload, we'll use Fopen w macros instead.
Work out ref counting for ftpControl so that control channel is persistent.
build/build.c: Use fpio to write build stage script.
parseSpec.c: Rework include stack to use FD_t, not FILE *.
tread.c: Delete, use ufdio->read instead.
rpmio.c: Filter out fdio fd == NULL assertion failures.
rpmrc.c: Don't fail if HOME is not environment.
rpmrc.c: Rework ufdio FTP rcfile I/O to be more similar to stdio.

CVS patchset: 3417
CVS date: 1999/11/04 21:26:08
1999-11-04 21:26:08 +00:00
jbj 94dd9f796e First use of libio.
CVS patchset: 3416
CVS date: 1999/11/03 20:33:53
1999-11-03 20:33:53 +00:00
jbj 7fc3a97733 Add ref/deref/new/fileno/open vectors to FDIO_t.
Hide fdOpen/ufdOpen, use {fdio,ufdio}->open throughout.
url.c: Create ref counted abstract urlinfo type with debugging.
url.c: Rename functions to urlNew/urlFree/urlFreeCache for consistency.
rpmio.c: Create ref counted abstract FD_t type with debugging.
rpmio.c: Create private struct _FD_s type.
cpio.c: Create fd[GS]etCpioPos to preserve FD_t abstraction.

CVS patchset: 3414
CVS date: 1999/11/02 14:33:14
1999-11-02 14:33:14 +00:00
jbj 2b84d36c2e Make fdFileno() static, use Fileno()/Ferror() analogues throughout.
Make ufdClose() static, use Fclose() with ufdio cookie throughout.
rpm.c: Clean urlinfoCache and rpmBuildArgs leaks.
url.c: urlIsURL() should be here, not in rpmio.c.
url.c: Preserve FD_t abstraction by creating ufdGetUrlinfo().
url.c: Create freeUrlinfoCache().
rpmio.c: Create ufdio cookie.

CVS patchset: 3407
CVS date: 1999/10/30 16:43:29
1999-10-30 16:43:29 +00:00
jbj 7b4cf4bf19 fix: resurrect multiple target platform builds.
CVS patchset: 3404
CVS date: 1999/10/29 23:03:12
1999-10-29 23:03:12 +00:00
jbj 0d0b405c20 use compressed filenames on install side.
start unifying FD types, CFD_t now gone.

CVS patchset: 3402
CVS date: 1999/10/27 23:18:10
1999-10-27 23:18:10 +00:00
jbj e60094b302 Retrofit glibc __progname.
CVS patchset: 3330
CVS date: 1999/09/26 15:04:03
1999-09-26 15:04:03 +00:00
jbj b2fd4c2d88 Add dup for the "other" gzdopen premature close.
CVS patchset: 2556
CVS date: 1998/11/25 00:42:36
1998-11-25 00:42:36 +00:00
jbj eb0436b4b2 Start abstracting compressed I/O.
CVS patchset: 2552
CVS date: 1998/11/22 19:48:48
1998-11-22 19:48:48 +00:00
jbj a15a36abd1 Sanity.
CVS patchset: 2551
CVS date: 1998/11/20 20:18:22
1998-11-20 20:18:22 +00:00