summaryrefslogtreecommitdiffstats
path: root/libbb
Commit message (Collapse)AuthorAgeFilesLines
* Ensure we use the uname/gname fields when extracting tarballspixdamix@gmail.com2012-11-221-2/+47
| | | | | | | | | | | | When updating packages on the target device we ideally want to match user and group numbers from the existing file system. This patch encourages opkg to lookup the uname/gname fields first and only use the hardcoded numerical values if that fails. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> git-svn-id: http://opkg.googlecode.com/svn/trunk@637 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Allow vfork()ing an external gunzip binary instead of using fork().graham.gower@gmail.com2011-02-171-10/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Patch from Mike Westerhof, with minor modifications to allow the use of both GNU gunzip and busybox gunzip. His original patch header follows. This patch allows a user to set an environment variable to cause opkg to select either the built-in gunzip code or an external gunzip utility, in order to dodge the OOM Killer. The built-in code is, of course, is the most desirable way to use opkg, since it is far more efficient. However, the built-in code can trigger the OOM (out of memory) killer on small-memory machines, like the 32MB NSLU2. This occurs because a standard fork will duplicate the entire address space of the parent. Since opkg reads the entire feed database into memory, this problem is compounded by large feeds. This patch introduces a means for the user to cause opkg to use vfork() instead -- vfork() does not behave in the same manner as fork(), and does not trigger the OOM killer. However, the semantics of vfork() are such that it cannot run the built-in gunzip code. Instead, it must exec() an external utility to perform the gunzip operation. It seems counter-intuitive, but the vfork()/exec() approach is the only good way to avoid triggering the dreaded OOM killer. In order to use this, the user must manually set the OPKG_USE_VFORK environment variable to any value. For example: $ OPKG_USE_VFORK=1 opkg install samba The external utility used to do the gunzip operation is "busybox gunzip". It would have been nice to be able to just invoke "gunzip", but the full gunzip executable behaves slightly differently than does busybox, generating annoying warning messages. This is an update of the original patch by Mike Westerhof, Dec 2008. Mike Westerhof, Feb 2011 git-svn-id: http://opkg.googlecode.com/svn/trunk@604 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Don't truncate long symlink paths.graham.gower@gmail.com2010-12-221-26/+29
| | | | | | | | | | | | | | | | | Patch from Richard Purdie. Tracked as Issue #72. Original patch header follows. If a tarball contains a long symlink (over 100 chars) in a longpath (over 100 chars) then the resulting link or path can be truncated to 100 chars. This is due to a bug where if both 'L' and 'K' entries are found in the tarball, only the first one takes affect due to get_header_tar recursively calling itself. To fix this, process longname and linkname at the end of the function rather than the start after any subcalls have taken place. Richard Purdie 22/12/2010 git-svn-id: http://opkg.googlecode.com/svn/trunk@594 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Fix if statement with empty body due to stray semicolon.graham.gower@gmail.com2010-12-121-1/+1
| | | | | | Found with Clang. git-svn-id: http://opkg.googlecode.com/svn/trunk@588 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Remove an erroneous comment.graham.gower@gmail.com2010-11-101-1/+0
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@577 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Accept a leading "./" for the control file name, but don't mandate it.graham.gower2010-08-241-1/+6
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@558 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Remove trailing whitespace. Sorry if this breaks your patches.graham.gower2010-08-179-45/+45
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@552 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Fix creation of symlinks to files with long names (greater than 100 chars).graham.gower2010-08-031-7/+11
| | | | | | From "paradox.kahn", see Issue #55. git-svn-id: http://opkg.googlecode.com/svn/trunk@544 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Flush stdout, stderr before forking. From Richard Purdie. Thanks!graham.gower2010-02-151-0/+6
| | | | | | | | | | Patch to remove "duplicate" bits of logs from opkg output, which massively simplifies do_rootfs logs. The reason is we get unflushed data passed to the children and duplicated. RP - 26/1/10 git-svn-id: http://opkg.googlecode.com/svn/trunk@522 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Fix double free(). Found by Kosmaty (Issue 33). Thanks.graham.gower2009-12-181-1/+0
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@503 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Clarify why we're not using fseek(), use fseek() where applicable.graham.gower2009-12-101-5/+18
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@481 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Merge commit 'grg' into HEADgraham.gower2009-12-0814-338/+37
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@471 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Ignore extraction errors, for now. Requested by Koen.graham.gower2009-12-031-0/+1
| | | | | | | | | As opkg has never failed from these errors in the past, many recipes in OpenEmbedded have come to rely on this behaviour. So proceed regardless of extraction errors for now, to give the OE folks a chance to fix broken packages first. git-svn-id: http://opkg.googlecode.com/svn/trunk@445 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* patch for opkg_download.c compile abortpixdamix2009-12-011-0/+5
| | | | | | | | Fix problem wich may lead to FALSE and TRUE being redefined. Thanks to John L. for reporting this problem git-svn-id: http://opkg.googlecode.com/svn/trunk@413 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Check the unzip child process for errors and pass the upwards. Also, avoid ↵graham.gower2009-11-264-8/+53
| | | | | | child from being killed by SIGPIPE. git-svn-id: http://opkg.googlecode.com/svn/trunk@392 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Add error checking to deb_extract(), unarchive(), extract_archive(). et al.graham.gower2009-11-262-27/+57
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@390 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Name it after what it does: s/extract_to_stdout/extract_to_stream/graham.gower2009-11-262-2/+2
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@388 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* libbb.h cleanup.graham.gower2009-11-254-276/+6
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@385 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Various unarchive.c cleanups.graham.gower2009-11-251-54/+42
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@384 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Don't leak the ar_header or the tar_header.graham.gower2009-11-221-0/+3
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@347 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Fix hang in waitpid, exposed by r310. Patch from Enrico Scholzgraham.gower2009-11-191-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | <enrico.scholz@informatik.tu-chemnitz.de>, his analysis follows. libbb/unarchive.c: prevent opkg hang when subprocess is stuck in a write() call on a filled pipe and main process (which assumes that end of data from pipe has been reached) waits for this died subprocess. This patch swaps the original wait(pid) + close(pipe) sequencse so that pipe is closed first. The 'ar' code path has been fixed too by breaking the loop when requested data have been found. Previously, the loop continued at the (wrongly calculated) next position in the stream. The patch moves the stream cleanup at a better place. Variable declarations were moved to inner scopes too to ease detection of broken deallocation. NOTE: the | f = fdopen(...); | while (... /* do fread(f) */ ...) { /* ==1== */ | /* this is done in gz_open() */ | pid = fork(); | if (pid == 0) { | fread(f); /* ==2== */ | _exit(0); | } | } code looks problematic because '==2==' might update f's internal buffer. As ==2== is done in an own process, these changes are not seen by ==1==. It works only because gz_open() is called not more than one time and the loops break (after the patch). git-svn-id: http://opkg.googlecode.com/svn/trunk@340 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Remove unused function.graham.gower2009-11-172-119/+0
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@332 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Fix the warnings I created.graham.gower2009-11-161-0/+1
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@326 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Call _exit() and not exit() from within the child process.graham.gower2009-11-162-3/+4
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@325 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Remove dead code.graham.gower2009-11-154-58/+0
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@314 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Don't send the gzunp_pid SIGTERM. Waiting for exit should be sufficient.graham.gower2009-11-151-4/+0
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@310 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Free memory in error paths.graham.gower2009-11-151-2/+8
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@308 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* malloc -> xmallocgraham.gower2009-11-151-1/+1
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@307 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* The ": " is already added by vperror_msg... oops.graham.gower2009-11-151-4/+4
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@306 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Cleanup gz_close().graham.gower2009-11-152-21/+13
| | | | | | | | - Don't try to free() memory in a different process! - Move the function to a more appropriate file. - Fix error messages while here. git-svn-id: http://opkg.googlecode.com/svn/trunk@305 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Make the array const to fix warning.graham.gower2009-11-152-6/+2
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@304 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* I'm still seeing leaks here. So just stop allocating for these variables.graham.gower2009-11-151-8/+5
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@303 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* More cleanup in error paths to plug leaks found while installing dbus.graham.gower2009-11-101-4/+3
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@280 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Fix memory leaks.graham.gower2009-11-011-13/+21
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@233 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* The compiler almost certainly knows better.graham.gower2009-10-301-15/+15
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@228 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Fix implicit declaration of strnduppixdamix2009-10-281-1/+1
| | | | | | | | s/strndup/xstrndup/ Thanks to Graham Gower <graham.gower@gmail.com> git-svn-id: http://opkg.googlecode.com/svn/trunk@224 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Improve the poor man's fseek in unarchive.cpixdamix2009-10-271-6/+22
| | | | | | | | | | Modified seek_sub_file since the fgetc in the for loop was very slow when installing huge packages. A test on my machine showed a 4x gain when installing a large package (23Mib) git-svn-id: http://opkg.googlecode.com/svn/trunk@222 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Fix opkg doesn't handle long link/path names in tar files wellticktock352009-09-211-3/+4
| | | | | | | | | | | | | 1. provide opkg with a tar file that has a link name that is 100 characters or 2. provide opkg with a tar file that has a 'path_prefix' of 155 characters. Thanks to pblack88@gmail.com http://code.google.com/p/opkg/issues/detail?id=21 git-svn-id: http://opkg.googlecode.com/svn/trunk@217 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Thanks to claudyus84 and Gillesticktock352009-06-261-2/+2
| | | | | | | | | http://www.crisos.org/flyspray/index.php?do=details&task_id=10 Fix issue: http://code.google.com/p/opkg/issues/detail?id=4#c5 git-svn-id: http://opkg.googlecode.com/svn/trunk@214 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Thanks to Antonioticktock352009-03-261-0/+10
| | | | | | | | | | | Propagate gz_open() errors to caller function. This is not enough, it is still needed to check deb_extract return value everywhere in libopkg/pkg_extract.c Signed-off-by: Antonio Ospite <ospite@studenti.unina.it> git-svn-id: http://opkg.googlecode.com/svn/trunk@205 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Thanks to Krzysztof Kotlenga <pocek@users.sf.net>:ticktock352009-03-031-8/+8
| | | | | | | | | | | | | | Frans Meulenbroeks wrote: > Anyway, appending the 0 byte is no good as tar_entry->name[100] is > already out of bounds. http://tiny.cc/964UD looks good enough. It's interesting that we have to trace bugs already fixed upstream years ago. http://lists.linuxtogo.org/pipermail/openembedded-devel/2009-March/008510.html git-svn-id: http://opkg.googlecode.com/svn/trunk@203 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Thanks toticktock352009-02-121-0/+4
| | | | | | | | | | | | | | | | | | Frans Meulenbroeks http://groups.google.com/group/opkg-devel/browse_thread/thread/23c3557277de0f2e If a file name in a tar archive is exactly 100 bytes long the name field is completely filled and there is no terminating null byte; so extraction of the file will yield a name that is extended with the mode (e.g. 000644). The attached patch cures it although there might be better solutions. The problem is also in busybox tar and reported there too. Frans. git-svn-id: http://opkg.googlecode.com/svn/trunk@201 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* revert R190, keep R191ticktock352008-12-273-83/+6
| | | | | | | Waiting for the patch fixing bugs. git-svn-id: http://opkg.googlecode.com/svn/trunk@192 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* Thanks for Mike Westerhof <mwester@dls.net>ticktock352008-12-273-6/+83
| | | | | | | | | | | | | | | | | | | | | | ---------- This patchset updates the libbb stuff to use a vfork() version of gz_open, called gzvopen. This is done because a standard fork will duplicate the entire address space. This will invoke the OOM (out of memory) killer on small-memory machines, because most often by the time we unzip any package, we've read the entire package database into memory already. By using vfork() and immediatly execing the external gunzip utility, we avoid the need to clone the entire address space. Yes, this is actually **LESS** efficient than the original way! But there is no way to (currently) dodge the OOM killer on a per-process basis, so the alternatives are to either change the OOM killer behavior system-wide, or to use this workaround. Mike Westerhof, Dec 2008 git-svn-id: http://opkg.googlecode.com/svn/trunk@190 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* opkg: trivial, clean up obsolete code, and some typoticktock352008-12-151-20/+0
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@157 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* opkg: attached patch fixes build failures with gcc 4.3.2. patch by Enrico ↵ticktock352008-12-152-11/+0
| | | | | | Scholz -- thanks! git-svn-id: http://opkg.googlecode.com/svn/trunk@151 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* [opkg] trivial, remove unused variable resticktock352008-12-151-1/+0
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@148 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* opkg: (leak fixing, day 3) fixed final memory leaks fixed reported fromticktock352008-12-151-0/+2
| | | | | | | | running libopkg_test git-svn-id: http://opkg.googlecode.com/svn/trunk@116 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* opkg: fix some initialisation and double free issues in libbbticktock352008-12-152-2/+5
| | | | git-svn-id: http://opkg.googlecode.com/svn/trunk@85 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
* opkg/libbb: Patch from Esben Haabendal <esbenhaabendal gmail com>ticktock352008-12-141-6/+14
| | | | | | | | Fix the usage of dirname() in libbb/make_directory.c, as it is not correct according to the standard specification for dirname. git-svn-id: http://opkg.googlecode.com/svn/trunk@48 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358