Commit Graph

601 Commits

Author SHA1 Message Date
Rob Landley
3d1bbf0a5f Minor cosmetic fix from Tito. 2006-01-09 01:07:24 +00:00
Rob Landley
84cb76733f patch from tito: consolidate delay functions as bb_do_delay() 2006-01-06 20:59:09 +00:00
Rob Landley
9085467970 Trying to losetup a device as a regular user shouldn't result in an endless
loop, and the error messages should display correctly now.
2005-12-21 16:53:57 +00:00
Rob Landley
e422af6bcb Flush input when prompting for a password (bug 373). 2005-12-12 07:02:15 +00:00
"Vladimir N. Oleynik"
bf968f71f1 reduce signedness warning 2005-12-02 10:10:28 +00:00
Rob Landley
1d589b2e2d Fix losetup so that it A) actually works again, B) has much better error
messages, C) can show the current association (if any) when called
with only one argument.  Update the documentation a lot too.

Remind me to add a test suite for this thing.  I think I've figured out
how to handle root-only testsuites...
2005-11-29 23:47:10 +00:00
"Vladimir N. Oleynik"
cc34344d91 change the interface of libbb/compare_string_array (unsigned short to int), usaging for e2fsprogs/fsck 2005-11-26 10:45:26 +00:00
"Vladimir N. Oleynik"
61ff4b3973 more use const for interface of libbb/compare_string_array, example usage for e2fsprogs/fsck 2005-11-26 10:33:55 +00:00
"Vladimir N. Oleynik"
4eb2fd6826 more use libbb/bb_msg_read_error 2005-11-25 11:36:36 +00:00
Rob Landley
b4c823211d Move interface.c to networking directory since it's only used by ifconfig. 2005-11-22 07:52:54 +00:00
Rob Landley
9033453c18 My last change to this file broke tar x. Sigh. (Trying to make sure we work
on file sizes between 2 and 4 gigs on 32 bit machines.  For supporting >4 gigs,
just use a 64 bit machine already...)
2005-11-12 11:04:11 +00:00
Rob Landley
3fc4ad1478 Fix bug 424: doing full_read breaks things like cat which should return a
chunk of data when they get it and not block until they've buffered 4k.

