oweals/busybox.git
8 years agohush: do not leak script fds into NOEXEC children
Denys Vlasenko [Sat, 20 Aug 2016 13:58:34 +0000 (15:58 +0200)]
hush: do not leak script fds into NOEXEC children

We set all opened script fds to CLOEXEC, thus making then go away
after fork+exec.
Unfortunately, CLOFORK does not exist. NOEXEC children will still see those fds open.

For one, "ls" applet is NOEXEC. Therefore running "ls -l /proc/self/fd"
in a script from standalone shell shows this:

lrwx------    1 root     root            64 Aug 20 15:17 0 -> /dev/pts/3
lrwx------    1 root     root            64 Aug 20 15:17 1 -> /dev/pts/3
lrwx------    1 root     root            64 Aug 20 15:17 2 -> /dev/pts/3
lr-x------    1 root     root            64 Aug 20 15:17 3 -> /path/to/top/level/script
lr-x------    1 root     root            64 Aug 20 15:17 4 -> /path/to/sourced/SCRIPT1
...

with as many open fds as there are ". SCRIPTn" nest levels.
Fix it by closing these fds after fork (only for NOEXEC children).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agohush: bit better comments in redirect code. No logic changes
Denys Vlasenko [Sat, 20 Aug 2016 13:16:00 +0000 (15:16 +0200)]
hush: bit better comments in redirect code. No logic changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agohush: `cmd` and arithmetic also need the fix for FILE rewind
Denys Vlasenko [Fri, 19 Aug 2016 18:15:26 +0000 (20:15 +0200)]
hush: `cmd` and arithmetic also need the fix for FILE rewind

Discovered by running testsuite with a newest glibc

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agohush: fix a bug in FEATURE_SH_STANDALONE=y config. Closes 9186
Denys Vlasenko [Fri, 19 Aug 2016 16:23:56 +0000 (18:23 +0200)]
hush: fix a bug in FEATURE_SH_STANDALONE=y config. Closes 9186

Run this in a "sh SCRIPT":

sha256sum /dev/null
echo END

sha256sum is a NOEXEC applet. It runs in a forked child. Then child exit()s.
By this time, entire script is read, and buffered in a FILE object
from fopen("SCRIPT"). But fgetc() did not consume entire input.
exit() lseeks back by -9 bytes, from <eof> to 'e' in 'echo'.
(this may be libc-specific).
This change of fd position *is shared with the parent*!

Now parent can read more, and it thinks there is another "echo END".
End result: two "echo END"s are run.

Fix this by _exit()ing instead.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agotop: move free(prev_hist) out of signal path
Denys Vlasenko [Fri, 19 Aug 2016 09:07:31 +0000 (11:07 +0200)]
top: move free(prev_hist) out of signal path

It was seen being called recursively on repeated signals,
leading to double free

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoifplugd: if SIOCSIFFLAGS fails with ENODEV, don't die
Denys Vlasenko [Tue, 16 Aug 2016 18:39:52 +0000 (20:39 +0200)]
ifplugd: if SIOCSIFFLAGS fails with ENODEV, don't die

Some user managed to hit a race where iface is gone between SIOCGIFFLAGS
and SIOCSIFFLAGS (!). If SIOCSIFFLAGS fails, treat it the same as failed
SIOCGIFFLAGS

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoless: fix bracket search to match behavior of less 481
Denys Vlasenko [Tue, 16 Aug 2016 13:27:30 +0000 (15:27 +0200)]
less: fix bracket search to match behavior of less 481

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoless: fix SEGV
Denys Vlasenko [Tue, 16 Aug 2016 13:09:40 +0000 (15:09 +0200)]
less: fix SEGV

testcase: echo "" | less, then press ')' key

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agogzip: add test that checks that -9 compresses better than -1
Natanael Copa [Wed, 3 Aug 2016 14:21:53 +0000 (16:21 +0200)]
gzip: add test that checks that -9 compresses better than -1

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agogzip: fix compression level bug. Closes 9131
Natanael Copa [Wed, 3 Aug 2016 14:21:52 +0000 (16:21 +0200)]
gzip: fix compression level bug. Closes 9131

fix broken logic to get the gzip_level_config value from options -1 to
-9.

This fixes an off-by-one bug that caused gzip -9 output bigger files
than the other compression levels.

It fixes so that compression level 1 to 3 are actually mapped to level 4
as comments say.

It also fixes that levels -4 to -9 is mapped to correct level and avoids
out-of-bounds access.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agolineedit: trivial codeshrink for vi-mode
Natanael Copa [Sun, 14 Aug 2016 21:30:29 +0000 (23:30 +0200)]
lineedit: trivial codeshrink for vi-mode

Introduce and use BB_isalnum_or_underscore().

function                                             old     new   delta
BB_isalnum_or_underscore                               -      43     +43
vi_word_motion                                       162     150     -12
vi_end_motion                                        163     145     -18
vi_back_motion                                       198     179     -19
BB_isalnum                                            39       -     -39
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/3 up/down: 43/-88)            Total: -45 bytes

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agobuild system: fix include/NUM_APPLETS.h generation
Denys Vlasenko [Sun, 14 Aug 2016 00:54:27 +0000 (02:54 +0200)]
build system: fix include/NUM_APPLETS.h generation

