Commit Graph

96 Commits

Author SHA1 Message Date
Florian Festi
0263f6ebbd Only use multi thread support with liblzma >= 5.2.0
Merged-by: Vitaly Chikunov <vt@altlinux.org>
2020-12-08 22:47:50 +03:00
Per Øyvind Karlsen
c23872d713 Add support for multithreaded xz compression
Merged-by: Vitaly Chikunov <vt@altlinux.org>
2020-12-08 22:47:50 +03:00
Per Øyvind Karlsen
222d4ff7fc add support for setting xz memlimit
Merged-by: Vitaly Chikunov <vt@altlinux.org>
2020-12-08 22:47:50 +03:00
Per Øyvind Karlsen
c254b0d63f add rpmlog(RPMLOG_ERR, ...) for liblzma return codes 2020-12-08 22:47:50 +03:00
90d5486688 Check for cookie_io_functions_t provided by stdio.h
Do not check for libio.h, it's not included anyway.
Check for cookie_io_functions_t and conditionalize
on HAVE_COOKIE_IO_FUNCTIONS_T instead.
2019-11-24 11:58:18 +00:00
fdd98a7997 Replace all uses of _IO_off64_t with off64_t
Mechanically substitute _IO_off64_t with off64_t using
$ git grep -Fwl _IO_off64_t |xargs -r sed -i s/_IO_off64_t/off64_t/g

This follows glibc-2.28~574 and fixes build with glibc >= 2.28.
2019-11-24 11:58:18 +00:00
Gleb Fotengauer-Malinovskiy
e9c71b57f4 macro.c: force GNU getopt(3) to reinitialize it's internal data structure
getopt(3) holds pointers to previous argument vector in case you want to
continue or restart parsing.
In grabArgs function argument vector is on the stack, so you are lucky
if this memory is not reused for something else between subsequent calls
to the function.  If you are not lucky, getopt(3) will read new
arbitrary value from the stack and return error.
2019-01-31 22:17:45 +03: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
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
e854592c75 rpmio.c: updated lzma compression set-up 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
62acbd59d6 macro.c: increase maximal macro depth 2018-05-24 16:19:11 +03:00
96a5445b98 Drop bzdio support
There is no use in supporting bzip2 compressed payloads in rpmbuild nowadays.
2017-11-20 01:42:20 +00:00
9515fd6545 rpmio: fix potential buffer overflow in Fdopen
In file included from /usr/include/string.h:648:0,
                 from ../system.h:76,
                 from rpmio.c:6:
In function 'strncat',
    inlined from 'Fdopen' at rpmio.c:3473:5:
/usr/include/bits/string3.h:158:10: warning: call to __builtin___strncat_chk might overflow destination buffer
   return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest));
2017-01-17 16:16:28 +03:00
e8c780c2b0 Disable build and install of unpackaged files
These are no longer packaged anyway, so no need to bother.
2017-01-14 13:42:53 +00:00
4ab56b3647 rpmio: fix potential buffer overflow in Fdopen
In file included from /usr/include/string.h:648:0,
                 from ../system.h:76,
                 from rpmio.c:6:
In function 'strncat',
    inlined from 'Fdopen' at rpmio.c:3473:5:
/usr/include/bits/string3.h:158:10: warning: call to __builtin___strncat_chk might overflow destination buffer
   return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest));
2017-01-14 13:42:53 +00:00
Gleb Fotengauer-Malinovskiy
91210177c1 Make rpm2cpio exit code accurate for large packages
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.
2015-11-18 20:52:46 +03:00
4efd5e5f44 Fix some harmless compilation warnings 2014-02-15 22:44:35 +00:00
4134fc39ac Fix automake warnings
Makefile.am:13: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
build/Makefile.am:5: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
lib/Makefile.am:5: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
python/Makefile.am:7: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
rpmdb/Makefile.am:5: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
rpmio/Makefile.am:9: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
tools/Makefile.am:5: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
2014-02-15 22:19:47 +00:00
3f575cf2bc rpmio/macro.c (doShellEscape): fix an off-by-one error in stripping trailing newlines
Reported by Alexey Tourbin.
2013-02-07 14:25:10 +00:00
120ce7358f Add %_tmpdir builtin macro 2012-12-22 16:52:35 +00:00
0f27ba59eb Add %getenv builtin macro 2012-12-22 16:20:47 +00:00
a470a11bac parseSpec: enhance line buffer overflow diagnostics 2012-03-19 18:18:03 +00:00
Alexey Tourbin
05eb59911d macro.c: fixed macroTable corruption in freeArgs 2011-01-06 05:52:17 +03:00
Alexey Tourbin
6370ecd629 macro.c: replaced repeated bsearch+qsort with BSEARCH, 10x faster startup
"rpmquery rpm" callgrind annotations, previous commit:
86,825,432  PROGRAM TOTALS
33,090,616  ???:0x0000000000033080'2
25,635,193  ???:strcmp
11,530,816  ???:compareMacroName
 7,241,913  ???:memcpy
 2,008,600  ???:0x0000000000033080
 1,734,274  ???:sortMacroTable
   774,941  ???:doDefine
   642,062  ???:0x00000000000714c0
   308,897  ???:0x000000000002a7b0
   308,137  ???:do_lookup_x
   259,615  ???:0x0000000000070c50
   245,388  ???:poptReadConfigFile