The use case was cat /proc/psaux, but you can also reproduce this by
running non-busybox cat by itself and typing things at the command line.
Then run busybox cat.  Notice how cat is _supposed_ to echo each line back
to us as we hit enter?
2005-11-04 01:54:15 +00:00
Rob Landley
21ccbb6c0e When cp ran out of space it didn't return a nonzero error code. Fixes bug 493. 2005-11-04 01:20:46 +00:00
Rob Landley
2f30932eca Fix cp /dev/null filename, and a few in-passing cleanups. 2005-11-01 21:55:14 +00:00
Rob Landley
2454ebd85d Somebody suggested this, but I've forgotten who. 2005-10-27 22:50:04 +00:00
Rob Landley
3c6bfe3e33 Shaun Jackman noted that limits.h defines path_max and isn't included from
find_root_device.c.  (We #include it in busybox.h but not libbb.h, it seems.
Someday, someone's going to have to clarify for me the difference between
those two...)
2005-10-25 02:22:13 +00:00
"Vladimir N. Oleynik"
0fa9deda17 more const 2005-10-20 09:48:28 +00:00
Bernhard Reutner-Fischer
7547a6e2f6 - don't update copyright years. He might release it, but apparently will have
to update the year himself.
2005-10-15 20:56:31 +00:00
Bernhard Reutner-Fischer
94c3331d47 - an empty middle term in ?: violates ISO C
- use shorter boilerplate and use C89 style comments
2005-10-15 14:13:09 +00:00
"Vladimir N. Oleynik"
6f347ef9dc common BUFSIZ BSS buffer, small reduce code, data and bss 2005-10-15 10:23:55 +00:00
"Vladimir N. Oleynik"
f704b27b5b - new bb_opt_complementally syntax, use [-:?] only - 'free' chars
- new bb_getopt_ulflags features: check max and min args, convert first argv to options special for ar and tar applets
- use bb_default_error_retval for env applet
2005-10-14 09:56:52 +00:00
"Vladimir N. Oleynik"
6c35c7c976 usage bb_dev_null 2005-10-12 15:34:25 +00:00
"Vladimir N. Oleynik"
86a1073e0b bb_dev_null 2005-10-12 15:21:32 +00:00
"Vladimir N. Oleynik"
064f04e7e2 - use complementally '!' to '?' - 'ask' is best 'free' char for this.
- more long opt compatibility, can set flag for long opt struct now
- more logic: check opt-depend requires and global requires, special for 'id' and 'start-stop-daemon' applets.
2005-10-11 14:38:01 +00:00
Rob Landley
ff567f7943 The check for EROFS was wrong. For example, if you try to mount a filesystem
appended to an executable that's being run (yes, I'm doing this) you get
EPERM, but mounting readonly fixes it.  Doing the fallback all the time
shouldn't hurt, and is one less test.
2005-10-11 07:26:15 +00:00
"Vladimir N. Oleynik"
083d3f49c2 bb_mkdep: Rewroted. removed problem "include name must uniq", speed up * 3.
e2fsprogs: remove confuse bb_mkdep. Use internal e2fsprogs includes only.
other: remove confuse bb_mkdep.
2005-10-10 11:35:17 +00:00
Bernhard Reutner-Fischer
ab52db8d5e - size reduction of pidof
- fix typo in reverse_pidlist
2005-10-07 15:44:37 +00:00
Bernhard Reutner-Fischer
cf95e0b2d5 - add llist_free_one() and llist_free() to libbb 2005-10-06 12:12:51 +00:00
Bernhard Reutner-Fischer
56b217117a - add llist_free_one() and llist_free() to libbb; Add a bit of documentation.
- change llist_add_to_end as proposed by vodz in http://busybox.net/lists/busybox/2005-September/016411.html
- remove unneeded includes, add short boilerplate and copyright to llist.c
- move COMM_LEN from find_pid_by_name to libbb.h and use it in procps_status_t
- add reverse_pidlist() to find_pid_by_name. Will be needed for pidof.
2005-10-06 12:10:48 +00:00
"Vladimir N. Oleynik"
4a5ce08688 another more correction for getopt_ulflags() documentation (examples) 2005-10-05 13:58:40 +00:00
"Vladimir N. Oleynik"
d1b6078e5d more correction for getopt_ulflags() documentation by author of this fuck logic 2005-10-05 12:44:52 +00:00
Bernhard Reutner-Fischer
120513c29f - add proper separators. sorry for the noise.. 2005-10-05 12:28:55 +00:00
Bernhard Reutner-Fischer
43fb3fcb2f - add a bit more documentation to vodz' recent additions. 2005-10-05 12:23:13 +00:00
"Vladimir N. Oleynik"
35939d9378 update bb_getopt_ulflags special for 'ps' applet, usaging '-' as first group char from bb_opt_complementally is new feature: set argv is options;
use new bb_getopt_ulflags for ps
# define terminal_width 80->79 for unwide
use stdout file descriptor for get_terminal_width_height. (its must)
2005-10-05 10:52:47 +00:00
"Vladimir N. Oleynik"
be0ed3d0b9 use updated bb_getopt_ulflags() for ps applet 2005-10-04 16:48:26 +00:00
"Vladimir N. Oleynik"
39a841cecf change interface to bb_xasprintf() - more perfect for me.
ln.c: error_msg(str)->error_msg(%s, str) - remove standart "feature" for hackers
reduce 100 bytes don't care in sum
2005-09-29 16:18:57 +00:00
Bernhard Reutner-Fischer
bee9eb1a9d - rename llist_add_to.c to llist.c
- move llist_add_to_end() from ifupdown.c to libbb/llist.c
2005-09-29 12:55:10 +00:00
"Vladimir N. Oleynik"
5f46010ab7 spwd bulid now, (typo) 2005-09-26 12:58:24 +00:00
Rob Landley
5246063a7b Patch from Amir Shalem to make busybox compile on a uClibc that has no shadow
password support.
2005-09-25 23:36:12 +00:00
Mike Frysinger
62f18e1f20 use the shorter license header 2005-09-24 07:16:29 +00:00
Mike Frysinger
0d4ee68be5 use brief license line 2005-09-24 06:01:57 +00:00
Bernhard Reutner-Fischer
c5280e8885 - consolidated password helpers 2005-09-20 21:09:31 +00:00
Bernhard Reutner-Fischer
f56b8e4b00 - consolidated password helpers into bb_pwd.c 2005-09-20 21:08:10 +00:00
Bernhard Reutner-Fischer
d5bd137a24 - rename libbb's password helpers as suggested in libbb.h
my_getpwnam -> bb_xgetpwnam  /* dies on error */
  my_getgrnam -> bb_xgetgrnam  /* dies on error */
  my_getgrgid -> bb_getgrgid
  my_getpwuid -> bb_getpwuid
  my_getug    -> bb_getug