TBH, it's more like "work around my bad makefile-fu" than "fix"...

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agolibiproute: eliminate some redundant zero stores
Denys Vlasenko [Sun, 14 Aug 2016 00:08:56 +0000 (02:08 +0200)]
libiproute: eliminate some redundant zero stores

function                                             old     new   delta
do_iprule                                            974     955     -19
rtnl_dump_request                                    173     146     -27
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-46)             Total: -46 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoip: fix an improper optimization: req.r.rtm_scope may be nonzero here
Denys Vlasenko [Sat, 13 Aug 2016 23:30:34 +0000 (01:30 +0200)]
ip: fix an improper optimization: req.r.rtm_scope may be nonzero here

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agocp: fix -i for POSIX mode. Closes 9106
Denys Vlasenko [Sat, 13 Aug 2016 21:23:48 +0000 (23:23 +0200)]
cp: fix -i for POSIX mode. Closes 9106

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agontpd: respond only to client and symmetric active packets
Miroslav Lichvar [Mon, 1 Aug 2016 18:24:24 +0000 (20:24 +0200)]
ntpd: respond only to client and symmetric active packets

The busybox NTP implementation doesn't check the NTP mode of packets
received on the server port and responds to any packet with the right
size. This includes responses from another NTP server. An attacker can
send a packet with a spoofed source address in order to create an
infinite loop of responses between two busybox NTP servers. Adding
more packets to the loop increases the traffic between the servers
until one of them has a fully loaded CPU and/or network.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoservice/fw example: do not ruin $if[], use different name
Denys Vlasenko [Sat, 30 Jul 2016 20:29:10 +0000 (22:29 +0200)]
service/fw example: do not ruin $if[], use different name

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agowget: run s_client helper with -servername HOST
Denys Vlasenko [Mon, 25 Jul 2016 19:34:57 +0000 (21:34 +0200)]
wget: run s_client helper with -servername HOST

This is necessary for multi-hosted TLSed web sites.

function                                             old     new   delta
spawn_https_helper_openssl                           334     441    +107

Based on a patch by Jeremy Chadwick <jdc@koitsu.org>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agossl_helper.sh: strip was invoked incorrectly
Denys Vlasenko [Mon, 25 Jul 2016 15:12:46 +0000 (17:12 +0200)]
ssl_helper.sh: strip was invoked incorrectly

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agovar_service/fw: optionally flush all netdevs; optionally prefer one 0/0 routing
Denys Vlasenko [Mon, 25 Jul 2016 14:28:57 +0000 (16:28 +0200)]
var_service/fw: optionally flush all netdevs; optionally prefer one 0/0 routing

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoash: fix handling of ${VAR: -2}
Denys Vlasenko [Mon, 25 Jul 2016 01:56:00 +0000 (03:56 +0200)]
ash: fix handling of ${VAR: -2}

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoconfig: disentangle PREFER_APPLETS from SH_STANDALONE and SH_NOFORK
Denys Vlasenko [Fri, 22 Jul 2016 16:48:38 +0000 (18:48 +0200)]
config: disentangle PREFER_APPLETS from SH_STANDALONE and SH_NOFORK

On user request.
I thought enabling/disabling them all together is more consistent.
Evidently, some people do want them to be separately selectable.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agohush: fix a possible bug
Denys Vlasenko [Thu, 21 Jul 2016 12:40:08 +0000 (14:40 +0200)]
hush: fix a possible bug

Not sure this was actually a triggerable bug, but the code looked flaky.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agotypo fixes
Denys Vlasenko [Tue, 19 Jul 2016 15:48:55 +0000 (17:48 +0200)]
typo fixes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoash: do not leave SIGQUIT ignored on "exec CMD"
Denys Vlasenko [Sat, 16 Jul 2016 16:33:55 +0000 (18:33 +0200)]
ash: do not leave SIGQUIT ignored on "exec CMD"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agocp: make verbose cp show symlink copies too
Denys Vlasenko [Thu, 14 Jul 2016 18:58:39 +0000 (20:58 +0200)]
cp: make verbose cp show symlink copies too

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agosendmail: include -H and -S in short help text
Denys Vlasenko [Thu, 14 Jul 2016 18:06:44 +0000 (20:06 +0200)]
sendmail: include -H and -S in short help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agosendmail: improve help text
Denys Vlasenko [Thu, 14 Jul 2016 17:14:54 +0000 (19:14 +0200)]
sendmail: improve help text

* explain which server we contact by default
* explain when auth is done
* -t is not implied! remove that from help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agotrylink: use "mktemp tmp.XXXXXXXXXX" to placate OS X
Denys Vlasenko [Tue, 12 Jul 2016 11:54:35 +0000 (13:54 +0200)]
trylink: use "mktemp tmp.XXXXXXXXXX" to placate OS X

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years ago{md5,shaN}sum: make -c EMPTY fail
Denys Vlasenko [Mon, 11 Jul 2016 17:51:08 +0000 (19:51 +0200)]
{md5,shaN}sum: make -c EMPTY fail

