Commit Graph

823 Commits

Author SHA1 Message Date
Eric Andersen
52499cb9ae Tito writes:
Hi,
I've spent the half night staring at the devilish  my_getpwuid and my_getgrgid functions
trying to find out a way to avoid actual and future potential buffer overflow problems
without breaking existing code.
Finally I've  found a not intrusive way to do this that surely doesn't break existing code
and fixes a couple of problems too.
The attached patch:
1) changes the behaviour of my_getpwuid and my_getgrgid to avoid potetntial buffer overflows
2) fixes all occurences of this function calls in tar.c , id.c , ls.c, whoami.c, logger.c, libbb.h.
3) The behaviour of tar, ls and  logger is unchanged.
4) The behavior of ps with somewhat longer usernames messing up output is fixed.
5) The only bigger change was the increasing of size of the buffers in id.c to avoid
     false negatives (unknown user: xxxxxx) with usernames longer than 8 chars.
     The value i used ( 32 chars ) was taken from the tar header ( see gname and uname).
     Maybe this buffers can be reduced a bit  ( to 16 or whatever ), this is up to you.
6) The increase of size of the binary is not so dramatic:
     size busybox
       text    data     bss     dec     hex filename
     239568    2300   36816  278684   4409c busybox
    size busybox_fixed
       text    data     bss     dec     hex filename
     239616    2300   36816  278732   440cc busybox
7) The behaviour of whoami changed:
    actually it  prints out an username cut down to the size of the buffer.
    This could be fixed by increasing the size of the buffer as in id.c or
    avoid the use of my_getpwuid and use getpwuid directly instead.
    Maybe this colud be also remain unchanged......

Please apply if you think it is ok to do so.
The diff applies on today's cvs tarball (2004-08-25).
Thanks in advance,
Ciao,
Tito
2004-08-26 22:18:59 +00:00
Eric Andersen
4f807a84c5 BusyBox has no business hard coding the number of major and minor bits for a
dev_t.  This is especially important now that the user space concept of a dev_t
and the kernel concept of a dev_t are divergant.  The only bit of user space
allowed to know the number of major and minor bits is include/sys/sysmacros.h
(i.e. part of libc).  When used with a current C library and a 2.6.x kernel,
this fix should allow BusyBox to support wide device major/minor numbers.
 -Erik
2004-07-26 09:11:12 +00:00
Glenn L McGrath
a88ae491e3 Fixup -T (--files-from) option, works for non-directories now 2004-07-21 09:00:39 +00:00
Glenn L McGrath
f34b0e996b Update reference for zip format 2004-06-06 10:22:43 +00:00
Eric Andersen
aaff79a8dd Steve Grubb writes:
Hello,

I found and patched 2 more bugs. The first is a misplaced semi-colon. The second
one is a buffer overflow. I doubt the buffer overflow is triggered in real life.
But you never know what those wily hackers are up to.

Thanks,
Steve Grubb
2004-05-05 10:37:49 +00:00
Glenn L McGrath
faa3546fd7 Fix symlink handling and small memory leak 2004-04-29 09:24:19 +00:00
Glenn L McGrath
c6992feee3 Update my email address, document some of my tasks in the AUTHORS file 2004-04-25 05:11:19 +00:00
Eric Andersen
aff114c33d Larry Doolittle writes:
This is a bulk spelling fix patch against busybox-1.00-pre10.
If anyone gets a corrupted copy (and cares), let me know and
I will make alternate arrangements.

Erik - please apply.

Authors - please check that I didn't corrupt any meaning.

Package importers - see if any of these changes should be
passed to the upstream authors.

I glossed over lots of sloppy capitalizations, missing apostrophes,
mixed American/British spellings, and German-style compound words.

What is "pretect redefined for test" in cmdedit.c?

Good luck on the 1.00 release!

      - Larry
2004-04-14 17:51:38 +00:00
Glenn L McGrath
958ac18d4e Add a comment explaining why we have to check for an extra \n 2004-04-09 06:59:05 +00:00
Eric Andersen
762c64fdf1 rename uncompress.c to decompress_uncompress.c
rename unzip.c to decompress_unzip.c
2004-04-05 13:03:34 +00:00
Eric Andersen
8ee2b27f0c Add missing include files 2004-03-27 11:26:32 +00:00
Eric Andersen
70060d25d2 s/fileno\(stdin\)/STDIN_FILENO/g
s/fileno\(stdout\)/STDOUT_FILENO/g
2004-03-27 10:02:48 +00:00
Eric Andersen
c7bda1ce65 Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
Glenn L McGrath
10b781345f Fix option handling, -i or -t must be given, if both ignore the -t.
Use bb_getopt_ulflags.
2004-02-25 09:30:06 +00:00
Glenn L McGrath
15c3512614 Sometimes i get carried away with the use of function pointers, im sure
it seemed like a good idea at the time.
2004-02-21 09:20:56 +00:00
Glenn L McGrath
916ba53f1a Fix up hard links 2004-02-20 02:34:42 +00:00
Glenn L McGrath
c9f1fce9bb A strict interpretation of the ustar format requires the type flag to be
interpreted, we cannot depend on the file type being set in the mode
field.
2004-02-20 02:25:18 +00:00
Glenn L McGrath
b0e163a93b Add extra comments, freakout if a pax archive is encoutered. 2004-02-19 08:48:30 +00:00
Glenn L McGrath
a8f756fc7f Remove debugging 2004-02-17 12:04:13 +00:00
Glenn L McGrath
6aa52234e8 Dont strip trailing '/' until _after_ i test to set if its there ! 2004-02-17 11:55:06 +00:00
Eric Andersen
dfcb5b0412 s/u_int/uint/g 2004-01-30 22:54:20 +00:00
Glenn L McGrath
303e989a11 Add the -h, --dereference option for archive creation. 2004-01-25 05:48:28 +00:00
Glenn L McGrath
b03be7f567 Patch from Arthur Othieno, clarify common options between dpkg and dpkg-deb 2004-01-17 03:24:05 +00:00
Glenn L McGrath
1f28b90a9c Use bb_getopt_ulflags, save 100 bytes and strict argument checking. 2004-01-07 09:24:06 +00:00
Glenn L McGrath
ab7780655b Use bb_getopt_ulflags, save 150 bytes. 2004-01-05 12:35:05 +00:00
Glenn L McGrath
6cb3bc056c Use bb_getopt_ulflags, simplify some logic, saves some bytes. 2004-01-05 11:49:55 +00:00
Glenn L McGrath
08ca752c68 Fix usage with libraries, skip symbol table. 2004-01-04 11:06:34 +00:00
Glenn L McGrath
930453bdcf Use bb_getopt_ulflags, saves some space, better argument checking.
Remove ar specific extraction code, always use common extraction code.
2004-01-04 10:28:22 +00:00
Glenn L McGrath
ce91c8ac2b Isolate code better for unused options, config option to enable long
options, add some conditions to the tar tests in testsuite.
2003-12-26 14:01:37 +00:00
Glenn L McGrath
334dc65c92 Fix a bug of mine where extracting files to stdout would extract to
much, modified patch from Bastian Blank
2003-12-22 21:02:41 +00:00
Eric Andersen
67ff3a1ffd Don't hose up perms for files that happen to have symlinks
in the tarball that point to them.
 -Erik
2003-12-21 08:59:24 +00:00
Glenn L McGrath
142abc18ce Fix a compile error when only using ar, patch by Paul van Gool 2003-12-05 02:51:21 +00:00
Glenn L McGrath
b8c3a54531 Patch from Ian Campbell, fix or'ed dependencies and handle virtual
dependencies.
2003-11-28 22:38:14 +00:00
Glenn L McGrath
e39ee01821 Fix tar hard links 2003-11-27 00:01:43 +00:00
Glenn L McGrath
fea4b446df Important bugfixes from Ian Campbell.
init_archive_deb_data()
        We want to filter for data.tar.* in the AR file not the TAR
        file, else we get nothing.

all_control_list()
        Make the 'extensions' array of control file names a global so it
        can be used in unpack_package as well. Name the global
        all_control_files. Don't hard code the length of
        all_control_files but instead used sizeof.

unpack_package()
        Only unpack the control files we are interested in (from
        all_control_files). Extract the data.tar.gz into / rather than
        the current directory.