2005-09-20 21:06:17 +00:00
"Vladimir N. Oleynik"
f246dc7f57 ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE->CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE 2005-09-16 12:55:29 +00:00
"Vladimir N. Oleynik"
23f62fc6f3 split libbb: moved xregcomp separatelly for speed up recompile 2005-09-14 16:59:11 +00:00
"Vladimir N. Oleynik"
1e07f852e0 FEATURE->ENABLE_FEATURE loses one for 'top' applet 2005-09-14 16:08:06 +00:00
Rob Landley
90ca6b2878 This code exists to compensate for ancient broken build environments which,
as far as I can tell, are no longer relevant.  Modern busybox refuses to
build under libc5 (there's a specific test and #error for that), and
I'm not sure building against 2.1 kernel headers on Alpha was ever relevant.

I'm happy to put any of this back if anybody can point to a real need for it,
but if so we need to specifically document what environment is being
compensated for.  (And we should quarrantine the build environment code
into one place, anyway.  Maybe "quirks.h" for known compiler and
libc quirks?)
2005-09-07 06:39:02 +00:00
Mike Frysinger
99f61719cb Amir Shalem writes:
this patch fix syscall names mix-up in libb/syscalls.c
2005-09-06 21:53:21 +00:00
"Vladimir N. Oleynik"
45a8ed89c6 - sync traceroute with Slackware-10.1
(support -FIl -g gw -i if -z pt now).
- libbb/getopt_ulflags.c support bb_opt_complementally="x-x" as trigger now
2005-09-06 16:08:33 +00:00
Rob Landley
9955c45907 get_terminal_width_height.c was in there twice. 2005-09-05 18:42:18 +00:00
"Vladimir N. Oleynik"
27421a1878 1) bb_opt_complementaly -> bb_opt_complementally
2) better support long options
3) new flag '!' for bb_opt_complementally: produce bb_show_usage() if BB_GETOPT_ERROR internally
2005-09-05 14:46:07 +00:00
Rob Landley
cc1669bcde Actually returning ret might be good. 2005-09-05 05:36:15 +00:00
Rob Landley
828548ab56 According to bug #63, crond is unhappy with crontab lines that don't end in a
newline, or lines that have trailing spaces.
2005-09-01 10:23:57 +00:00
Rob Landley
e0537f6194 Bernhard Fischer suggested that get_terminal_width_height() should return
the result of the ioctl so callers can tell if we have a tty.  (0 means
we have a tty, nonzero means the ioctl couldn't find size info and we
fake 80x24.  Really we should fake 80x25, but oh well...)
2005-09-01 02:57:45 +00:00
Mike Frysinger
ddddb94f05 make sure __NF_sysfs exists before trying to use it 2005-08-27 18:19:01 +00:00
Rob Landley
6417564eeb Two FEATURE_CLEAN_UP patches from Shaun Jackman, closing filehandles. 2005-08-22 15:57:50 +00:00
Mike Frysinger
6ebbc7414e the () around isspace actually matters 2005-08-16 05:39:07 +00:00
Mike Frysinger
71224980e1 Bernhard Fischer says: fix comment typo 2005-08-16 05:27:51 +00:00
Rob Landley
6a6798b8e4 Major rewrite of mount, umount, losetup. Untangled lots of code, shrunk
things down a bit, fixed a number of funky corner cases, added support for
several new features (things like mount --move, mount --bind, lazy unounts,
automatic detection of loop mounts, and so on).  Probably broke several
other things, but it's fixable.  (Bang on it, tell me what doesn't work for
you...)

Note: you no longer need to say "-o loop".  It does that for you when
necessary.

Still need to add "user mount" support, which involves making mount suid.  Not
too hard to do under the new infrastructure, just haven't done it yet...

The previous code had the following notes, that belong in the version
control comments:

