Commit Graph

1711 Commits

Author SHA1 Message Date
Stephen Heumann 16cd3c0619 Merge with BusyBox 1.24.0.
There's really only one bug fix in here that should be significant for GNO hush. The other changes should be inconsequential, AFAIK.
2015-10-17 01:10:35 -05:00
Denys Vlasenko d60752f8c9 build system: -fno-builtin-printf
Benefits are: drops reference to out-of-line putchar(), fixes a few cases
of failed string merge.

function                                             old     new   delta
i2cdump_main                                        1488    1502     +14
sha256_process_block64                               423     433     +10
sendmail_main                                       1183    1185      +2
list_table                                          1114    1116      +2
i2cdetect_main                                      1235    1237      +2
fdisk_main                                          2852    2854      +2
builtin_type                                         119     121      +2
unicode_conv_to_printable2                           325     324      -1
scan_recursive                                       380     378      -2
mkfs_minix_main                                     2687    2684      -3
buffer_fill_and_print                                178     169      -9
putchar                                              152       -    -152
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 7/4 up/down: 34/-167)          Total: -133 bytes
   text    data     bss     dec     hex filename
 937788     932   17676  956396   e97ec busybox_old
 937564     932   17676  956172   e970c busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-07 22:42:45 +02:00
Denys Vlasenko 5711a2a4ad libbb: more compact API for bb_parse_mode()
function                                             old     new   delta
make_device                                         2182    2188      +6
parse_command                                       1440    1443      +3
parse_params                                        1497    1499      +2
install_main                                         773     769      -4
mkdir_main                                           168     160      -8
getoptscmd                                           641     632      -9
builtin_umask                                        158     147     -11
bb_parse_mode                                        431     410     -21
umaskcmd                                             286     258     -28
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/6 up/down: 11/-81)            Total: -70 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-07 17:55:33 +02:00
Denys Vlasenko 2b48c38be6 uudecode: tolerate text input with CR+LF line ends
function                                             old     new   delta
read_stduu                                           265     308     +43
uudecode_main                                        313     317      +4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-05 15:10:44 +02:00
Denys Vlasenko 8aa7cf305b sort: fix -kN,M handling (was including last separator into the comparison)
Testcase:

$ printf '%s\n' a/a:a a:b | sort -t: -k1,1
a:b
a/a:a

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-09-19 22:06:40 +02:00
Ron Yorston 64ed5f0d3c uname: make OS name configurable
A mailing list thread in September 2013 discussed changing the string
returned by the non-POSIX 'uname -o' option.  Nothing ever came of this
because there was no agreement as to what the string should be.

Make the string configurable so that people can decide for themselves.

Signed-off-by: Ron Yorston <rmy@frippery.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-03 18:09:18 +02:00
Mike Frysinger 670c3f7822 echo: make escape sequences depend on fancy mode
Currently when you disable fancy echo, escape sequences are hardcoded
enabled (e.g. as if you used `echo -e` all the time).  The opposite
behavior is more desirable (always disable -e support) because:
* This seems to contradict the spirit of the kconfig help text (where
  it says enable support for -n/-e flags), although you could say that
  we aren't supporting the -e flag directly as `echo -e` will show the
  -e flag.
* POSIX makes escape sequences optional, and even says they are there
  only on XSI-conformant systems.
* It saves space (~100 bytes on x86_64).
* It makes things faster!
* It makes it behave more like bash where you need an explicit -e flag
  in order for escape sequences to be interpreted.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-31 03:47:49 +02:00
Denys Vlasenko 35ae2ccb40 sync: add support for -d -f FILE
Based on the patch by Ari Sundholm <ari@tuxera.com>