function                                             old     new   delta
md5_sha1_sum_main                                    466     485     +19

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoexamples: add a useful "see abridged log" script for ntpd service example
Denys Vlasenko [Sun, 10 Jul 2016 18:15:28 +0000 (20:15 +0200)]
examples: add a useful "see abridged log" script for ntpd service example

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agocpio: tweak help text
Denys Vlasenko [Fri, 8 Jul 2016 10:52:24 +0000 (12:52 +0200)]
cpio: tweak help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agogetopt32: add new syntax of 'o:+' and 'o:*' for -o NUM and -o LIST
Denys Vlasenko [Wed, 6 Jul 2016 19:58:02 +0000 (21:58 +0200)]
getopt32: add new syntax of 'o:+' and 'o:*' for -o NUM and -o LIST

In many cases, this aqllows to drop use of opt_complementary.
Approximately -400 bytes:

function                                             old     new   delta
getopt32                                            1423    1502     +79
opt_string                                            17      18      +1
OPT_STR                                               24      25      +1
uniq_main                                            416     406     -10
timeout_main                                         279     269     -10
sulogin_main                                         270     260     -10
readprofile_main                                    1825    1815     -10
ps_main                                              543     533     -10
pidof_main                                           245     235     -10
pgrep_main                                           611     601     -10
od_main                                             2600    2590     -10
mkfs_minix_main                                     2684    2674     -10
mkfs_ext2_main                                      2603    2593     -10
microcom_main                                        712     702     -10
makemime_main                                        315     305     -10
ionice_main                                          282     272     -10
inetd_main                                          2074    2064     -10
ifplugd_main                                        1144    1134     -10
halt_main                                            353     343     -10
getopt_main                                          636     626     -10
fdisk_main                                          2854    2844     -10
env_main                                             206     196     -10
dmesg_main                                           319     309     -10
conspy_main                                         1214    1204     -10
awk_main                                             981     971     -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/22 up/down: 81/-220)         Total: -139 bytes
   text    data     bss     dec     hex filename
 919373     906   14060  934339   e41c3 busybox_old
 918969     906   14060  933935   e402f busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agowhois: implement -i
Denys Vlasenko [Wed, 6 Jul 2016 15:16:27 +0000 (17:16 +0200)]
whois: implement -i

function                                             old     new   delta
whois_main                                           654     675     +21
packed_usage                                       30355   30356      +1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agowhois: make it actually work
Denys Vlasenko [Wed, 6 Jul 2016 13:45:41 +0000 (15:45 +0200)]
whois: make it actually work

It was doing way too simplistic work of just querying the server,
no redirects, no query massaging. This required user to know a lot about whois,
and enter at least three queries for each host to get meaningful information.

function                                             old     new   delta
whois_main                                           209     646    +437

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agobuild system: fix a few warnings for allnoconfig build
Denys Vlasenko [Tue, 5 Jul 2016 19:43:28 +0000 (21:43 +0200)]
build system: fix a few warnings for allnoconfig build

Not that allnoconfig build is useful in any way...

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agolibbb: suppress warning about run_applet_and_exit
Ron Yorston [Tue, 5 Jul 2016 13:07:50 +0000 (14:07 +0100)]
libbb: suppress warning about run_applet_and_exit

When busybox is configured to contain a single applet an unnecessary
declaration of run_applet_and_exit results in a warning.  Move the
declaration to avoid this.

Reported-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoarp: fix buffer overflow. Closes 9071
Denys Vlasenko [Mon, 4 Jul 2016 15:38:01 +0000 (17:38 +0200)]
arp: fix buffer overflow. Closes 9071

function                                             old     new   delta
arp_main                                            1910    1898     -12

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoudhcpc: run "deconfig" script in manual renew state too. closes 9061
Denys Vlasenko [Sun, 3 Jul 2016 18:26:44 +0000 (20:26 +0200)]
udhcpc: run "deconfig" script in manual renew state too. closes 9061

The bug was seen when the following is done:

    # killall 1 udhpc; killall 2 udhpc

Performing a DHCP renew
state: 2 -> 5
Sending renew...
Entering released state
state: 5 -> 6  <<<<<<<<<<<<<< not calling script!!!!

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agontpd: daemonize before DNS resolution
Denys Vlasenko [Sun, 3 Jul 2016 15:58:54 +0000 (17:58 +0200)]
ntpd: daemonize before DNS resolution

This resolves the following use case problem:

"I start ntpd by default from /etc/init.d

There might be no working network connection (not configured properly for
whatever reason, hardware problems, whatelse).

With busybox 1.25 ntpd seems to loop forever if now NTP servers are found,
blocking the boot process  and I never get a login to solve a possible pb or
to do a first time configuration."

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agobuild system: make CONFIG_FEATURE_USE_BSS_TAIL less funky
Denys Vlasenko [Wed, 29 Jun 2016 13:00:52 +0000 (15:00 +0200)]
build system: make CONFIG_FEATURE_USE_BSS_TAIL less funky

CONFIG_FEATURE_USE_BSS_TAIL code was aliasing bb_common_bufsiz1 to _end.
This is unreliable: _end may be not sufficiently aligned.

Change code to simply enlarge COMMON_BUFSIZE when we detect that _end
has significant amount of space to the end of page.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agodf: use f_frsize instead of f_bsize for correct sizes
Natanael Copa [Thu, 23 Jun 2016 08:42:40 +0000 (10:42 +0200)]
df: use f_frsize instead of f_bsize for correct sizes