- * 3/21/1999   Charles P. Wright <cpwright@cpwright.com>
- *             searches through fstab when -a is passed
- *             will try mounting stuff with all fses when passed -t auto
- *
- * 1999-04-17  Dave Cinege...Rewrote -t auto. Fixed ro mtab.
- *
- * 1999-10-07  Erik Andersen <andersen@codepoet.org>.
- *              Rewrite of a lot of code. Removed mtab usage (I plan on
- *              putting it back as a compile-time option some time),
- *              major adjustments to option parsing, and some serious
- *              dieting all around.
- *
- * 1999-11-06  mtab support is back - andersee
- *
- * 2000-01-12   Ben Collins <bcollins@debian.org>, Borrowed utils-linux's
- *              mount to add loop support.
- *
- * 2000-04-30  Dave Cinege <dcinege@psychosis.com>
- *             Rewrote fstab while loop and lower mount section. Can now do
- *             single mounts from fstab. Can override fstab options for single
- *             mount. Common mount_one call for single mounts and 'all'. Fixed
- *             mtab updating and stale entries. Removed 'remount' default.
- *
2005-08-10 20:35:54 +00:00
Paul Fox
0b62158475 implemented a builtin echo command in ash. moved the guts of the
echo applet into libbb, and now call bb_echo() from both echo.c
and ash.c
2005-08-09 19:38:05 +00:00
Mike Frysinger
b953134bba apgo in Bug 322 writes: kill off CONFIG_FEATURE_MTAB_FILENAME 2005-07-30 08:48:10 +00:00
Paul Fox
e5ba382b99 move the ifdef to after libbb.h include, so it can do some good. 2005-07-27 14:20:52 +00:00
Mike Frysinger
4d00896d05 use toplevel ARFLAGS and update default ARFLAGS to be quiet 2005-07-27 01:09:24 +00:00
Mike Frysinger
6fafa5aa9f 2005-04-05 Shaun Jackman <sjackman@gmail.com>
* libbb/printf.c: Check for __NEWLIB_H__ before __GLIBC__.
2005-07-26 23:05:03 +00:00
Mike Frysinger
6e05312ba9 no longer used as reported by apgo in Bug 348 2005-07-26 22:51:57 +00:00
Paul Fox
1429017968 ifdef all of loop.c with CONFIG_FEATURE_MOUNT_LOOP. won't
compile due to CONFIG_FEATURE_MOUNT_LOOP_MAX otherwise.  reported
by Stephane Billiart.
2005-07-22 19:58:32 +00:00
Paul Fox
c337d29550 applying fix for:
0000117: Remove linefeed after overwrite prompt using cp -i
	  User input not on the same line as the prompt when about to
	  overwrite a file.
2005-07-19 21:31:05 +00:00
Paul Fox
3f6f3174e9 applying fix from:
0000068: mount limited to max 8 loop devices (patch provided)  

(made minor wording change for config help message)
2005-07-19 20:55:37 +00:00
Paul Fox
0a92bbf349 applying fix from:
0000067: cp -p produces misleading error message
2005-07-19 20:47:33 +00:00
Mike Frysinger
348e84c202 change the hardcoded error constant (0x80000000UL) to a nice flexible define (BB_GETOPT_ERROR) 2005-05-11 00:39:03 +00:00
Mike Frysinger
fb6d22c96c now that mjn3 explained it to me, add documentation for the 3rd field in long opts 2005-05-11 00:02:39 +00:00
Mike Frysinger
e5d0bde697 add documentation for long options and touch up the current docs now that i actually understand how to use the function myself :) 2005-05-10 23:48:35 +00:00
Mike Frysinger
9dc93ac561 syntax/whitespace touchup 2005-05-09 21:51:15 +00:00
Rob Landley
93983040c5 Shaun Jackman said:
This patch adds a CONFIG_FEATURE_CLEAN_UP stanza, and also adds an
ifdef around the SIOCGIFMAP call.
2005-05-03 21:30:26 +00:00
Rob Landley
60158cb93e A patch from Takeharu KATO to update/fix SE-Linux support. 2005-05-03 06:25:50 +00:00
Rob Landley
e3752e56a4 Revert Tito's patch to zcip. My bad, David Brownell had objected and I missed
it...
2005-05-03 03:28:55 +00:00
Rob Landley
8445a9ff99 On Tuesday 19 April 2005 21:10, Tito wrote and today added:
> Hi,
> this is a first attempt of size optimization for zcip taking into account all
> the hints given so far on the list.
> I've applied just the more obvious busyboxifications so maybe it could be
> optimized more.
BTW: I've ripped out  a lot of debug code and changed c++ // comments to /* */
as both were rather confusing for a newbie like me. ;-) 
Sorry to the author for that.
I know that this makes mantaining the code easier, but I'm simple minded....
2005-05-01 00:22:03 +00:00
Eric Andersen
fef32b570b Correct errors preventing busybox tar from working properly,
fixing bug http://bugs.uclibc.org/view.php?id=231
2005-04-27 10:51:38 +00:00
Mike Frysinger
2bf88a891f In Bug 5, Tito writes:
This is a first attempt to improve the comments of getopt_ulflags.c.
Maybe under some aspects the text could be refined, but so
far it is already usable and should help people who "avoided getopt_ulflags as the pest" to understand how it works.

This patch was created with the help of
Vodz, the author of the code, who explained me patiently
how getopt_ulflags works
and with the help of
Paul Fox, who corrected my broken english.