function                                             old     new   delta
sync_main                                             20     163    +143
packed_usage                                       30653   30673     +20
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 163/0)             Total: 163 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-21 19:50:48 +02:00
Maninder Singh 97f2f7ca7f Removes stray empty line from code
This patch removes stray empty line from busybox code
reported by script find_stray_empty_lines

Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Signed-off-by: Akhilesh Kumar <akhilesh.k@samsung.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-13 03:25:46 +02:00
Maninder Singh 7db312ad26 fix whitespaces
reported by script :- scripts/fix_ws.sh

Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-06-07 18:19:47 +02:00
Junling Zheng d291c2fdd5 chown: fix help text
Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-06-07 02:32:23 +02:00
Ari Sundholm fc3e40ee81 truncate: do not die when a file doesn't exist and no-create flag is on
Additionally, open(2) failures do not make the program die immediately.
This makes the behavior of the program match coreutils more closely.

function                                             old     new   delta
truncate_main                                        161     221     +60

Signed-off-by: Ari Sundholm <ari@tuxera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-05-25 15:17:03 +02:00
Maninder Singh 97c6491b4e typo fixes
Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-05-25 13:46:36 +02:00
Denys Vlasenko de5edadee2 special-case {true,false,test} --help
This also removes their help texts.

function                                             old     new   delta
run_applet_no_and_exit                               442     452     +10
packed_usage                                       30713   30625     -88

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-04-21 16:00:41 +02:00
Bernhard Reutner-Fischer 86a7f18f21 *: Switch to POSIX utmpx API
UTMP is SVID legacy, UTMPX is mandated by POSIX.

Glibc and uClibc have identical layout of UTMP and UTMPX, both of these
libc treat _PATH_UTMPX as _PATH_UTMP so from a user-perspective nothing
changes except the names of the API entrypoints.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-02 23:03:46 +02:00
Denys Vlasenko 1850d5ec0e truncate: new applet
Add the actual new source file :(

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-22 18:00:32 +01:00
Ari Sundholm 8893023ba2 dd: move suffix struct to xatonum.c
This way it can be used by other applets without duplication.

Signed-off-by: Ari Sundholm <ari@tuxera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-22 17:41:04 +01:00
Ron Yorston 53e9c51ade od: fix printing of high-bit chars
Example: echo £ | od -c

Signed-off-by: Ron Yorston <rmy@tigress.co.uk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-12 20:11:48 +01:00
Denys Vlasenko 8dff01d06a libbb: introduce and use is_prefixed_with()
function                                             old     new   delta
is_prefixed_with                                       -      18     +18
complete_username                                     78      77      -1
man_main                                             737     735      -2
fsck_device                                          429     427      -2
unpack_ar_archive                                     80      76      -4
strip_unsafe_prefix                                  105     101      -4
singlemount                                         1054    1050      -4
rtc_adjtime_is_utc                                    90      86      -4
resolve_mount_spec                                    88      84      -4
parse_one_line                                      1029    1025      -4
parse_conf                                          1460    1456      -4
may_wakeup                                            83      79      -4
loadkmap_main                                        219     215      -4
get_irqs_from_stat                                   103      99      -4
get_header_cpio                                      913     909      -4
findfs_main                                           79      75      -4
fbsplash_main                                       1230    1226      -4
load_crontab                                         776     771      -5
expand_vars_to_list                                 1151    1146      -5
date_main                                            881     876      -5
skip_dev_pfx                                          30      24      -6
make_device                                         2199    2193      -6
complete_cmd_dir_file                                773     767      -6
run_applet_and_exit                                  715     708      -7
uudecode_main                                        321     313      -8
pwdx_main                                            197     189      -8
execute                                              568     560      -8
i2cdetect_main                                      1186    1176     -10
procps_scan                                         1242    1230     -12
procps_read_smaps                                   1017    1005     -12
process_module                                       746     734     -12
patch_main                                          1903    1891     -12
nfsmount                                            3572    3560     -12
stack_machine                                        126     112     -14
process_timer_stats                                  449     435     -14
match_fstype                                         111      97     -14
do_ipaddr                                           1344    1330     -14
open_list_and_close                                  359     343     -16
get_header_tar                                      1795    1779     -16
prepend_new_eth_table                                340     323     -17
fsck_main                                           1811    1794     -17
find_iface_state                                      56      38     -18
dnsd_main                                           1321    1303     -18
base_device                                          179     158     -21
find_keyword                                         104      82     -22
handle_incoming_and_exit                            2785    2762     -23
parse_and_put_prompt                                 774     746     -28
modinfo                                              347     317     -30
find_action                                          204     171     -33
update_passwd                                       1470    1436     -34
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/49 up/down: 18/-540)         Total: -522 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-12 17:48:34 +01:00
Denys Vlasenko c5beaa08eb ls: heed compiler warning
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-23 15:25:58 +01:00
Denys Vlasenko 0cb981c5e2 ls: trivial code shrink
function                                             old     new   delta
display_single                                       914     893     -21

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-18 11:29:07 +01:00
Denys Vlasenko 8e92df15b5 ls: fix year 9999 bug :)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-16 15:36:25 +01:00
Ari Sundholm f22a838aed dd: add optional support for status=noxfer/none
While at it, added 'B' number suffixes, upstream compat