Use the correct field f_frsize instead of f_bsize.

The statfs f_bsize is the "Optimal transfer block size" while the
f_frsize is the "Fragment size (since Linux 2.6)". On some FUSE
filesystems those may differ.

Fixes bug 9046

URL: https://bugs.busybox.net/show_bug.cgi?id=9046

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoi2cdump: don't use common_bufsiz1
Bartosz Golaszewski [Thu, 23 Jun 2016 15:19:50 +0000 (17:19 +0200)]
i2cdump: don't use common_bufsiz1

Commit e6a2f4cc changed the way common_bufsiz1 works. Now it needs to
be initialized before using, but i2cdump wasn't updated by said patch.

Since the fact that we're using common_bufsiz1 here isn't obvious (no
G_INIT() macro, no other global variables), drop it and simply
allocate the integer array required for block reads on the stack.

Tested with i2c block read on a Lenovo Thinkpad laptop.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoping: populate icmp_id field for "simple" ping too
Jonas Danielsson [Thu, 23 Jun 2016 16:26:32 +0000 (18:26 +0200)]
ping: populate icmp_id field for "simple" ping too

The ICMP RFC says that identifier and sequence number may be zero.
Having them zero for a Echo message, along with a data of zero's
as well will result in a Echo reply message with only zero's.

Some NAT implementations seem to get the checksum wrong on these
packages. Setting a checksum of 0x0 instead of 0xffff.

Through NAT:
  Internet Control Message Protocol
      Type: 0 (Echo (ping) reply)
      Code: 0
      Checksum: 0x0000 [incorrect, should be 0xffff]
      Identifier (BE): 0 (0x0000)
      Identifier (LE): 0 (0x0000)
      Sequence number (BE): 0 (0x0000)
      Sequence number (LE): 0 (0x0000)
      Data (56 bytes)
          Data: 000000000000000000000000000000000000000000000000...
          [Length: 56]

Without NAT:
  Internet Control Message Protocol
      Type: 0 (Echo (ping) reply)
      Code: 0
      Checksum: 0xffff [correct]
      Identifier (BE): 0 (0x0000)
      Identifier (LE): 0 (0x0000)
      Sequence number (BE): 0 (0x0000)
      Sequence number (LE): 0 (0x0000)
      [Request frame: 189]
      [Response time: 0.024 ms]
      Data (56 bytes)
          Data: 000000000000000000000000000000000000000000000000...
          [Length: 56]

And this in turn will make some hardware MAC checksum offloading
engines drop the packet.

(This was seen with a Synopsis MAC, the same one used in for instance the
stmmac Ethernet driver in the linux kernel.)

This change can be seen as a workaround for bugs in other layers.
But just setting an identifier for the Echo message packet will
avoid prodding the hornets nest.

function                                             old     new   delta
common_ping_main                                     424     500     +76

Signed-off-by: Jonas Danielsson <jonasdn@axis.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoStart 1.26.0 development cycle
Denys Vlasenko [Wed, 22 Jun 2016 01:10:21 +0000 (03:10 +0200)]
Start 1.26.0 development cycle

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoBump version to 1.25.0 1_25_0
Denys Vlasenko [Mon, 20 Jun 2016 22:15:49 +0000 (00:15 +0200)]
Bump version to 1.25.0

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agolibarchive: fix xmalloc_open_zipped_read_close()
Denys Vlasenko [Tue, 21 Jun 2016 00:04:16 +0000 (02:04 +0200)]
libarchive: fix xmalloc_open_zipped_read_close()

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agosetsid: fix broken -c
Denys Vlasenko [Mon, 20 Jun 2016 21:50:26 +0000 (23:50 +0200)]
setsid: fix broken -c

This did not work: setsid sh -c 'anything'

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agotypo fix
Denys Vlasenko [Mon, 20 Jun 2016 14:28:53 +0000 (16:28 +0200)]
typo fix

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoscripts/trylink: libbusybox fix
Denys Vlasenko [Mon, 20 Jun 2016 10:23:35 +0000 (12:23 +0200)]
scripts/trylink: libbusybox fix

gcc 6.1.1 can emit empty line with spaces

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agolibarchive: fix open_zipped()
Denys Vlasenko [Mon, 20 Jun 2016 09:42:00 +0000 (11:42 +0200)]
libarchive: fix open_zipped()

Last commit broke it (on both MMU and NOMMU)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agolibarchive: fix xmalloc_open_zipped_read_close() on NOMMU
Denys Vlasenko [Mon, 20 Jun 2016 09:06:42 +0000 (11:06 +0200)]
libarchive: fix xmalloc_open_zipped_read_close() on NOMMU

The somewhat new "unpack in memory" code was broken
for xmalloc_open_zipped_read_close() on NOMMU: we seek back
over signature, but then expect it to be already consumed.
Stop seeking back in this case.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agorandomconfig fixes 5: false positive for tar; mount emits corrupted message
Denys Vlasenko [Mon, 20 Jun 2016 09:04:04 +0000 (11:04 +0200)]
randomconfig fixes 5: false positive for tar; mount emits corrupted message

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agomodprobe-small: fix bogus handling of unpack errors
Denys Vlasenko [Mon, 20 Jun 2016 08:59:06 +0000 (10:59 +0200)]
modprobe-small: fix bogus handling of unpack errors