So thanks and merits should go to them also.
2005-04-18 22:42:58 +00:00
Eric Andersen
14f5c8d764 Patch from Bernhard Fischer to make a bunch of symbols static
which were otherwise cluttering the global namespace.
2005-04-16 19:39:00 +00:00
Eric Andersen
451c0d2828 Rework to fix http://bugs.uclibc.org/view.php?id=107 2005-04-16 07:46:53 +00:00
Eric Andersen
3cd1986195 Add bb_msg_read_error 2005-04-16 07:42:35 +00:00
Mike Frysinger
2ed05ab146 fake out support for POSIX -H and -L options since busybox cp dereferences everything by default 2005-04-14 02:52:50 +00:00
Mike Frysinger
a36ac0db67 Shaun Jackman writes: Fix typo. Use __NR_umount2 instead of __NR_pivot_root. 2005-03-04 01:34:23 +00:00
Mike Frysinger
9b9e5479e8 add some more comments 2005-03-04 01:27:18 +00:00
Mike Frysinger
3b05b80cd7 newlib fixe from Shaun Jackman 2005-03-04 01:10:56 +00:00
Rob Landley
c0dedd05e8 Sort rewrite to be SUSv3 compliant. New config option, updated help, and
a couple of infrastructure bits.
2005-01-24 07:00:02 +00:00
Eric Andersen
1e4dc96d61 Dear andersen:
Is the change on libbb/loop.c which you commited in 2005/1/3 effective
really?

The __GLIBC__ macro and __UCLIBC__ macro are defined in
feature.h in glibc source, so the change may not be effective.
If you want to check this with __GLIBC__, feature.h header is needed.

Some architectures(e.g. PPC series) need to include linux/posix_types.h
in stead of asm/posix_types.h, so the patch which is attached with
this mail include <linux/posix_types.h>.
2005-01-04 20:37:55 +00:00
Eric Andersen
1271dbb860 perhaps a better fix 2005-01-03 05:50:01 +00:00
Rob Landley
861f0145d3 Workaround for uClibc-specific header problem described here:
http://www.busybox.net/lists/busybox/2004-December/013276.html

Rob
2004-12-09 23:12:00 +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
a62665b72f Patch from Claus Klein to increase, and make more apparent
the hard coded limit on the number of mounts
2004-10-08 08:57:35 +00:00
Eric Andersen
94d628c76a Tito writes:
Hi to all,
This patch contains just some fixes for some misleading
comments in my_getpwuid.c and my_getug.c.
The code is untouched so this patch will not
cause troubles.

Please apply.

Thanks in advance and Ciao,
Tito
2004-10-08 08:07:40 +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
2842659cc0 Patch from Michael Tokarev:
Scenario:

  touch x -- creates plain file name `x'
  mkdir x -- exits successefully

libbb/make_directory.c, bb_make_directory(), contains
the following code:

        if (mkdir(path, 0777) < 0) {
            /* If we failed for any other reason than the directory
             * already exists, output a diagnostic and return -1.*/
            if (errno != EEXIST) {
                fail_msg = "create";
                umask(mask);
                break;
            }
            /* Since the directory exists, don't attempt to change
             * permissions if it was the full target.  Note that
             * this is not an error conditon. */
            if (!c) {
                umask(mask);
                return 0;
            }
        }

The assumption that EEXIST error is due to that the *directory*
already exists is wrong: any file type with that name will cause
this error to be returned.  Proper way IMHO will be is to stat()
the path and check whenever this is really a directory.  Below
(attached) is a patch to fix this issue.
2004-10-08 07:21:58 +00:00
Glenn L McGrath
29de86314a Remove this error message at Vodz request, it was misleading. 2004-09-24 02:36:44 +00:00
Glenn L McGrath
f15dfc5570 Tito writes,
"This patch fixes all the bugs in id previously spotted by vodz and me.
The binary size increased a bit,  but now it should work as expected."
2004-09-15 03:04:08 +00:00
Eric Andersen
7b08cdd98c No longer needed 2004-09-02 23:11:53 +00:00
Eric Andersen
7eb79fff10 Tito writes:
Hi Erik,
Hi to all,
This is part five of the my_get*id story.
I've tweaked a bit this two functions to make them more flexible,
but this changes will not affect existing code.
Now they work so:
1) my_getpwuid( char *user, uid_t uid, int bufsize)

   if bufsize is > 0 char *user cannot be set to NULL
                     on success username is written on static allocated buffer
                     on failure uid as string is written to buffer and NULL is returned
   if bufsize is = 0 char *user can be set to NULL
                     on success username is returned
                     on failure NULL is returned
   if bufsize is < 0 char *user can be set to NULL
                     on success username is returned
                     on failure an error message is printed and the program exits

  2) 1) my_getgrgid( char *group, uid_t uid, int bufsize)

   if bufsize is > 0 char *group cannot be set to NULL
                     on success groupname is written on static allocated buffer
                     on failure gid as string is written to buffer and NULL is returned
   if bufsize is = 0 char *group can be set to NULL
                     on success groupname is returned
                     on failure NULL is returned
   if bufsize is < 0 char *group can be set to nULL
                     on success groupname is returned
                     on failure an error message is printed and the program exits

This changes were needed mainly for my new id applet.
It is somewhat bigger then the previous but matches the behaviour of GNU id
and is capable to handle usernames of whatever length.
BTW: at a first look it seems to me that it will integrate well (with just a few changes)
with the pending patch  in patches/id_groups_alias.patch.
The increase in size is balanced by the removal of my_getpwnamegid.c
from libbb as this was used only in previous id applet and by size optimizations
made possible in whoami.c and in passwd.c.
I know that we are in feature freeze but I think that i've tested it enough
(at least I hope so.......).
2004-09-02 22:21:41 +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
6fea7328ee Felipe Kellermann writes:
Unfortunatelly I've not followed the last two or three weeks commits (new
semester started and so now I rarely have time to fix my personal bridge)
but tonight I synched my tree and immediately noticed a rather nasty bug!

[Using libbb/interface.c:1.24]
# grep eth0 /proc/net/dev | xargs
eth0:311708397 237346 1670 0 1789 1670 0 0 22580308 120297 0 0 0 102 0 0

# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:20:AF:7C:EA:B7
          inet addr:10.0.0.1  Bcast:10.0.0.127  Mask:255.255.255.128
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:5 Base address:0x320


All values `ifconfig' is showing are `zeroed' -- I quickly looked at the
last commits I missed and noticed that there were a commit relating to
ifconfig, libbb/interface.c:1.23->1.24 (PatchSet 4338).