dpkg_main()
        Configure packages in a second pass so all the packages being
        installed are unpacked before configuring.

Some purely cosmetic changes:

header
        update list of differences since two of them are no longer true.
        The .control file is no longer stored as a result of this patch
        -- it was redundant since the info is in status. New packages
        appear to be added to the end of the status file now rather than
        the start.

remove_package()
        Make message printing optional, so we can avoid a redundant
        message when replacing/upgrading a package. When we do print
        stuff then include the version number.

purge_package()
        Print "Purging xxx (yyy) ..." message like the other actions.

configure_package()
        Add "..." to "Setting up" message to be consistent with other
        actions.
2003-11-26 21:53:37 +00:00
Glenn L McGrath
7ffe133864 As we no longer use function pointers for read in common archiving code
archive_xread can be replaced with bb_full_read, and archive_copy_file
with bb_copyfd*
bb_copyfd is split into two functions bb_copyfd_size and bb_copyfd_eof,
they share a common backend.
2003-11-21 22:24:57 +00:00
Glenn L McGrath
1a2d75fd72 Use safe read 2003-11-21 22:17:28 +00:00
Glenn L McGrath
2cd1eb16ad Remove unused function 2003-11-20 22:36:57 +00:00
Glenn L McGrath
e857122c97 Fix tar-handles-nested-exclude testcase 2003-11-20 10:47:06 +00:00
Glenn L McGrath
bebc40b406 Check at least one context is specified 2003-11-20 09:53:31 +00:00
Glenn L McGrath
ba49651de9 Check there are files to add the archive before removing a specified
tar file.
2003-11-20 09:06:10 +00:00
Glenn L McGrath
90c9df93f3 Dont attempt to unlink directories 2003-11-20 08:00:38 +00:00
Glenn L McGrath
56f16b42c9 tar -Z, uncompress support 2003-11-18 21:37:52 +00:00
Glenn L McGrath
20872be9a4 Dont close original file handle, we may need it later. 2003-11-18 21:31:19 +00:00
Glenn L McGrath
3b9fc8fe2a Make unlink old files default behaviour and add a new option -k to
prevent overwritting existing files
2003-11-18 20:23:04 +00:00
Glenn L McGrath
f074afc2a0 Dont free filename, its needed in the extracted files list. 2003-11-17 21:58:00 +00:00
Glenn L McGrath
8dc8cb133c Fix a bug where cpio wouldnt work unless -u was specified 2003-11-15 23:44:31 +00:00
Glenn L McGrath
5699b8525e Move from read_gz to the pipe()+fork() method.
open_transformer(), common code for pipe+fork.
Function pointer for read() no longer needed.
Allow inflate to be initialised with a specified buffer size to avoid
over-reading.
Reset static variables in inflate_get_next_window to fix a bug where
only the first file in a .zip would be be extracted.
2003-11-15 23:19:05 +00:00
Glenn L McGrath
54ac057c00 Fix memory leaks 2003-11-15 00:24:43 +00:00
Glenn L McGrath
e57feeb9e6 Keep trying to find a good header, if we exit it will cause .tar.gz
files to compute incorrect crc and length for gzip
2003-11-14 12:57:14 +00:00
Glenn L McGrath
eba86e2adb Catch unsupported features 2003-11-14 12:53:42 +00:00
Glenn L McGrath
7b215b99b2 Fix build error with tar -j 2003-11-14 09:22:24 +00:00
Glenn L McGrath
1a41db8eaf Remove some tar_gz stuff that get dragged in 2003-11-14 09:21:27 +00:00
Glenn L McGrath
94cf153c2b Remove debugging noise. 2003-11-14 08:30:46 +00:00
Glenn L McGrath
d09bcecda8 Read in blocks rather than one char at a time, greatly improves speed 2003-11-14 08:26:25 +00:00
Eric Andersen
8211db5af0 Vladimir N. Oleynik (vodz) writes:
Hi Glenn.

I analysed BSS size gzip applet and found may be mistake:
updcrc() checking  if (crc_table_empty) but not resetted this var.
This do make slow gzip applet ;-)


--w
vodz
2003-11-14 02:44:28 +00:00
Eric Andersen
28d4e16cd7 This appears to be the correct fix to make CONFIG_FEATURE_DEB_TAR_BZ2
support compile.  Glenn, you may want to verify this.
 -Erik
2003-11-07 21:31:58 +00:00
Eric Andersen
d2160aaeab fix comment 2003-11-07 21:22:09 +00:00
Glenn L McGrath
2685724e23 Fix tar -j support
Use the old fork() method of tar compression support, rather than
read_bz2....
 - (*uncompress)(int in, int out) seems like a more natural interface
for compression code.
 - it might improve performance by seperating the work into one cpu
bound and one io bound process.
 - There is extra code required to do read_[gz|bunzip] since (*uncompress)(int in,
int out) will normally be used by the standalone compression applet.

There have been problems with this method so if you see a "Short read"
error let me know.
2003-11-05 04:55:58 +00:00
Eric Andersen
8179cf2b78 Put back the tar support stubs (and warnings) for now. 2003-10-31 08:52:57 +00:00
Eric Andersen
0120be94a0 Fix stupid typo 2003-10-31 00:21:28 +00:00
Glenn L McGrath
6530f0d3a1 make CONFIG_FEATURE_UNARCHIVE_TAPE common between itar and cpio, patch
by Arthur Othieno
2003-10-29 04:46:30 +00:00
Glenn L McGrath
f235d05773 Use the return value from uncompress_bunzip, fix some typo 2003-10-29 03:37:54 +00:00
Glenn L McGrath
1c834407e3 Add some error messages, use xmalloc instead of malloc 2003-10-28 23:32:12 +00:00
Glenn L McGrath
debb21ece7 Fix a logic error, the old bunzip code returned non-zero for success,
new code returns 0 for success.
2003-10-28 23:04:50 +00:00
Glenn L McGrath
e81fc5fb30 Conditionally compile some files.
This hides a bug related to the new bunzip code in the tar and dpkg[-deb]
applets.
It will also reduce compile time a little as some unused files wont be
compiled.
2003-10-28 10:44:58 +00:00
Eric Andersen
5fa4db29f7 Another bzip2 update and speedup from Manuel Novoa III, with some
additional changes (primarily lots of comments) from Rob Landley.
2003-10-23 06:52:01 +00:00
Eric Andersen
88c916bdec Andreas Mohr writes:
the busybox menuconfig triggered my "inacceptable number of spelling mistakes"
upper level, so I decided to make a patch ;-)

I also improved some wording to describe some things in a better way.

Many thanks for an incredible piece of software!

Andreas Mohr, random OSS developer
2003-10-22 09:58:56 +00:00
Eric Andersen
1acfb72e71 Manuel Novoa III writes:
Hello Rob,

Here's a patch to your bunzip-3.c file.  Nice work btw.

One minor bug fix... checking for error return when read()ing.
Some size/performance optimizations as well.  One instance of
memset() seems unnecssary.  You might want to take a look.

Anyway, on my machine, decompressing linux-2.6.0-test7.tar.bz2
to /dev/null gave the following times:

        bunzip-3.c    bzcat (system)   bunzip-3.c (patched)
real    0m24.420s     0m22.725s        0m20.701s
user    0m23.930s     0m22.170s        0m20.180s
sys     0m0.070s      0m0.080s         0m0.140s

Size of the patched version is comparable (slightly larger or
smaller depending on compiler flags).

Manuel
2003-10-18 01:59:46 +00:00
Eric Andersen
0d6d88a205 Rob Landley's new micro-bunzip version 3. Rob writes:
The API for using partial writes, as described in my last message, sucked.

So here's a patch against my last patch that changes things so that
write_bunzip_data calls read_bunzip_data itself behind the scenes whenever
necessary.  So usage is now just start_bunzip(), write_bunzip_data() until it
returns a negative number, and then the cleanup at the end of
uncompressStream.

It adds 32 bytes to the executable, but it should allow the caller (tar) to be
simplified enough to compensate.  Total -Os stripped exe size now 6856 bytes.

Rob

P.S.  I attached the whole C file so you don't have to keep incremental
patches straight if you don't want to. :)