"modprobe minix; echo $?"

Was:
modprobe: corrupted data
modprobe: read error from 'kernel/fs/minix/minix.ko.xz': No such file or directory
modprobe: corrupted data
modprobe: read error from 'kernel/fs/minix/minix.ko.xz': No such file or directory
modprobe: corrupted data
modprobe: read error from 'kernel/fs/minix/minix.ko.xz'
modprobe: 'kernel/fs/minix/minix.ko.xz': Success
0

Now:
modprobe: corrupted data
modprobe: read error from 'kernel/fs/minix/minix.ko.xz'
1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agorandomconfig fixes 4
Denys Vlasenko [Sun, 19 Jun 2016 23:40:19 +0000 (01:40 +0200)]
randomconfig fixes 4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agorandomconfig fixes 3
Denys Vlasenko [Sun, 19 Jun 2016 22:36:21 +0000 (00:36 +0200)]
randomconfig fixes 3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agorandomconfig fixes 2
Denys Vlasenko [Sun, 19 Jun 2016 19:54:04 +0000 (21:54 +0200)]
randomconfig fixes 2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agorandomconfig fixes
Denys Vlasenko [Sun, 19 Jun 2016 16:15:33 +0000 (18:15 +0200)]
randomconfig fixes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agolibbb: move common code into run_applet_and_exit
Ron Yorston [Tue, 7 Jun 2016 11:12:07 +0000 (12:12 +0100)]
libbb: move common code into run_applet_and_exit

Both calls to run_applet_and_exit are followed by the same code
to print an error message and return status 127.  Remove this
duplication and make run_applet_and_exit static.

function                                             old     new   delta
run_applet_and_exit                                  675     667      -8
main                                                 119      92     -27
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-35)             Total: -35 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoAllow "busybox <applet>" to work when busybox is disabled
Ron Yorston [Tue, 7 Jun 2016 09:26:24 +0000 (10:26 +0100)]
Allow "busybox <applet>" to work when busybox is disabled

A recent commit made it possible to disable BusyBox's --install
and --list options.  However it also stopped "busybox <applet>
<params>" from working.

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agontpd: retry initial DNS resolution (forever, no timeout for now).
Denys Vlasenko [Mon, 6 Jun 2016 00:26:49 +0000 (02:26 +0200)]
ntpd: retry initial DNS resolution (forever, no timeout for now).

Some users start ntpd on boot, and don't babysit it. If it dies because
DNS is not yet up and therefore NTP servers can't be found, users are
not happy.

Example behavior with a peer name which can't be resolved:

ntpd: bad address 'qwe.rty.ghj.kl'
...5 sec...
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
...

Based on the patch by Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>

function                                             old     new   delta
resolve_peer_hostname                                  -      81     +81
ntpd_main                                           1130    1061     -69
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 81/-69)             Total: 12 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agolibbb: fix time parsing of [[CC]YY]MMDDhhmm[.SS]. Closes 8951
Natanael Copa [Thu, 19 May 2016 15:31:59 +0000 (17:31 +0200)]
libbb: fix time parsing of [[CC]YY]MMDDhhmm[.SS]. Closes 8951

If SS is not given a value, it is assumed to be zero.
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/touch.html

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoMake busybox an optional applet
Denys Vlasenko [Tue, 31 May 2016 00:42:49 +0000 (02:42 +0200)]
Make busybox an optional applet

If it's disabled, code shrinks by about 900 bytes:

function                                             old     new   delta
usr_bin                                               10       -     -10
usr_sbin                                              11       -     -11
install_dir                                           20       -     -20
applet_install_loc                                   184       -    -184
run_applet_and_exit                                  686      21    -665
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 0/1 up/down: 0/-890)           Total: -890 bytes
   text    data     bss     dec     hex filename
 911327     493    7336  919156   e0674 busybox_old
 909848     493    7336  917677   e00ad busybox_unstripped

but busybox executable by itself does not say anything useful:

$ busybox
busybox: applet not found

Based on the patch by Ron Yorston <rmy@pobox.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agocp: add -u/--update and --remove-destination
Denys Vlasenko [Thu, 26 May 2016 22:46:38 +0000 (00:46 +0200)]
cp: add -u/--update and --remove-destination

Based on the patch by wdlkmpx@gmail.com

function                                             old     new   delta
copy_file                                           1546    1644     +98
add_partition                                       1270    1362     +92
ask_and_unlink                                        95     133     +38
do_iproute                                           132     157     +25
decode_one_format                                    710     715      +5
cp_main                                              369     374      +5
ubirename_main                                       198     202      +4
read_package_field                                   232     230      -2
bb_make_directory                                    421     412      -9
packed_usage                                       30505   30476     -29
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 7/3 up/down: 267/-40)           Total: 227 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoarping: avoid use of ether_ntoa(). Closes 8926
Denys Vlasenko [Thu, 26 May 2016 19:35:46 +0000 (21:35 +0200)]
arping: avoid use of ether_ntoa(). Closes 8926

This is the only non-debug use of ether_ntoa(). By not using it,
we reduce bss:

function                                             old     new   delta
arping_main                                         1568    1665     +97
static.asc                                            18       -     -18
ether_ntoa                                            57       -     -57
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 1/0 up/down: 97/-75)             Total: 22 bytes
   text    data     bss     dec     hex filename
 911020     493    7352  918865   e0551 busybox_old
 911069     493    7336  918898   e0572 busybox_unstripped

Also, "standard" arping zero-pads MAC. ether_ntoa() does not.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agosed: fix append command to match GNU sed 4.2.1
Denys Vlasenko [Fri, 6 May 2016 16:25:56 +0000 (18:25 +0200)]
sed: fix append command to match GNU sed 4.2.1

This closes one testcase failure

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoflock: merge spawn_and_wait() code patchs for -c and sans-c uses
Denys Vlasenko [Sun, 24 Apr 2016 16:21:32 +0000 (18:21 +0200)]
flock: merge spawn_and_wait() code patchs for -c and sans-c uses

function                                             old     new   delta
flock_main                                           334     319     -15

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoflock: fix -c; improve error handling of fork+exec
Denys Vlasenko [Sun, 24 Apr 2016 16:19:49 +0000 (18:19 +0200)]
flock: fix -c; improve error handling of fork+exec

function                                             old     new   delta
flock_main                                           254     334     +80

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoip: fix problem on mips64 n64 big endian musl systems
Szabolcs Nagy [Sun, 24 Apr 2016 15:39:02 +0000 (17:39 +0200)]
ip: fix problem on mips64 n64 big endian musl systems

Use designated initializers for struct msghdr.
The struct layout is non-portable and musl libc does not match what busybox expects.

Signed-off-by: Szabolcs Nagy <nsz@port70.net>
Tested-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agosed: understand \n,\r and \t in i and a commands. Closes 8871
Denys Vlasenko [Sun, 24 Apr 2016 14:18:03 +0000 (16:18 +0200)]
sed: understand \n,\r and \t in i and a commands. Closes 8871

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agogenerate_BUFSIZ.sh: yet another tweak
Denys Vlasenko [Sun, 24 Apr 2016 12:13:35 +0000 (14:13 +0200)]
generate_BUFSIZ.sh: yet another tweak

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years ago*: slap on a few ALIGN1/2s where appropriate
Denys Vlasenko [Fri, 22 Apr 2016 16:09:21 +0000 (18:09 +0200)]
*: slap on a few ALIGN1/2s where appropriate

The result of looking at "grep -F -B2 '*fill*' busybox_unstripped.map"

   text    data     bss     dec     hex filename
 829901    4086    1904  835891   cc133 busybox_before
 829665    4086    1904  835655   cc047 busybox

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoscripts/trylink: document DATA_SEGMENT_ALIGN() hack
Denys Vlasenko [Fri, 22 Apr 2016 00:00:04 +0000 (02:00 +0200)]
scripts/trylink: document DATA_SEGMENT_ALIGN() hack

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agogenerate_BUFSIZ.sh: catch BUFSIZE < 1024 also on "big" builds
Denys Vlasenko [Thu, 21 Apr 2016 22:24:53 +0000 (00:24 +0200)]
generate_BUFSIZ.sh: catch BUFSIZE < 1024 also on "big" builds

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agobuild system: fix generate_BUFSIZ.sh to not alternate 1k and malloc builds
Denys Vlasenko [Thu, 21 Apr 2016 21:52:35 +0000 (23:52 +0200)]
build system: fix generate_BUFSIZ.sh to not alternate 1k and malloc builds

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agolibbb: constify *bb_common_bufsiz1 (if it is compiled to be a pointer)
Denys Vlasenko [Thu, 21 Apr 2016 19:47:45 +0000 (21:47 +0200)]
libbb: constify *bb_common_bufsiz1 (if it is compiled to be a pointer)

This lets gcc optimize much better:

   text    data     bss     dec     hex filename
 922846     910   13056  936812   e4b6c busybox_unstripped.nonconst
 920255     910   13056  934221   e414d busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agolibbb: make "COMMON_BUFSIZE = 1024 bytes, the buffer will be malloced" work
Denys Vlasenko [Thu, 21 Apr 2016 19:03:51 +0000 (21:03 +0200)]
libbb: make "COMMON_BUFSIZE = 1024 bytes, the buffer will be malloced" work

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoudhcp: add setup_common_bufsiz() as needed
Denys Vlasenko [Thu, 21 Apr 2016 16:54:36 +0000 (18:54 +0200)]
udhcp: add setup_common_bufsiz() as needed

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years ago*: hopefully all setup_common_bufsiz() are in place
Denys Vlasenko [Thu, 21 Apr 2016 16:38:51 +0000 (18:38 +0200)]
*: hopefully all setup_common_bufsiz() are in place

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years ago*: add most of the required setup_common_bufsiz() calls
Denys Vlasenko [Thu, 21 Apr 2016 16:18:48 +0000 (18:18 +0200)]
*: add most of the required setup_common_bufsiz() calls

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agolibbb: make bb_common_bufsiz1 1 kbyte, add capability to use bss tail for it
Denys Vlasenko [Thu, 21 Apr 2016 14:26:30 +0000 (16:26 +0200)]
libbb: make bb_common_bufsiz1 1 kbyte, add capability to use bss tail for it

The config item is FEATURE_USE_BSS_TAIL. When it is off (default):