I've reversed the patch and now everything is working again.  I compared
the get_name's return values from the 1.23 and 1.24 and quickly noticed
that the new revision is leaving `p' right on the sep while the rev 1.23
was leaving it right on the starting of the values...

1-line, 1/3-minute patch attached  :-)
2004-08-26 21:45:21 +00:00
Eric Andersen
0722513497 Use __kernel_old_dev_t for 2.6.x kernels 2004-08-16 08:36:28 +00:00
Eric Andersen
cf6ef05711 Aurelien Jacobs writes:
with a quick conversion you will see that 132608 == 0x20600
so noticed that the elif will never be matched !
Apparently there was already a try to modify this in CVS which
was reverted (it was plain wrong).

I don't know when __kernel_old_dev_t is needed, but with a 2.6.7
or a 2.6.8 this is __kernel_dev_t wich is needed.

I corrected this with the following patch but maybe older 2.6
still need __kernel_old_dev_t ?

I think this should be corrected before 1.0.

Thanks
Aurel
2004-08-16 08:29:44 +00:00
Eric Andersen
9940e081c9 Patch from solar to fix problems with get_name() 2004-08-12 16:52:00 +00:00
Glenn L McGrath
18bbd9bf3b Patch from Tito to fix memory leak upon error. 2004-08-11 03:50:30 +00:00
Eric Andersen
93d7fba892 Tito, farmatito at tiscali dot it writes:
Hi to all,
This patch is useful for:
1) remove an unused var from extern char *find_real_root_device_name(const char* name)
    changing it to extern char *find_real_root_device_name(void).
2) fixes include/libbb.h, coreutils/df.c, util-linux/mount.c and  util-linux/umount.c accordingly.
3) fixes a bug, really a false positive,  in find_real_root_device_name() that happens if
    in the /dev directory exists a link named root (/dev/root) that should be skipped but
    is not. This affects applets like df that display wrong results
2004-08-03 00:14:02 +00:00
Manuel Novoa III
413db4d583 Clean up hex escape support. 2004-07-29 23:15:16 +00:00
Eric Andersen
ccfc44806d Felipe Kellermann noticed a missing `break'. 2004-07-27 16:45:46 +00:00
Eric Andersen
b2a300590d bother. unrevert my fix. 2004-07-26 12:11:32 +00:00
Eric Andersen
53f5c0d5bf Allow hex escape sequences 2004-07-26 12:06:19 +00:00
Eric Andersen
380919905c Allow hex escape sequences 2004-07-26 11:28:47 +00:00
Glenn L McGrath
2e99d43846 Fix for a bug identied by Harald Kuthe, when using many interfaces (29
in this case) the order was incorrect and there were duplicate entries.
2004-07-23 01:49:46 +00:00
Glenn L McGrath
eeb06bf230 Patch from Felipe Kellermann, "There is a call to printf using `*pr-cchar'
referencing a string and using a single char, when *p <= 0x1f."
2004-07-23 01:35:41 +00:00
Glenn L McGrath
774e6cc29c Revert my previous commit 2004-06-25 09:01:09 +00:00
Glenn L McGrath
d9670461c4 Fix compile error under 2.6, check for newer versions first or all the
checks wont be considered.
2004-06-25 07:47:03 +00:00
Eric Andersen
36adca81f5 Patch from Bastian Blank:
On Sat, Jun 19, 2004 at 10:57:37PM +0200, Bastian Blank wrote:
> The following patch changes klogd to use openlog/syslog themself
> instead of calling syslog_msg which always calls the triple
> openlog/syslog/closelog.