function                                             old     new   delta
dd_main                                             1469    1543     +74
dd_suffixes                                           88     112     +24
packed_usage                                       30156   30176     +20
dd_output_status                                     372     388     +16
static.status_words                                    -      13     +13
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/0 up/down: 147/0)             Total: 147 bytes

Signed-off-by: Ari Sundholm <ari@tuxera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-07 01:41:22 +01:00
Denys Vlasenko 86031a5ffd trim extra newlines in help texts
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-24 19:46:45 +01:00
Stephen Heumann f88111e789 Do newline conversion in the "echo" builtin. 2015-01-08 17:23:39 -06:00
Stephen Heumann b4a362ef71 Make test report EXEC files (shell scripts) as executable. 2014-12-04 13:41:21 -06:00
Stephen Heumann a549af27ca Fix test to account for GNO stat() giving only "owner" permission bits. 2014-12-04 12:22:52 -06:00
Stephen Heumann 72634b98b9 In redirection operations, map fds 0/1/2 to 1/2/3 so they work as stdin/stdout/stderr, preserving compatibility with Unix shell scripts.
Also do a similar mapping for fds passed to "read -u" and "test -t".
2014-11-20 23:12:01 -06:00
Stephen Heumann b3a419646b Changes to handle the use of \r as newline on the IIgs. 2014-11-08 19:58:11 -06:00
Stephen Heumann 7e5a584f0c Use alternative code (also from BusyBox) for checking if the user is in a group, avoiding a call to getgroups(), which isn't supported.
This could actually be further simplified, since GNO doesn't really have group-based file permissions, but I'll leave that until later.
2014-11-04 16:24:41 -06:00
Stephen Heumann 036b92595c Address some link errors with various small changes.
The most significant change is to at use malloc instead of alloca in the code to evaluate shell arithmetic expressions in shell/math.c.
2014-11-03 23:29:34 -06:00
Stephen Heumann 051b79efc1 Move all the source files to 15-character ProDOS-compatible file names.
Dmake gets confused if you use over-15-character file names, so they needed to be shortened to get it to work. While I was at it, I also switched _ to . in the filenames so they're fully ProDOS compatible.

The shell/hush_test directory (not needed to build the code) still uses ProDOS-incompatible file names.
2014-11-02 22:11:07 -06:00
Stephen Heumann 97e65e3480 Remove C99isms from coreutils/test.c.
It now compiles successfully with ORCA/C.
2014-11-02 00:39:21 -05:00
Stephen Heumann 8f6869ae25 Miscellaneous changes for ORCA/C and GNO compatibility, mainly removing C99isms.
At this point, ORCA/C can process the main header files, and some smaller source files compile without errors.
2014-11-01 09:46:02 -05:00
Stephen Heumann 472db3bd56 Delete the stuff that's irrelevant to hush. Also, include (a simplified version of) the autoconf-generated headers and a simple build script, so it can easily be build in the hush-only configuration. 2014-10-26 22:39:01 -05:00
Denys Vlasenko 054f5a5b0d install: fix help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-24 22:16:24 +02:00
Aaro Koskinen 0f78d616cb install: implement -t DIR
Some packages want to install themselves using "-t" to specify
the directory (as supported by GNU coreutils). Add support for the option
for compatibility reasons.