P.S.  In the version I'm banging on now, I've simplified the license to just
LGPL.  I read the OSL a bit more closely and the patent termination clause
would have bit IBM in their counter-suit of SCO if the code in question had
been OSL instead of GPL, and I've decided I just don't want to beta-test
legal code right now.
2003-10-18 01:58:35 +00:00
Glenn L McGrath
91b3d460c7 Fix -C option when creating tar files.
Need to chdir after the tar file is opened, so make common tar filename
parsing and send the file descriptor rather than filename to
writeTarFile.
Modify the verboseFlag operation to determine wether to display on
stderr or stdout at display time, simpler than doing it in tar_main.
2003-10-02 14:33:23 +00:00
Eric Andersen
1393a39df4 Do not shadow the global name 'accept' 2003-09-15 08:06:15 +00:00
Glenn L McGrath
beb3bbd991 Fix handling of hardlinks when OLDGNU and GNU extensions arent enabled. 2003-09-12 06:49:09 +00:00
Glenn L McGrath
ef91bf67ed Use the typeflag to identify if its a hardlink on OLD and GNU posix
modes, fixes a bug extracting hardlinks to symlinks.
2003-09-12 06:31:28 +00:00
Eric Andersen
2fdba24620 Marc A. Lehmann writes:
The tar -x command in busybox does not restore the file mode correctly.

The reason is most probably this code in
archival/libunarachive/data_extract_all.c:

       chmod(file_header->name, file_header->mode);
       chown(file_header->name, file_header->uid, file_header->gid);

chown clears the set*id bits (on current versions of linux :). Flipping
the order around fixes the problem.

(tested with 1.00pre3 from cvs).
2003-09-11 08:32:40 +00:00
Glenn L McGrath
87af49f26b If a tar entry is a regualr file ending in a '/' then its really a
directory.
From http://www.gnu.org/manual/tar/html_node/tar_123.html
REGTYPE
AREGTYPE
    These flags represent a regular file. In order to be compatible with
older versions of tar, a typeflag value of AREGTYPE should be silently
recognized as a regular file. New archives should be created using
REGTYPE. Also, for backward compatibility, tar treats a regular file
whose name ends with a slash as a directory.
2003-09-09 17:41:03 +00:00
Glenn L McGrath
4cee66d5a8 Dont unlink when testing !
Always preserve creation date
Disable the -p option its for modification date
Remove some cpio header debugging noise
Syncronise file listing behaviour with upstream.
2003-08-28 19:12:23 +00:00
Eric Andersen
6d3c7e7a9c trivial doc fix 2003-08-22 21:15:07 +00:00
Glenn L McGrath
3d5828fb6d Change hardlink handling for tar to work the same way as cpio 2003-08-14 02:55:15 +00:00
Glenn L McGrath
91e464632b Fix bug when handling debian packages.
If we read the contents of compressed files within the ar archive,
e.g. control.tar.gz, then file position gets all out of whack, so
it has to be reset before reading thenext header.
2003-07-31 01:53:50 +00:00
Eric Andersen
1b0075d243 Fixup problem unconditionally converting all hard links to symlinks. 2003-07-16 06:29:51 +00:00
Eric Andersen
cb81e6484d Update a bunch of docs. Run a script to update my email addr. 2003-07-14 21:21:08 +00:00
Eric Andersen
e5642119ee Patch from Thomas Cameron:
Hello all,
	    This patch adds more "Help" text to the config system.  Almost
    all applets now have a help entry.  Also, I cleaned up the spacing of
    the existing text so that things are consistent.  This patch is against
    this morning's CVS.

    Thomas Cameron
    CEI Systems, Inc.
2003-07-14 19:37:08 +00:00
Eric Andersen
e3393513c5 Be certain to not abort prematurely when reading stuff from pipes. 2003-07-05 23:10:27 +00:00
Eric Andersen
3c5a83c567 As noted by Thomas Eckert:
bb-tar "cjf" does not create a valid tbz2-archive -- if fact the result is a
    plain tar-file (no compression) -- but does not warn about the unrecognized
    parameter combination "cj" (bb does not have bzip2-compression yet, right?).

to fix this I have added an error message stating this does not work.

He also reported

    cosmetic: versose "-v" does not show any output when used with "create"

which I have now fixed as well.

 -Erik
2003-07-05 21:56:55 +00:00
Eric Andersen
65e20a33c2 Patch from Kent Robotti adding a bunch of needed docs!
-Erik
2003-07-05 07:52:35 +00:00
Eric Andersen
a21f4e018a Glenn McGrath (bug1) isaway from my email till the 17th, but caught me on IRC.
He took a look into the recent reports of tar problems, and found an obvious
typo in last_patch91 from vodz which converted tar to use bb_getopt_ulflags.
2003-07-05 06:38:41 +00:00
Eric Andersen
e5920a2dc0 Patch from Kent Robotti adding a bunch of menuconfig help 2003-07-03 10:00:15 +00:00
Eric Andersen
27cb6846d7 last_patch91 from vodz to convert tar to use bb_getopt_ulflags 2003-06-26 09:07:59 +00:00
Glenn L McGrath
a0b3705fa1 Save a few bytes by using bb_getopt_ulflags and a few other minor
improvments
2003-06-22 06:59:34 +00:00
Glenn L McGrath
b838420fd5 Handle hard links by converting them to symlinks 2003-06-12 13:47:16 +00:00
Matt Kraai
0861e828d0 Handle -O preceding -x. 2003-05-18 21:12:36 +00:00
Glenn L McGrath
e2aed7ffd7 Always preserve date 2003-04-26 13:16:44 +00:00
Glenn L McGrath
afc01cd485 unlink a previous file before its extracted 2003-04-21 11:03:29 +00:00
Glenn L McGrath
35a5b08eee unlink() an existing file, before opening it, simply truncating can
cause nasty problems if overwriting glibc, spotted by waldi.
2003-04-21 10:07:48 +00:00
Manuel Novoa III
cad5364599 Major coreutils update. 2003-03-19 09:13:01 +00:00
Glenn L McGrath
826b48b624 Woops, my gunzip fix broke unzip, these cant be static 2003-02-09 12:00:17 +00:00
Glenn L McGrath
1d21fb3c23 Moved to libunarchive/unzip.c 2003-02-09 04:49:17 +00:00
Glenn L McGrath
cc616928d5 Fix endian probelm on PPC, i had different types for an extern variable. 2003-02-09 04:46:34 +00:00
Glenn L McGrath
21110a0aa2 Fix long standing bug with old gnu tar files, add a check so tar will
complain "unknown file type" if it tries to extract an oldgnu tar file
and TAR_FEATURE_OLDGNU_COMPATABILITY sint defined.
Print a warning if unisupported gnu extensions are encountered.
2003-01-28 01:45:48 +00:00
Eric Andersen
f4b273cbb4 A cleaner cleanup that avoids passing an off_t to scanf 2002-12-11 21:45:08 +00:00
Eric Andersen
9701411d21 squash a warning 2002-12-11 21:34:04 +00:00
Glenn L McGrath
b323162aab Use libbb/get_line_from_file instead of getline 2002-12-11 03:10:13 +00:00
Glenn L McGrath
38386d7fed include busybox after libc includes 2002-12-10 02:09:12 +00:00
Glenn L McGrath
b72a735a32 rpm applet by Laurence Anderson 2002-12-10 00:17:22 +00:00
Glenn L McGrath
66125c8065 Move add_to_list from libunarchive to libbb so it can be of more general use (eg ifupdown). Changed the name to llist_add_to as i plan on adding more llist_ functions as needed (e.g. llist_free). 2002-12-08 00:54:33 +00:00
Glenn L McGrath
0337c467a0 Add some help descriptions 2002-12-06 22:40:54 +00:00
Eric Andersen
536018278a Kill the now obsolete docs/Configure.help file, and move all existing
help texts into their respective Config.in file.
 -Erik
2002-12-05 21:12:42 +00:00
Eric Andersen
c9f20d9fb9 Yet another major rework of the BusyBox config system, using the considerably
modified Kbuild system I put into uClibc.  With this, there should be no more
need to modify Rules.mak since I've moved all the interesting options into the
config system.  I think I've got everything updated, but you never know, I may
have made some mistakes, so watch closely.
 -Erik