Updated patch: get rid of syslog_msg entirely. Request from Erik Andersen.

Bastian
2004-06-22 10:07:17 +00:00
Glenn L McGrath
ff5309ac99 Add part of a patch from Vernon Sauder that i missed a while back 2004-05-02 08:38:53 +00:00
Eric Andersen
6f9a7783ce Do not use getpass(3) 2004-05-01 01:27:30 +00:00
Glenn L McGrath
1219879422 Dont try and preserve hard links to directories.
The linux kernel doesnt allow hard links to directories, SUS says its
implementation specific.
cramfs gives empty directories and 0 length files the same node it
makies it difficult to distinguish from hard links.
2004-04-19 12:28:02 +00:00
Eric Andersen
2c2256cb8b remove a warning 2004-04-14 17:57:11 +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
Eric Andersen
66a56aa028 Vladimir N. Oleynik writes:
Hi.

Last changes (rev 1.12) to recursive_actions() by Christian Grigis
have problem.
Test for demonstrate:

$ mkdir aaa bbb ccc
$ su
# chown root bbb
# chmod 700 bbb
# exit
$ busybox chmod 777 -R .
./bbb: Permision denied

But "./ccc" mode not changed. Previous variant works fine,
errors skiped and continued recursion.


--w
vodz
2004-04-07 17:59:04 +00:00
Eric Andersen
3f47c453da Christian Grigis, christian.grigis at smartdata dot ch writes:
Hello everyone,

Busybox's insmod fails to locate a module when that module is the only one
existing in the /lib/modules directory (with a unique name).

Example:

# find /lib/modules/ -type f
/lib/modules/kernel/drivers/char/bios.o
# insmod bios
insmod: bios.o: no module by that name found
# touch /lib/modules/dummy
# find /lib/modules/ -type f
/lib/modules/kernel/drivers/char/bios.o
/lib/modules/dummy
# insmod bios
Using /lib/modules/kernel/drivers/char/bios.o

As long as there is another file in the /lib/modules directory, insmod
finds it OK.

I tracked the problem down to 'check_module_name_match()' in insmod.c:

It returns TRUE when a match is found, and FALSE otherwise. In the case
where there is only one module in the /lib/modules directory (or more that
one module, but all with the same name), 'recursive_action()' will return
TRUE and we end up on line 4196 in 'insmod.c' which returns an error.
[The reason it works with more than one module with different
names is that in this case there will always be one not matching,
'recursive_action()' will return FALSE and we end up in line 4189.]

Now, from the implementation of 'recursive_action()' and from other
usages of it (tar.c, etc.), it seems to me that FALSE should be returned
to indicate that we want to stop the recursion, so TRUE and FALSE should
be inverted in 'check_module_name_match()'.

At the same time, 'recursive_action()' continues to recurse even after
the recursive call has returned FALSE; again in my understanding and
other usages of it, we can safely stop recursing at this point.


Here is my patch against 1.00-pre8:
2004-04-06 11:56:26 +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
97310d0253 Brian Pomerantz writes:
I've noticed a bug in the "autowidth" feature more, and is probably in
others.  The call to the function get_terminal_width_height() passes
in a file descriptor but that file descriptor is never used, instead
the ioctl() is called with 0.  In more_main() the call to
get_terminal_width_height() passes 0 as the file descriptor instead of
fileno(cin).  This isn't a problem when you more a file (e.g. "more
/etc/passwd") but when you pipe a file to it (e.g. "cat /etc/passwd |
more") the size of the terminal cannot be determined because file
descriptor 0 is not a terminal.  The fix is simple, I've attached a
patch for more.c and get_terminal_width_height.c.


BAPper
2004-03-23 23:15:36 +00:00
Eric Andersen
c7bda1ce65 Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
Manuel Novoa III
7d0c51919c In spite of the feature freeze, check in a complete rework of route which
fixes some bugs, adds some error checking, and removes _lots_ of bloat.
Text size on i386...
              old     new
   ipv6      5425    3523
   no ipv6   3143    2193