function                                             old     new   delta
read_config                                          210     228     +18
doCommands                                          2279    2294     +15
ipneigh_list_or_flush                                763     772      +9
ipaddr_list_or_flush                                1256    1261      +5
display_process_list                                1301    1306      +5
conspy_main                                         1378    1383      +5
do_lzo_compress                                      352     355      +3
do_lzo_decompress                                    565     567      +2
push                                                  46      44      -2
inetd_main                                          2136    2134      -2
uevent_main                                          421     418      -3
addLines                                              97      92      -5
bb_common_bufsiz1                                   8193    1024   -7169
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 8/5 up/down: 62/-7181)        Total: -7119 bytes
   text    data     bss     dec     hex filename
 829850    4086    9080  843016   cdd08 busybox_old
 829901    4086    1904  835891   cc133 busybox_unstripped

FEATURE_USE_BSS_TAIL=y:

read_config                                          210     228     +18
doCommands                                          2279    2294     +15
ipneigh_list_or_flush                                763     772      +9
ipaddr_list_or_flush                                1256    1261      +5
display_process_list                                1301    1306      +5
conspy_main                                         1378    1383      +5
do_lzo_compress                                      352     355      +3
do_lzo_decompress                                    565     567      +2
inetd_main                                          2136    2134      -2
bb_common_bufsiz1                                   8193       -   -8193
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 8/1 up/down: 62/-8195)        Total: -8133 bytes
   text    data     bss     dec     hex filename
 829850    4086    9080  843016   cdd08 busybox_old
 829911    4086     880  834877   cbd3d busybox_unstripped

FIXME: setup_common_bufsiz() calls are missing.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agounzip: shorter code for date/time generation
Denys Vlasenko [Mon, 18 Apr 2016 00:34:29 +0000 (02:34 +0200)]
unzip: shorter code for date/time generation

function                                             old     new   delta
unzip_main                                          2426    2414     -12

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agounzip: better match for "standard" unzip's output; string shrinkage
Denys Vlasenko [Sun, 17 Apr 2016 23:43:24 +0000 (01:43 +0200)]
unzip: better match for "standard" unzip's output; string shrinkage

function                                             old     new   delta
unzip_main                                          2490    2426     -64
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-64)             Total: -64 bytes
   text    data     bss     dec     hex filename
 924008     906   17160  942074   e5ffa busybox_old
 923846     906   17160  941912   e5f58 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agounzip: fix percent overflow; show "stored" files properly
Denys Vlasenko [Sun, 17 Apr 2016 23:14:05 +0000 (01:14 +0200)]
unzip: fix percent overflow; show "stored" files properly

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agounzip: fix a case where we find wrong CDE. Closes 8821
Denys Vlasenko [Sun, 17 Apr 2016 19:05:34 +0000 (21:05 +0200)]
unzip: fix a case where we find wrong CDE. Closes 8821

function                                             old     new   delta
unzip_main                                          2472    2490     +18

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoash: bash-compatible $'...' shouldn't expand in double quotes
Ron Yorston [Sun, 3 Apr 2016 21:43:14 +0000 (22:43 +0100)]
ash: bash-compatible $'...' shouldn't expand in double quotes

Bash doesn't expand its $'...' construct in double quotes:

   $ echo "$'a\tb'"
   $'a\tb'

Change BusyBox ash to do the same.  This also fixes a problem with
here documents where BusyBox ash gave an incorrect result for:

   $ cat <<EOF
   > '$'
   > EOF
   '$'

Reported-by: Timo Teras <timo.teras@iki.fi>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agoRewrite iteration through applet names to save a few bytes
Ron Yorston [Fri, 8 Apr 2016 10:57:20 +0000 (11:57 +0100)]
Rewrite iteration through applet names to save a few bytes

function                                             old     new   delta
run_applet_and_exit                                  758     755      -3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-3)               Total: -3 bytes

In standalone shell mode the saving increases to 17 bytes.

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agosed: support "-f -" idiom
Denys Vlasenko [Thu, 7 Apr 2016 22:20:36 +0000 (00:20 +0200)]
sed: support "-f -" idiom

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
8 years agounrpm: clean up
Mike Frysinger [Mon, 4 Apr 2016 05:39:17 +0000 (01:39 -0400)]
unrpm: clean up

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agoundeb: clean up
Mike Frysinger [Mon, 4 Apr 2016 05:35:34 +0000 (01:35 -0400)]
undeb: clean up

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agosyslogd: minor tweaks to text
Mike Frysinger [Mon, 4 Apr 2016 05:28:32 +0000 (01:28 -0400)]
syslogd: minor tweaks to text

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agokconfig/lxdialog: get ncurses CFLAGS with pkg-config
Bjørn Forsman [Sun, 14 Sep 2014 10:57:50 +0000 (12:57 +0200)]
kconfig/lxdialog: get ncurses CFLAGS with pkg-config

This makes "make menuconfig" also work on systems where ncurses is not
installed in a standard location (such as on NixOS).

This patch changes ccflags() so that it tries pkg-config first, and only
if pkg-config fails does it go back to the fallback/manual checks. This
is the same algorithm that ldflags() already uses.

Signed-off-by: Bjørn Forsman <bjorn.forsman@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agokbuild: Make scripts executable
Michal Marek [Wed, 20 Aug 2014 14:02:59 +0000 (16:02 +0200)]
kbuild: Make scripts executable