2002-12-05 08:41:41 +00:00
Glenn L McGrath
6f9b45b9ef Unlink before mkdir, mknod, symlink to overwrite 2002-12-04 22:26:30 +00:00
Glenn L McGrath
b963875a3e Move compare_string_array to libbb 2002-12-02 00:01:36 +00:00
Glenn L McGrath
f3faf41334 fix warning 2002-12-01 21:52:40 +00:00
Aaron Lehmann
a170e1c858 Change if(x)free(x); to free(x); 2002-11-28 11:27:31 +00:00
Glenn L McGrath
d211214d42 Use error_msg instead of printf(stderr 2002-11-28 09:22:14 +00:00
Glenn L McGrath
fedbfe4059 Style 2002-11-28 09:09:47 +00:00
Glenn L McGrath
ec87d37305 Check that one and only one of the [cxt] options is given 2002-11-27 07:52:22 +00:00
Glenn L McGrath
f66de64a11 Use vfork instead of fork, some more cleanup from Vladimir N. Oleynik 2002-11-25 23:57:27 +00:00
Glenn L McGrath
eda4f53f2e Add an input buffer (currently 32kB) to speed things up heaps, it still requires 25% longer to decompress as compared to upstream. 2002-11-24 06:01:20 +00:00
Glenn L McGrath
b7a76df4d1 Fix long filename support 2002-11-23 10:44:47 +00:00
Glenn L McGrath
83bf47c02f Speed and memory usage improvements from Laurence Adnerson 2002-11-20 22:00:31 +00:00
Glenn L McGrath
0126fda5bb read_gz patch 3 from Laurence Anderson 2002-11-20 06:46:46 +00:00
Glenn L McGrath
a0d395eac9 Use read_gz, remove fork() woohoo! 2002-11-19 08:22:03 +00:00
Glenn L McGrath
fd73b8c2ce Patch from Laurence Anderson to provide a read_gz function, doesnt require fork(), pipe(), consistent with read_bz2 and more flexible. 2002-11-17 21:33:30 +00:00
Glenn L McGrath
36233bdd71 Remove #defines around get_header_ptr, we allways need it. 2002-11-16 21:34:57 +00:00
Glenn L McGrath
02fcd2d2df Allow short reads as we are looping anyway. 2002-11-15 21:58:30 +00:00
Glenn L McGrath
2666679692 Dont chdir untill after we open the archive 2002-11-15 08:48:47 +00:00
Glenn L McGrath
e356883ffb Minor cleanups 2002-11-13 00:24:20 +00:00
Glenn L McGrath
034c371bb2 Reduce block size to 512 to prevent short read's when reading from a pipe 2002-11-12 23:34:15 +00:00
Glenn L McGrath
5703341123 #ifdef, not just #if... grrr 2002-11-08 08:07:38 +00:00
Glenn L McGrath
f6bf7a03fe Fix reading from stdin (me), Fix tar segfault when no arguments specified (Geoffrey Lee) 2002-11-08 07:09:42 +00:00
Glenn L McGrath
62d28828d6 Use a switch instead of successive if (strcmp()) statments. 2002-11-06 23:35:28 +00:00
Glenn L McGrath
747381c602 Split deb_extract() into more generic functions 2002-11-06 22:54:41 +00:00
Glenn L McGrath
ea12202288 Terminate the buffer with a '\0' 2002-11-06 22:31:45 +00:00
Glenn L McGrath
d8d1191505 Support for bziped debs, i.e. use .tar.bz2 instead .tar.gz internally 2002-11-05 13:56:04 +00:00
Glenn L McGrath
7f2a95319b Fail silently if a partial tar header is read as tar.bz2 is leaving trailing junk (not sure why), add some missing files 2002-11-05 02:56:57 +00:00
Glenn L McGrath
18bbca18ac enable .tar.bz2 for dpkg-deb 2002-11-05 01:52:23 +00:00
Glenn L McGrath
8e94098423 Change filter paramaters, filters can be more powefull now 2002-11-04 23:47:31 +00:00
Glenn L McGrath
f92caa7619 Call lseek directly rather than via data_align() 2002-11-03 14:14:53 +00:00
Glenn L McGrath
237ae42fc9 Abstract read and seek in unarchiving code, convert bunzip to file descriptors, support tar -j 2002-11-03 14:05:15 +00:00
Glenn L McGrath
2fc54a9258 Fix #define syntax 2002-11-03 12:50:33 +00:00
Glenn L McGrath
6ab32eb34c Move data_extract_all_prefix to dpkg, its only used there. 2002-11-03 11:57:10 +00:00
Glenn L McGrath
b8e556e5f5 Add copyright notice and license, use strcat+strcpy instead of sprintf 2002-11-03 11:46:49 +00:00
Glenn L McGrath
9c60b29071 Use xread_char to save a few bytes, fix indenting of comments 2002-11-03 10:57:25 +00:00
Glenn L McGrath
60bce4905c Move bunzip2 idecompression code to libunarchive 2002-11-03 07:28:38 +00:00
Glenn L McGrath
bf1cc8b1b7 Make uncompress a seperate applet so it doesnt pull in all the gunzip code 2002-11-01 23:38:54 +00:00
Glenn L McGrath
d6aec8619d Allow short reads when filling compress buffer 2002-11-01 22:28:13 +00:00
Glenn L McGrath
9ef0944456 Allow the .Z prefix if compress support enabled 2002-11-01 22:11:53 +00:00
Glenn L McGrath
b2f67b4068 Make it a fatal error if bad chksum or crc, if not we should return an error code 2002-11-01 22:08:59 +00:00
Glenn L McGrath
563ac6e789 Report errror if the first magic character doesnt match 2002-11-01 21:40:52 +00:00
Eric Andersen
18921bd00d A bugfix from Danny Lepage:
It seems that under busybox unstable, "tar -c -f - blabla" create
    a tar file named "-" instead of writing to stdout.

    The included patch should fix this.
2002-10-26 10:05:37 +00:00
Glenn L McGrath
9ffd5776eb Move unzip.c uncompress.c from libbb to archiveal/libunarchive 2002-10-22 01:07:32 +00:00
Glenn L McGrath
61b7904afd Update dpkg to use new unarchive code 2002-10-19 10:40:55 +00:00
Glenn L McGrath
c5c1a8a112 Fix exclude/include problem 2002-10-19 06:19:22 +00:00
Glenn L McGrath
05fa661123 Find a string in a list 2002-10-19 05:10:51 +00:00
Glenn L McGrath
25bca9566d Remove entries from the accept list as they are matched so we can determine if any files that were specified in the list wernt found. 2002-10-19 02:18:51 +00:00
Glenn L McGrath
98f824aa22 Dont use absolute pathname (dunno why i did that), fix tar filename/stdin problems 2002-10-19 00:46:35 +00:00
Glenn L McGrath
934805aec1 Put bac kthe code that handles cases where a '-' wasnt specified prior to the options. 2002-10-18 23:59:40 +00:00
Eric Andersen
2a2ab1479c Fix an obvious thinko
-Erik
2002-10-18 22:31:02 +00:00
Eric Andersen
71ae64bdc6 last_patch61 from vodz:
New complex patch for decrease size devel version. Requires previous patch.
    Also removed small problems from dutmp and tar applets.
Also includes vodz' last_patch61_2:
    Last patch correcting comment for #endif and more integrated
    with libbb (very reduce size if used "cat" applet also).
    Requires last_patch61 for modutils/config.in.
2002-10-10 04:20:21 +00:00
Glenn L McGrath
2983330512 Fix segfault when testing if reaidng from stdin "-" 2002-10-06 23:25:23 +00:00
Eric Andersen
02e6ba91e8 Vodz' last_patch57:
Hi, Erik.

    my_getpw(uid/gid) and applets used it have problem:
    if username for uid not found, applets can`t detect it
    (but code pessent). Also "%8ld " format is bad:
    spaces not required (applets have self format
    or spec format (tar applet) and overflow for "id" applet...)
    This problem also pressent in stable version.
    Patch for unstable in attach.

    --w
    vodz
2002-09-30 20:39:56 +00:00
Eric Andersen
d9d47c3078 Patch from Konstantin Isakov <ikm@pisem.net>:
In most cases, dirname returns the same argument it was given, so this code
    works nice, but there's one special case: when the name contains no
    dirname, it returns "." (stored statically in the body of itself), and we
    get a segfault in attempt to free() it.
This patch fixes this problem.
2002-09-30 20:14:57 +00:00
Glenn L McGrath
5c99581880 Save status so we know if to delete compressed file 2002-09-30 05:30:29 +00:00
Glenn L McGrath
8132e933e6 Fix for using '-' as the filename when reading from stdin 2002-09-28 02:06:39 +00:00
Glenn L McGrath
2e41d0cb77 Fix compress support and prevent a segfault 2002-09-27 06:46:02 +00:00
Glenn L McGrath
a47a3eada6 Fix simple define problem 2002-09-26 16:01:21 +00:00
Glenn L McGrath
69eab26401 Remove files made obsolete by new unarchiving code 2002-09-25 03:04:03 +00:00
Glenn L McGrath
7ca04f328e New common unarchive code. 2002-09-25 02:47:48 +00:00
Manuel Novoa III
6c32a8add4 Modified so that it "works" for archs other than i386... arm in particular.
Also tried to clean up the logic a little, and ensure that read errors
or invalid archives resulted in error returns.  This could use a lot more
work... Volunteers?
2002-09-17 21:02:16 +00:00
Eric Andersen
8fede28c74 Patch from Matthias Lang <matthias@corelatus.se> to fix gunzip
error handling and prevent gunzip from hanging.
2002-09-16 07:25:41 +00:00
Glenn L McGrath
b3c4e9add5 Support for GNU style long filename and linknames 2002-09-15 16:54:49 +00:00
Glenn L McGrath
c3b7f7d6e7 chmod on the NEW file 2002-08-26 17:17:27 +00:00
Glenn L McGrath
abac53b33c Reorganise, make it just one function, remove -v option it didnt work properly anyway, dont setvbuf it doesnt make any difference in performance. 2002-08-24 14:32:17 +00:00
Glenn L McGrath
1ee52e8b14 Run through indent, use braces 2002-08-24 10:30:36 +00:00
Glenn L McGrath
4534af2763 replace some global const ints with defines 2002-08-22 19:31:35 +00:00
Glenn L McGrath
0775a07d87 Specify cast 2002-08-22 19:22:32 +00:00
Glenn L McGrath
4cc2e5e944 Remove duplicate variable definition 2002-08-22 19:15:26 +00:00
Glenn L McGrath
9fef17dec3 Run through indent, fix comments 2002-08-22 18:41:20 +00:00
Glenn L McGrath
99b12543cf Run through ident, fix comments 2002-08-22 17:47:09 +00:00
Glenn L McGrath
a0ee881ba4 Run through indent, use /* */ style comments, change extern to static 2002-08-22 13:44:08 +00:00
Glenn L McGrath
d827e8b665 Run through indent 2002-08-22 13:21:26 +00:00
Glenn L McGrath
75762705a3 Honour the USTAR prefix field, this enables a 155 byte path length plus the normal 100 byte filename.
The catch is gnu tar cannot create archives that use the prefix field, you need to use s-tar.
2002-08-22 11:50:31 +00:00
Aaron Lehmann
8fc5d6d2da Tar inlining, #if 0 out unused function 2002-08-21 13:11:34 +00:00
Glenn L McGrath
1d23f3a492 Enable support for the old tar header format, enable via menu's 2002-08-13 05:06:43 +00:00
Robert Griebl
f2f26e7fdd Added tar -cz support (creating gzipped tar files without a gzip pipe) 2002-07-23 22:05:47 +00:00
Robert Griebl
d378c3149c Applied vodz' patches #49 and #50 (with a small correction in runshell.c)
#49: I found one memory overflow and memory leak in "ln" applet.
Last patch reduced also 54 bytes. ;)

#50: I found bug in loginutils/Makefile.in.
New patch have also new function to libbb and
aplied this to applets and other cosmetic changes.
2002-07-19 00:05:54 +00:00
Eric Andersen
2276d83639 Fixup warnings and undefined operations that show up in gcc-3.1
-Erik
2002-07-11 11:11:56 +00:00
Aaron Lehmann
9031481ac3 inline many functions that are only called once. saves about 300 bytes
on i386. also staticify most functions.
2002-06-23 22:13:22 +00:00
Aaron Lehmann
8c26fbe537 remove cleanUpAndFail, and replace it with exit(). because that's what
it does unless srcMode was set, and srcMode is never set.
2002-06-23 21:56:13 +00:00
Aaron Lehmann
9f92d5f2a2 Major revamp. I've been trying to clean up the code. the bzerror stuff
still needs major attention (i.e. removal).

Removed references to uninitialized variables like progName,
smallMode, noisy, etc. Remove functions and code for handling "small"
decompression mode, since it is all unreachable. Remove
total_{in,out}* counters - they are never used. Remove panic()
function and assert_h and their uses because they are all for "should
never happen" circumstances. Replace internal malloc/free wrappers
with xmalloc and free. Remove conditional in if(foo)free(foo);
situations. Remove bogus
	if (sizeof(int) != 4) {
		return BZ_CONFIG_ERROR;
	}
(...etc...) code and code for handling BZ_CONFIG_ERROR. Someone should
go through and change the applet to use well-defined types when
appropriate - it expects sizeof(short)==2 && sizeof(int)==4. Until
this commit these were explicitly checked for, and the applet would
exit if these types were not the right size. (I think this is wrong
even as an interim solution.)

With gcc 3.1 reduces size of binary on i386-linux by about 700 bytes.

Lightly tested.
2002-06-22 06:35:29 +00:00
Glenn L McGrath
a94a06a38e Patch from Randolfe Averty to fixup package conflict checks, cleanup some memory leaks and reorganise dependency checking.
Some further memory leaks fixed by me.
2002-05-29 13:45:34 +00:00
Robert Griebl
94a6a956f0 Support old-style compress (.Z) files via libbb / unzip( ) calls
(configurable) - When enabled an applet "uncompress" is also made
available (oddname to gunzip)
[the cvs add for this file got lost somehow...]
2002-05-19 19:00:14 +00:00
Robert Griebl
f6495eb767 Support old-style compress (.Z) files via libbb / unzip( ) calls
(configurable) - When enabled an applet "uncompress" is also made
available (oddname to gunzip)
2002-05-15 22:13:47 +00:00
Robert Griebl
7ac868460a gunzip'ing many files to stdout works now
Fixed a missing initialisation and made a for loop more readable.
2002-05-15 21:57:42 +00:00
Robert Griebl
081df62b92 Don't delete source file when decompressing to stdout
This is the normal GNU gunzip behaviour
2002-05-15 21:45:52 +00:00
Matt Kraai
a4a65e7f99 * archival/gunzip.c (gunzip_file): New.
(gunzip_main): Handle no arguments correctly.
2002-04-29 15:32:32 +00:00
Matt Kraai
a0782684fd * archival/bunzip2.c (bunzip2_main): Do not remove files if writing to standard
output.
* testsuite/bunzip2/bzcat-does-not-remove-compressed-file: New.
2002-04-15 15:01:37 +00:00
Eric Andersen
d75ac02a4f Rework per how I did things in version in 0.60.3 so it can
properly uncompress multiple files now.
 -Erik
2002-04-13 09:10:34 +00:00
Eric Andersen
114de55668 Patch from Laurence Anderson <L.D.Anderson@warwick.ac.uk> for
better tape drive support in tar/cpio by using an intervening
pipe...
2002-04-13 08:43:01 +00:00
Eric Andersen
1d1d2f9b18 Update some missing copyright notices 2002-04-13 08:31:59 +00:00
Eric Andersen
85208e2ab9 Completely rework the config system so that it no longer annoys me to work on
the busybox development tree.  This eliminates the use of recursive make, and
once again allows us to run 'make' in a subdirectory with the expected result.
And things are now much faster too.  Greatly improved IMHO...
 -Erik
2002-04-12 12:05:57 +00:00
Eric Andersen
50e4d660ac Fix email addr 2002-04-06 05:15:46 +00:00
Matt Kraai
cf32ac543c * archival/bunzip2.c (bunzip2_main): Remove compressed file.
* testsuite/bunzip2/bunzip2-removes-compressed-file: New.
2002-03-27 17:46:44 +00:00
Matt Kraai
9cdb0601eb * archival/bunzip2.c: Include <unistd.h>.
(bunzip2_main): Read data from standard input if FILE argument is `-' or
  omitted.
* include/usage.h (bunzip2_trivial_usage, bunzip2_full_usage): Rewrite.
* testsuite/bunzip2/bunzip2-reads-from-standard-input: New.
2002-03-27 17:31:01 +00:00
Matt Kraai
ef8b112d77 * archival/gzip.c (gzip_main): Ensure that the output is a terminal and use
error_msg to display the error message.
2002-03-22 22:55:51 +00:00
Eric Andersen
89de1e7930 Reinitialize initial shift register value for on each pass.
-Erik
2002-03-20 13:30:40 +00:00
Glenn L McGrath
02a415606c Parse the include list to writeTarFile rather than argv, fixes a bug where tar files wernt being created. 2002-02-15 05:15:03 +00:00
Glenn L McGrath
8833a51781 Fix condition that prevented creation of compressed files 2002-02-13 03:32:11 +00:00
Matt Kraai
9bd49d6a22 * archival/gzip.c (ifname, ofname): Delete.
(gzip_main): Handle multiple files.
* include/usage.h (gzip_trivial_usage): Allow multiple FILEs.
  (gzip_full_usage): Ditto.
* testsuite/gzip/gzip-accepts-multiple-files: New.
* testsuite/gzip/gzip-removes-original-file: New.
2002-02-05 22:31:48 +00:00
Matt Kraai
592a3e63ee * archival/gzip.c (gzip_main): Display usage if given multiple files. 2002-02-05 19:34:53 +00:00
Matt Kraai
b75b6e2c35 * archival/tar.c (tar_main): Remove unused variable. 2002-01-08 16:03:41 +00:00
Matt Kraai
39fcb5a750 * archival/dpkg.c (create_list): Use chomp.
* archival/tar.c (append_file_list_to_list): Likewise.
2002-01-02 19:01:41 +00:00
Glenn L McGrath
87ac7028e0 unzip applet by Laurence Anderson
----------------------------------------------------------------------
2002-01-02 13:52:26 +00:00
Matt Kraai
1f0c43668a Remove == TRUE' tests and convert != TRUE' and `== FALSE' tests to use !. 2001-12-20 23:13:26 +00:00
Matt Kraai
31c73af656 Perform clean up only if CONFIG_FEATURE_CLEAN_UP is defined. 2001-12-20 22:30:14 +00:00
Matt Kraai
2b1effdbbc Write files when extracting an archive from standard input. 2001-12-20 22:09:31 +00:00
Eric Andersen
f3f9062ecf Things like 'tar -c /tmp/*' and 'tar -cO /tmp/*' where the output
filename was not explicitly specified were segfaulting.
 -Erik
2001-12-18 00:57:55 +00:00
Eric Andersen
db930948a9 More copyright and email addr cleanups 2001-12-06 08:20:14 +00:00
Aaron Lehmann
b9df470c4d Commit my improvement on Rodney Brown's patch to g(un)zip, decreasing
binary size.
2001-12-06 03:22:43 +00:00
Glenn L McGrath
249f39a265 Simplify unzip(), remove unused checks and unneccessary variables 2001-12-05 16:01:02 +00:00
Glenn L McGrath
ef03dbcd4d Simplify CRC table generation 2001-12-05 13:08:03 +00:00
Glenn L McGrath
aad44fb37a Fix some fegfaults and picket fence 2001-12-05 04:40:52 +00:00
Glenn L McGrath
1dbbd2fe34 Fail gracefully if package depends on a virtual package. 2001-12-05 04:10:14 +00:00
Glenn L McGrath
38288bbf4c gunzip was incorrectly reporting a failed crc and length (discovered by
Chang, Shu-Hao).  The bitbuffer needs to be unwound after decompression,
as it was eating into the crc/size field.
2001-11-29 06:36:56 +00:00
Matt Kraai
efd7f03657 Fix opt type in dpkg (closes: #118975). 2001-11-19 21:07:15 +00:00
Glenn L McGrath
fff11f1ab7 bzcat and bunzip -c support from Thomas Lundquist 2001-11-18 14:20:25 +00:00
Eric Andersen
9c6b5fcb0a Minor warning cleanups 2001-11-17 07:23:46 +00:00
Matt Kraai
c8227639db Change strdup calls to xstrdup (patch from Steve Merrifield). 2001-11-12 16:57:27 +00:00
Matt Kraai
9fb38f600c Eliminate unused variable warnings. 2001-11-12 16:45:23 +00:00
Matt Kraai
a5f09c668e Use fopen wrapper. 2001-11-12 16:44:55 +00:00
Eric Andersen
7131213460 config.in features patch from Giulio Orsero <giulioo@pobox.com>
with some minor edits from me
2001-11-10 09:53:23 +00:00
Glenn L McGrath
0a25b35c66 Fix create list segfault 2001-11-03 08:29:35 +00:00
Glenn L McGrath
7134d6581b Attempt to fix libc compiling error regarding off_t 2001-10-27 13:14:52 +00:00
Eric Andersen
c265b17550 Wrap exclude_file() inside a #ifdef CONFIG_FEATURE_TAR_EXCLUDE block 2001-10-27 03:20:00 +00:00
Glenn L McGrath
ee28362597 Menu entry for tar creation support 2001-10-25 18:37:41 +00:00
Glenn L McGrath
ef0eab514d Recovering from my previous commit 2001-10-25 14:49:48 +00:00
Glenn L McGrath
0d2fb76c11 Modify applets to use libunarchive 2001-10-25 14:26:05 +00:00
Glenn L McGrath
95ebf618b7 *** empty log message *** 2001-10-25 14:18:08 +00:00
Matt Kraai
3c2f27d9f1 Add CONFIG_FEATURE_TAR_EXCLUDE support. 2001-10-24 18:51:27 +00:00
Eric Andersen
99702ab221 Fix variable name -- was stuck at the old RPMUNPACK value. Doh! 2001-10-24 17:37:07 +00:00
Eric Andersen
bdfd0d78bc Major rework of the directory structure and the entire build system.
-Erik
2001-10-24 05:00:29 +00:00
Glenn L McGrath
6ccdd8c122 Abort if scripts return value != 0 2001-10-23 17:52:28 +00:00
Matt Kraai
a7512d74fa Process extra empty lines correctly. 2001-10-18 17:03:59 +00:00
Matt Kraai
3dd4f5ed69 Remove xmalloc calls. 2001-10-18 15:08:30 +00:00
Eric Andersen
74400ccfd0 Scrub up some function prototypes.
-Erik
2001-10-18 04:11:39 +00:00
Glenn L McGrath
4bef7b4186 unarchive function changed to support both exclude and include lists, applets that use unarchive changed to match. 2001-10-13 19:43:46 +00:00
Glenn L McGrath
051eee6ed3 Reverse part of previous change.... i think it was the wrong approach... im lost 2001-10-13 07:11:03 +00:00
Glenn L McGrath
d642a67928 Match subdirectories of included/excluded files 2001-10-13 06:54:45 +00:00
Glenn L McGrath
0e766183ee Superficial changes to make the exclude/include code easier to understand 2001-10-13 05:03:29 +00:00
Matt Kraai
f86bbfaddd Fix tar segfault when include list is empty and exclude list is not. 2001-10-12 19:00:15 +00:00
Glenn L McGrath
30f68908ef Another part of Stafan's latest patch, when replacing a pre-existing package set its status correctly. 2001-10-06 02:40:20 +00:00
Glenn L McGrath
f28d819554 status_package_num should refer to package not status.
Only initialise a new entry in the status hashtable if it really is a new entry.
2001-10-06 02:27:36 +00:00
Glenn L McGrath
24e2833cdf Initial support for for bunzip2....
This code could be improvemed by
 1) supporting more options,
 2) Creating a shared crc table with gunzip, or perhaps generated on the fly.
 3) Removing any remaining unneccessary code (e.g. if (noisy))
2001-10-05 03:48:57 +00:00
Glenn L McGrath
2e772edacf Change extraction/list code to use common unarchive code. 2001-10-05 02:58:48 +00:00
Glenn L McGrath
a8412dbf39 Fixes with help from Stefan, Typo in prerm script, and when reinstall a package the old packages status was getting overwritten. 2001-10-04 05:22:42 +00:00
Glenn L McGrath
35636540ea Extract control.tar.gz and data.tar.gz unconditionally, another one picked up by Stefan 2001-10-03 03:10:35 +00:00
Glenn L McGrath
95bfe631a4 Fix return status, picked up by Stefan 2001-09-29 03:34:38 +00:00
Glenn L McGrath
dece3c5684 The <package>.list file was prepending "./" to the files, fixed that.
Also fixed a very silly error by me when running postinst (remember to use the variable BEFORE its freed)
2001-09-22 04:16:55 +00:00
Glenn L McGrath
b8f5adb64f Dont free everytime getline() is used, fix from Stefan Soucek 2001-09-22 03:24:07 +00:00
Glenn L McGrath
48cc89b738 Fix to make preinst run when required, from Stefan Soucek 2001-09-21 05:07:47 +00:00
Glenn L McGrath
e73866181f Implement dpkg -l option, from Stefan Soucek (slightly modified) 2001-09-21 04:30:51 +00:00
Eric Andersen
dcbca62e89 Standard typing (u_int16_t instead of u16, u_int32_t instead
of u32, etc) cleanups from Laurence Anderson <laurence@zxmail.com>
2001-08-29 19:02:26 +00:00
Matt Kraai
ac20ce1924 Canonicalize dirname(3) behavior. 2001-08-24 19:51:54 +00:00
Eric Andersen
39eb040757 Patch from Rodney Brown <RDBrown@mira.net>, shrinking 1.5k
from gzip by careful optimization.  Appears to work just fine
(I've tested the changes on x86, ARM, and powerpc).
2001-08-22 04:15:47 +00:00
Glenn L McGrath
bac490fe53 Fix version comparision bug 2001-08-15 11:25:01 +00:00
Glenn L McGrath
7499918f30 If filename is a '-' then read from stdin to stdout 2001-07-30 04:48:50 +00:00
Glenn L McGrath
81108e7653 Cleanup (most) memory leaks 2001-07-19 12:15:13 +00:00
Glenn L McGrath
c3fbec73fb Change read_package_field interface, and rewrite using low level functions
Fixes for a few bugs that have crept into dpkg in the last few days
2001-07-18 15:47:21 +00:00
Glenn L McGrath
778041f8d1 Use the unofficial -C instead of -c to --configure a package, -c conflicts with another dpkg command 2001-07-18 05:17:39 +00:00
Glenn L McGrath
ed4492a697 More feedback to user 2001-07-18 05:03:49 +00:00
Glenn L McGrath
7b0241579c Be more verbose when configureing package, minor changes 2001-07-18 04:33:31 +00:00
Glenn L McGrath
4cdc607f72 Use xfopen to abort on error to prevent segfaulting later. 2001-07-18 03:13:49 +00:00
Eric Andersen
044228d5ec This is vodz' latest patch. Sorry it took so long...
1) ping cleanup (compile fix from this patch already applied).
    2) traceroute call not spare ntohl() now (and reduce size);
    3) Fix for functions not declared static in insmod, ash, vi and mount.
    4) a more simple API cmdedit :))
    5) adds "stopped jobs" warning to ash on Ctrl-D and fixes "ignoreeof" option
    6) reduce exporting library function index->strchr (traceroute), bzero->memset (syslogd)
2001-07-17 01:12:36 +00:00
Glenn L McGrath
a868ec89e8 Allow the unarchive() extract_list variable to be NULL, meaning extract all 2001-07-14 08:49:53 +00:00
Glenn L McGrath
58a5bd187d Tolerate fields with no data, e.g. "Depends: " 2001-07-14 06:25:54 +00:00
Glenn L McGrath
ccd65c9be6 Total rewrite, uses hash tables for speed and low memory use. 2001-07-13 18:35:24 +00:00
Glenn L McGrath
5e66a26eaa Dont setvbuff in here, must be called just after stream is initialised, glibc tolerates using it later, uclibc doesnt 2001-07-13 06:51:56 +00:00
Glenn L McGrath
26a0d9a945 Call setvbuf from here isntead of gz_open for compatability with uclibc 2001-07-13 06:49:18 +00:00
Glenn L McGrath
b028e08d35 Move setvbuf calls from gz_open() to calling functions, setvbuf is only supposed to be called prior to opening the stream, glibc tolerates later use, uclibc doesnt. 2001-07-13 06:43:03 +00:00
Glenn L McGrath
c127008840 Allow unarchive to redirect stdout (tobe used by dpkg applet) 2001-07-11 17:32:14 +00:00
Glenn L McGrath
93febe672a free coniditionally, just to make it play nice with dmalloc which is incompatable with standard free() 2001-07-11 07:25:01 +00:00
Glenn L McGrath
59e50f634a Unpack the filename not the package name 2001-07-11 03:30:11 +00:00
Matt Kraai
5710f9f690 Read 20 512-byte blocks at a time (like GNU tar). 2001-07-10 15:05:39 +00:00
Eric Andersen
807bda4a24 Minor update to include file ordering 2001-07-07 08:13:02 +00:00
Matt Kraai
623cfa99e5 Remove a redundant call to mkdir. 2001-07-03 20:55:30 +00:00
Eric Andersen
3073dfbf30 Patch from Aaron Lehmann <aaronl@vitelus.com> to scrub a ton of
portability junk from gzip.c, making it a zillion times more readable.
2001-07-02 17:57:32 +00:00
Manuel Novoa III
a2949aa217 Add some missing includes to kill warnings when building with the default
Config.h and using gcc's -fno-builtin.  There are probably other files
with the similar problems.
Also, if building against uClibc, don't include asm/unistd.h in syscalls.c
and module_syscalls.c.
2001-06-29 18:59:32 +00:00
Eric Andersen
0d8cc1670c Fix a type promotion bug discivered and analyzed by Alan Modra
<amodra@bigpond.net.au>, which caused false checksum errors
2001-06-27 06:15:50 +00:00
Glenn L McGrath
f8736d251e rpm2cpio applet by Laurence Anderson 2001-06-26 01:19:34 +00:00
Eric Andersen
24982c589b Fix up some warnings that show up on ppc 2001-06-25 19:31:48 +00:00
Glenn L McGrath
2e6d3cfa82 Nore unarchive (and doc) fixes from Laurence Anderson 2001-06-24 12:36:54 +00:00
Glenn L McGrath
8f5b63edea cpio applet, and changes to associated code 2001-06-22 09:22:06 +00:00
Tim Riker
837097648e comment cleanup 2001-06-22 00:27:11 +00:00
Matt Kraai
ceeff73819 Rewrote mkdir (and touched lots of things in the process). 2001-06-21 19:41:37 +00:00
Eric Andersen
091781e20e Support tar -C, per bug #1176
-Erik
2001-06-21 19:30:10 +00:00
Eric Andersen
ea4abff595 Add in (and ignore) tar -p, since we preserver permissions automatically.
closes bug #1185
 -Erik
2001-06-21 15:17:59 +00:00
Eric Andersen
aff5e2eaef it turs out, there was a nasty tar bug where bb tar would create leading dirs
with mode 0777 in all cases due to usask issues.  Thanks to Matt Kraai for
noticing and spotting the culprit.  This makes bb tar behave just like GNU
tar once again.
 -Erik
2001-06-20 20:47:31 +00:00
Glenn L McGrath
06a71cced2 Initialise in_file to stdin, so it wont crash if no source specified 2001-06-20 08:07:34 +00:00
Glenn L McGrath
8e74bf94f3 Changed gz_open to ruturn a stream 2001-06-20 07:54:15 +00:00
Glenn L McGrath
eb1c94078f Reorganise unarchiving functions, more code re-use, only does single pass(no more linked lists), basis for supporting a cpio (and cheaper untar) applet, but cpio applet isnt included in this.
It effects ar, dpkg-deb applets only
2001-06-20 07:48:00 +00:00
Glenn L McGrath
9aff903603 Reorganise archive extraction code 2001-06-13 07:26:39 +00:00
Eric Andersen
cb2a372c9f Revert the patch from Konstantin Boldyshev <konst@linuxassembly.org> to never
change permissions on existing directories.  This behavior is contrary to SUSv2
and contrary to GNU tar.  Thanks to Matt Kraai for pointing this out.  I should
have been much more careful about accepting such a patch.
 -Erik
2001-06-04 16:54:39 +00:00
Eric Andersen
5a9d441b2c Fix up some signed char vs int issues that show up on powerpc. 2001-05-24 14:16:28 +00:00
Eric Andersen
77d9268892 Patch from larry to fix some grammar errors. 2001-05-23 20:32:09 +00:00
Matt Kraai
117231c44f Make - read compressed data from stdin (thanks to Marius Groeger). 2001-05-22 14:23:02 +00:00
Matt Kraai
7f7348b7b2 Correctly remove leading slashes upon extraction (thanks to Marius Groeger). 2001-05-22 14:18:03 +00:00
Matt Kraai
7cedac567c Remove unused function. If necessary, we can use remove_file instead. 2001-05-17 04:03:22 +00:00
Matt Kraai
59df6f7398 Change 'printf("%s\n", ...)' into 'puts(...)'. Noted and patched in hostname.c
by Larry Doolittle.
2001-05-16 14:21:09 +00:00
Eric Andersen
a17b3631fe Do not ever change permissions on existing directories, only
on directories we created while extracting a tarball.  Fix
based on bug report and patch from Konstantin Boldyshev
<konst@linuxassembly.org>
 -Erik
2001-05-13 15:39:30 +00:00
Eric Andersen
28355a36da Per some comments from Lars Kellogg-Stedman <lars@larsshack.org>,
make xreadlink() return NULL on failure, and make sure everyone
uses the interface correctly.
 -Erik
2001-05-07 17:48:28 +00:00
Glenn L McGrath
713b398700 woops, forgot the break statment 2001-05-07 12:06:37 +00:00
Glenn L McGrath
5bcfc9ba1a Tolerate -q argument, if -q is passed give a warning and continue rather than just fail 2001-05-07 12:01:58 +00:00
Matt Kraai
e0244b0642 Skip headers with empty filenames, rather than stopping. 2001-05-01 21:12:31 +00:00
Mark Whitley
8a633268ef Made new xreadlink function for libbb and changed applets to use it instead of
readlink(2).
2001-04-30 18:17:00 +00:00
Glenn L McGrath
af166e7ce0 Logic reversal for last_char_is 2001-04-29 00:50:33 +00:00
Eric Andersen
c1bdffe99b Another nice cleanup from Larry. This adds a new last_char_is() function and
uses it to avoid possible buffer underruns whn strlen is zero, and avoid the
possible space-hogging inline of strlen() in several cases.
 -Erik
2001-04-26 15:56:47 +00:00
Eric Andersen
04095e58fb Move messages.c to libbb. Make each string in messages.c be its own .o file.
This way, we can new get rid of all that tedious #define rubbish we used to
need to enable specific messages.  This way is enormously simpler, and as a
bonus also ends up saving us 96 bytes.
 -Erik
2001-04-25 05:39:18 +00:00
Matt Kraai
53265546a6 Eliminate spurious warning, convert to getopt, and eliminate redundant check. 2001-04-18 16:05:34 +00:00
Matt Kraai
96dcd19b8a Fix a number of problems with argument handling. 2001-04-18 15:54:09 +00:00
Matt Kraai
54652230d4 Eliminate a segfault when called on an existing file with out an extension:
touch foo && gunzip foo
2001-04-18 15:51:45 +00:00
Matt Kraai
b181056e06 Eliminated seeks so that we work correctly on pipes, and removed reliance on
undefined evaluation ordering.  Thanks to Anthony Towns for explanation and
solution.
2001-04-18 14:49:55 +00:00
Glenn L McGrath
bcfeb2ac44 Fix zcat/gunzip when reading from stdin 2001-04-18 13:34:09 +00:00
Glenn L McGrath
ae1c704c44 Write full status file 2001-04-16 10:26:46 +00:00
Glenn L McGrath
33431ebb9a dpkg improvements, use full package struct, avoid extracting to tmp dir, rename variable.
deb_extract, untar and dpkg_deb modified to make the above possible
2001-04-16 04:52:19 +00:00
Glenn L McGrath
445fb952b8 dpkg-deb -f and partial -I commands, adds 600 bytes 2001-04-13 04:02:57 +00:00
Glenn L McGrath
47fd219c95 Rename variable that shadows global 2001-04-12 16:37:13 +00:00
Glenn L McGrath
3e2ab88ee2 New dpkg-deb function -t, stands for --fsys-tarfile 2001-04-12 13:49:09 +00:00
Glenn L McGrath
6785b51280 dpkg-deb -c works now 2001-04-12 11:48:02 +00:00
Glenn L McGrath
359c106871 Fix dpkg-deb, enum's are cool 2001-04-12 10:19:08 +00:00
Glenn L McGrath
2975a34f23 readTarFile changed from exter nto static 2001-04-11 16:49:07 +00:00
Glenn L McGrath
4949faf4b2 copy_file_chunk uses streams now. 2001-04-11 16:23:35 +00:00
Glenn L McGrath
f70f6cef39 Disable sigterm 2001-04-11 15:09:30 +00:00
Glenn L McGrath
48081f81bd replace getOctal with strtol( , NULL, 8)
saves 100 Bytes
2001-04-11 05:01:09 +00:00
Glenn L McGrath
528ef50a4a Gzip is indepenedent of gunzip 2001-04-11 03:45:37 +00:00
Glenn L McGrath
7fd92949d0 Move unzip, gz_open, gz_close to libbb 2001-04-11 03:11:33 +00:00
Glenn L McGrath
d22e560ad6 Move deb_extract() to libbb, dpkg now independent of dpkg-deb 2001-04-11 02:12:08 +00:00
Glenn L McGrath
9d53c8ab74 Move get_ar_headers to libbb, make dpkg_deb.c independent of ar.c 2001-04-11 01:37:03 +00:00
Eric Andersen
e5dfced23a Apply Vladimir's latest cleanup patch.
-Erik
2001-04-09 22:48:12 +00:00
Glenn L McGrath
305fdfa755 Reorganise status field to use 3 chars instead of one bit shifted long int.
Generates status file properly now, not compatable with full dpkg yet.
2001-04-08 13:27:39 +00:00
Glenn L McGrath
37849f3320 Use create_path instead of mkdir 2001-04-08 07:23:53 +00:00
Glenn L McGrath
13e9c7ad82 It now correctly backs up the (still corrupt) status file 2001-04-08 07:18:08 +00:00
Glenn L McGrath
0e757a2f3f Some fixes, but still broken... (cont)
Make better use of some libbb functions
New remove dir code to avoid depending on the rm applet
dont use copy_file() it doesnt fail elegantly
Use getopt.
Generate correct /var/lib/dpkg/info/ files
Status file is broken, working on it now
2001-04-08 05:27:18 +00:00
Glenn L McGrath
f608da4288 Ignore SIGTERM prior to gz_close() 2001-04-07 02:40:59 +00:00
Glenn L McGrath
e5f3957665 Fix warning 2001-04-07 02:17:36 +00:00
Eric Andersen
83f173b61e A first pass at making D_FILE_OFFSET_BITS=64 work, from
Jari Ruusu <jari.ruusu@pp.inet.fi>
2001-04-05 23:07:25 +00:00
Eric Andersen
4e2439ad27 It seems all the stdout munging was useless anyways, since
deb_extract and all its called functions do nothing with
stdout anyways.  Axe that stuff.
 -Erik
2001-04-05 18:30:38 +00:00
Eric Andersen
fdefbbbe85 dpkg_deb had not been updated for the new gunzip interface. Fix it.
-Erik
2001-04-05 06:04:11 +00:00
Eric Andersen
e76c3b08e1 A number of cleanups. Now compiles with libc5, glibc, and uClibc. Fix a few
shadowed variables.  Move (almost) all syscalls to libbb/syscalls.c, so I can
handle them sanely and all at once.
 -Erik
2001-04-05 03:14:39 +00:00
Eric Andersen
3a6da8c183 gz_open and gz_close were left in, even when BB_FEATURE_TAR_GZIP was disabled.
Fix that.
2001-03-29 14:22:45 +00:00
Glenn L McGrath
5f2ef46d6d Fix zcat 2001-03-29 01:07:54 +00:00