2004-03-10 07:42:38 +00:00
Manuel Novoa III
948d4907a0 My bug. :-( 2004-03-08 05:44:30 +00:00
Eric Andersen
2479445562 Fix/eliminate use of atol 2004-03-06 22:11:45 +00:00
Manuel Novoa III
adab517f76 Don't build these support functions for uClibc, as it always supplies
versions.
2004-03-06 00:32:54 +00:00
Glenn L McGrath
d2b860fecb Patch from Vernon Sauder.
The off_t type is not a consistent size; it depends on the kernel options
(something about large file support). Therefore, the format string for
printing an address is not always the same.
2004-03-05 05:47:19 +00:00
Glenn L McGrath
181f0773e2 bb_full_fd_action was incorrectly returning an error message causing
major breaking.
2004-02-23 08:11:07 +00:00
Eric Andersen
817565a0ff For the time being, revert the changes for detecting copying
a directory into itself.  It is harder to do this correctly
than it appears.  Not trying at all seems a better compromise
for the time being, untill we can implement this correctly.
2004-02-22 11:46:49 +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
Eric Andersen
e7d244cc96 Chris Larson (kergoth) writes:
As Manuel points out, this is a flawed fix, and doesnt fix the
following:

mkdir -p cpa cpb cpc
cp -a cpa cpa/cpb/cpc

Attached what appears to be a more sane fix.  Apply on top of previous.
Please confirm sanity.
2004-02-19 01:52:29 +00:00
Eric Andersen
e0cbe48637 Chris Larson (kergoth) writes:
I was adding -s/--symbolic-link support to busybox cp when I noticed a
bug with -r/-a.  Test case:

mkdir -p test/out
cd test
busybox cp -a * out/

Will never return until we run out of open files or similar.
Coreutils cp on the other hand will error with "cannot copy a directory,
`out', into itself, `out'".  Patch attached.
2004-02-19 00:44:08 +00:00
Eric Andersen
ec359e9ebb Accomodate the fact that newer libc versions may in fact not
contain query_module and friends and more
2004-02-13 08:09:43 +00:00
Eric Andersen
ef8cd3be17 Make the loop support stuff be much less evil, and make it cope
with 2.6.x asm/posix_types.h, which has done singularly evil thing
by yanking __kernel_dev_t and renaming it.  The loop interface was
really poorly designed in the first place.  The new 64 bit loop
interface looks to be somewhat less horrible, too bad it is only
present in 2.6.x kernels.
 -Erik
2004-02-06 07:16:36 +00:00
Eric Andersen
54426d5297 Vladimir N. Oleynik writes:
Ok. I found my mistake :(
The trivial patch attached.

--w
vodz
2004-02-05 13:49:29 +00:00
Eric Andersen
4575bbf7b8 The variable 'complementaly' used to be allocated with calloc, which zeroed it
out during the allocation process.  When vodz changed it to be allocated on the
stack, he forgot to explicitly zero it, leaving its value filled with whatever
used to be sitting on the stack.  It would garbage values, depending on the
garbage that happened to be sitting on the stack when the function was called.
The result was that applets using bb_getopt_ulflags() were showing
unpredictable behavior (such as segfaults), which naturally broke many things.
2004-02-04 10:48:37 +00:00
Eric Andersen
0f56de665c s/u_int/unsigned int/g
s/u_short/unsigned short/g
2004-01-30 22:52:27 +00:00
Eric Andersen
ad84a516bb Use proper C99 types throughout. So not use silly typedefs. 2004-01-30 22:31:58 +00:00
Manuel Novoa III
ebce2daa60 Support new uClibc stdio core. 2004-01-30 21:44:20 +00:00
Eric Andersen
f88bb72f1f Apply a couple of optimizations 2004-01-29 22:33:28 +00:00
Eric Andersen
242ab83499 Teach busybox ps to get the correct uid when displaying stuff 2004-01-27 20:17:39 +00:00
Glenn L McGrath
85c5152cb8 Vodz, last_patch_123, patch have new version getopt_ulflags.
- size reduced 34 bytes
- don`t use dynamic memory allocation
- small indent correction.
2004-01-22 07:10:13 +00:00
Glenn L McGrath
a1e4a0ef67 Patch from Atsushi Nemoto, recent MIPS kernel headers
does not provide PAGE_SHIFT for userland (because now mips-linux kernel
supports PAGESIZE other than 4K).
2004-01-21 11:36:44 +00:00
Glenn L McGrath
036dbaa082 Modify bb_lookup_port to allow the protocol to be specified, allowing
/etc/services support for inetd, netcat and tftp.
2004-01-17 05:03:31 +00:00