function                                             old     new   delta
install_longopts                                      76      95     +19
install_main                                         769     777      +8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 27/0)               Total: 27 bytes

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-24 02:52:08 +02:00
Ari Sundholm fbdc167f27 df: fix -T option when ENABLE_FEATURE_HUMAN_READABLE=0
Signed-off-by: Ari Sundholm <ari@tuxera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-20 18:55:17 +02:00
Ari Sundholm d0cdacafa9 df: implement -T option
function                                             old     new   delta
df_main                                              863     998    +135
packed_usage                                       29827   29861     +34
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 169/0)             Total: 169 bytes

Signed-off-by: Ari Sundholm <ari@tuxera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-17 20:53:58 +02:00
Denys Vlasenko 98654b995b test: fix mishandling of "test '(' = '('" and similar
function                                             old     new   delta
test_main                                            246     350    +104

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-01 14:16:28 +02:00
Michael Gernoth 1b487ea8a6 stat: fix printing selinux context and null-dereference
busybox stat tries to always print the selinux context, even if it
is not requested which leads to a segmentation fault due to
dereferencing a null-pointer.

This also changes the format-string used to print the context to
so it actually produces useful output.

Signed-off-by: Michael Gernoth <michael@gernoth.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-27 14:08:29 +02:00
Isaac Dunham ea23c25e96 unlink: new applet
function                                             old     new   delta
unlink_main                                            -      45     +45
packed_usage                                       29667   29686     +19

Signed-off-by: Isaac Dunham <ibid.ag@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-22 20:44:25 +02:00
Denys Vlasenko 17f8418ea7 Add conditional support for -v / --verbose
With FEATURE_VERBOSE off, practically no size change.
With it on:

function                                             old     new   delta
remove_file                                          493     556     +63
install_main                                         719     765     +46
bb_make_directory                                    383     419     +36
rmdir_main                                           162     191     +29
copy_file                                           1516    1544     +28
mv_main                                              502     525     +23
cmp_main                                             677     693     +16
bbconfig_config_bz2                                 5264    5279     +15
mkdir_main                                           158     168     +10
install_longopts                                      66      76     +10
rm_main                                              167     175      +8
nexpr                                                840     846      +6
scan_tree                                            275     280      +5
fsck_main                                           1807    1811      +4
ed_main                                             2541    2545      +4
expand_one_var                                      1574    1575      +1
swap_on_off_main                                     420     418      -2
parse_command                                       1443    1440      -3
redirect                                            1279    1274      -5
do_load                                              946     918     -28
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 16/4 up/down: 304/-38)          Total: 266 bytes

Based on the patch by Igor Živković.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-19 16:23:50 +02:00
Denys Vlasenko 69f9567de2 shuf: trim help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-07 14:41:53 +01:00
Denys Vlasenko 102f0d0d07 shuf: do not use strings for -i RANGE case
function                                             old     new   delta
shuf_main                                            482     496     +14

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-07 14:32:39 +01:00
Bartosz Golaszewski 190693ced1 shuf: improve help text
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-07 14:07:35 +01:00
Bartosz Golaszewski 58adbb5505 shuf: fix a segfault on 'shuf -e'
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-07 11:46:03 +01:00
Denys Vlasenko 2cdcb1082c shuf: new applet
function                                             old     new   delta
shuf_main                                              -     478    +478
packed_usage                                       29571   29719    +148
applet_names                                        2460    2465      +5
applet_main                                         1428    1432      +4
applet_nameofs                                       714     716      +2
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 4/0 up/down: 637/0)             Total: 637 bytes

Based on the code by Bartosz Golaszewski <bartekgola@gmail.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-05 18:56:20 +01:00
Denys Vlasenko fca0ee5959 ls: make "ls -s DIR" show total too. Clases 4946
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-27 15:40:26 +01:00
Denys Vlasenko 69a12fa790 catv: suppress compiler warning
The warning was:
warning: typedef 'BUG_const_mismatch' locally defined but not used [-Wunused-local-typedefs]

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-03 03:27:53 +01:00