The Makefiles call the respective interpreter explicitly, but this makes
it easier to use the scripts manually.

Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agokconfig/lxdialog: rationalise the include paths where to find {.n}curses{,w}.h
Yann E. MORIN [Fri, 22 Mar 2013 22:12:16 +0000 (23:12 +0100)]
kconfig/lxdialog: rationalise the include paths where to find {.n}curses{,w}.h

The current code does this:

    if [ -f /usr/include/ncursesw/curses.h ]; then
        echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"'
    elif [ -f /usr/include/ncurses/ncurses.h ]; then
        echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
    elif [ -f /usr/include/ncurses/curses.h ]; then
        echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"'
    [...]

This is merely inconsistent:
  - adding the full path to the directory in the -I directive,
  - especially since that path is already a sub-path of the system
    include path,
  - and then repeating the sub-path in the #include directive.

Rationalise each include directive:
  - only use the filename in the #include directive,
  - keep the -I directives: they are always searched for before the
    system include path; this ensures the correct header is used.

Using the -I directives and the filename-only in #include is more in
line with how pkg-config behaves, eg.:
    $ pkg-config --cflags ncursesw
    -I/usr/include/ncursesw

This paves the way for using pkg-config for CFLAGS, too, now we use it
to find the libraries.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agomenuconfig: optionally use pkg-config to detect ncurses libs
Justin Lecher [Wed, 6 Mar 2013 13:02:01 +0000 (14:02 +0100)]
menuconfig: optionally use pkg-config to detect ncurses libs

When building ncurses with --with-termlib several symbols get moved from
libncurses.so to libtinfo.so. Thus when linking with libncurses.so, one
additionally needs to link with libtinfo.so.

The ncurses pkg-config module will be used to detect the necessary libs for
linking. If not available the old heuristic for detection of the ncurses libs
will be used.

Signed-off-by: Justin Lecher <jlec@gentoo.org>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agomenuconfig: fix extended colors ncurses support
Krzysztof Mazur [Mon, 8 Oct 2012 16:18:22 +0000 (18:18 +0200)]
menuconfig: fix extended colors ncurses support

The ncurses library allows for extended colors. The support for extended
colors support depends on wide-character support. ncurses headers
enable extended colors (NCURSES_EXT_COLORS) only when wide-character
support is enabled (NCURSES_WIDECHAR).

The "make menuconfig" uses wide-character ncursesw library, which can be
compiled with wide-character support, but does not define NCURSES_WIDECHAR
and it's using headers without wide-character (and extended colors) support.

This fixes problems with colors on systems with enabled extended colors
(like PLD Linux). Without this patch "make menuconfig" is hard to use.

Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agokbuild: Fix gcc -x syntax
Jean Delvare [Tue, 2 Oct 2012 14:42:36 +0000 (16:42 +0200)]
kbuild: Fix gcc -x syntax

The correct syntax for gcc -x is "gcc -x assembler", not
"gcc -xassembler". Even though the latter happens to work, the former
is what is documented in the manual page and thus what gcc wrappers
such as icecream do expect.

This isn't a cosmetic change. The missing space prevents icecream from
recognizing compilation tasks it can't handle, leading to silent kernel
miscompilations.

Besides me, credits go to Michael Matz and Dirk Mueller for
investigating the miscompilation issue and tracking it down to this
incorrect -x parameter syntax.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: stable@vger.kernel.org
Cc: Bernhard Walle <bernhard@bwalle.de>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agokconfig: fix check-lxdialog for DLL platforms
Yaakov Selkowitz [Wed, 13 Jun 2012 00:05:15 +0000 (19:05 -0500)]
kconfig: fix check-lxdialog for DLL platforms

Import libraries on Cygwin and MinGW/MSYS use the .dll.a suffix, so
checking this suffix is necessary to make sure ncurses will still be
found when built without static libraries.

Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agokconfig: check ncursesw headers first in check-lxdialog
Yaakov Selkowitz [Wed, 13 Jun 2012 00:05:02 +0000 (19:05 -0500)]
kconfig: check ncursesw headers first in check-lxdialog

Commit 8c41e5e363db55d91aa3b1cdce4ab02ad9821de7 added a check for
ncursesw/curses.h for the case where ncurses and ncursesw are build
separately but only one is installed.  But if both are installed,
the headers ncurses/curses.h and ncursesw/curses.h differ, and since
libncursesw will be found first, so should ncursesw/curses.h.

Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agokconfig: fix menuconfig on debian lenny
Junio C Hamano [Sun, 19 Sep 2010 02:25:32 +0000 (19:25 -0700)]
kconfig: fix menuconfig on debian lenny

In 60f33b8 (kconfig: get rid of stray a.o, support ncursesw, 2006-01-15),
support to link menuconfig with ncursesw library was added.  To compute
the linker command option -l, we check "libncursesw.{so,a,dylib}" to allow
ncursesw to be used as a replacement ncurses.  However, when checking what
header file to include, we do not check /usr/include/ncursesw directory.

Add /usr/include/ncursesw to the list of directories that are checked.
With this patch, on my Debian Lenny box with libncursesw5-dev package but
not libncurses5-dev package, I can say "make menuconfig".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>