"rpmquery rpm" callgrind annotations, this commit:
6,249,372  PROGRAM TOTALS
774,941  ???:doDefine
531,291  ???:addMacro
523,434  ???:0x00000000000714c0
388,985  ???:strcmp
308,897  ???:0x000000000002a7b0
308,098  ???:do_lookup_x
245,388  ???:poptReadConfigFile

"rpmquery rpm" repeated 100 times (user time), previous commit:
3.78s

"rpmquery rpm" repeated 100 times (user time), this commit:
0.40s
2011-01-06 04:04:18 +03:00
Alexey Tourbin
f332ec8636 bsearch.h: initial revision 2011-01-06 03:30:42 +03:00
Alexey Tourbin
4d5831af27 strcasecmp.c: enhanced with table lookup 2011-01-06 03:22:55 +03:00
Kirill A. Shutemov
0ed9eed845 Migrate to new libbeecrypt
Let's try to use recent libbeectypt in our World Best RPM.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2010-08-12 20:41:06 +00:00
Alexey Tourbin
1ccf0dd03c 4.0.4-alt95.M41.28
- rpmio, rpmbuild: Added support for .xz/.lzma compressed sources and patches.
- Removed old scripts in /usr/lib/rpm.
2009-09-29 16:20:33 +04:00
Alexey Tourbin
6795a36bb1 great removal 2009-09-29 15:29:52 +04:00
Alexey Tourbin
19e6de9d5e added support for .xz/.lzma compressed sources and patches
This also fixes some bugs:
- %uncompress macro never worked;
- %patch -s -b .orig never worked.
2009-09-29 14:18:01 +04:00
Alexey Tourbin
9c4c10a89e 4.0.4-alt95.M41.26
- rpmio: Tweak lzma preset options for better compression.
2009-09-26 02:52:55 +04:00
Alexey Tourbin
147801d6a6 rpmio.c: tweak lzma preset options for better compression 2009-09-26 02:47:34 +04:00
Alexey Tourbin
776a15f6b8 4.0.4-alt95.M41.25
- rpmio: Updated lzma compression routines for xz-5.0 API.
- Packaged /usr/bin/rpm2cpio.static.
2009-09-24 12:46:31 +04:00
Alexey Tourbin
0cded3969f rpmio.c: updated lzdio for xz-5.0 API, added xzdio 2009-09-24 12:30:07 +04:00
4ca252696d Merge branch 'altlinux-4.0' into altlinux-4.1 2009-07-13 23:04:30 +00:00
7e293aed59 rpmio/macro.c (doShellEscape): Fix potential buffer underflow (ALT#11921) 2009-07-13 23:01:04 +00:00
Alexey Tourbin
82d6fbdfe6 4.0.4-alt95.M41.8
- fixed crash in previous release (Dmitry V. Levin)
2008-11-13 07:12:42 +03:00
3d4f77766e rpmmacro.h (rpmGetPath, rpmExpand): Add __attribute__ ((sentinel))
(cherry picked from commit 328d65def9)
2008-11-13 06:46:42 +03:00
Alexey Tourbin
4a557675fc Merge branch 'altlinux-4.0' 2008-05-30 22:25:55 +04:00
Alexey Tourbin
52b2499aff rpmio.c: implemented cpio hints for rsyncable_gzwrite() 2008-05-30 22:23:16 +04:00
Alexey Tourbin
8d5e355e06 rpmio.c: deal with partial rsyncable_gzwrite() return 2008-05-30 20:09:17 +04:00
Alexey Tourbin
f7b5ee1e80 rpmio.c: implemented rscynable_gzwrite() 2008-05-30 20:08:14 +04:00
Alexey Tourbin
c761902bcb rpmio.c: introduced rpmGZFILE wrapper for gzdio 2008-05-30 20:05:08 +04:00
Panu Matilainen
86679b599f Plug a memleak in lzclose() 2008-05-24 13:48:14 +04:00
Alexey Tourbin
9814453966 backported LZMA payload compression from SuSE 2008-05-24 13:47:41 +04:00
Alexey Tourbin
c1c04912cc Merge 4.0.4-alt77 into mod 2007-08-02 18:56:55 +04:00
20400c24b8 rpmio/macro.c (doFoo): Fix potential buffer overflow in %homedir macro processing 2007-04-11 18:18:01 +00:00
Alexey Tourbin
4d8a11acb6 rpmio/macro.c (rpmInitMacrofileGlob): require last character to be alnum
Rationale: I use 'set patchmode=-' in my ~/.vimrc.
2007-03-19 12:41:26 +03:00
08a6500862 rpmio/rpmrpc.c (Glob): Override gl_stat to allow broken symlinks. 2006-10-04 16:18:09 +00:00