Commit Graph

578 Commits

Author SHA1 Message Date
Rob Landley
a8b98d63e7 Don't document compiler warnings. _FIX_ compiler warnings. 2004-11-16 12:07:04 +00:00
Eric Andersen
0e020d1025 Make certain clients of bb_make_directory default to honoring
the user's umask
2004-10-13 06:25:52 +00:00
Eric Andersen
7daa076d3e egor duda writes:
Hi!

I've created a patch to busybox' build system to allow building it in
separate tree in a manner similar to kbuild from kernel version 2.6.

That is, one runs command like
'make O=/build/some/where/for/specific/target/and/options'
and everything is built in this exact directory, provided that it exists.

I understand that applyingc such invasive changes during 'release
candidates' stage of development is at best unwise. So, i'm currently
asking for comments about this patch, starting from whether such thing
is needed at all to whether it coded properly.

'make check' should work now, and one make creates Makefile in build
directory, so one can run 'make' in build directory after that.

One possible caveat is that if we build in some directory other than
source one, the source directory should be 'distclean'ed first.

egor
2004-10-08 07:46:08 +00:00
Eric Andersen
d952ee2e9e Make it more apparent that archive creation is not supported 2004-10-07 00:35:59 +00:00
Eric Andersen
b225e2a76b Fixup some warnings 2004-08-28 00:43:07 +00:00
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