[BusyBox 0005764]: Disabling features not disabling corresponding command line options & Buggybox not erroring on unknown options

bugs at busybox.net bugs at busybox.net
Mon Oct 27 12:14:58 UTC 2008


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=5764 
====================================================================== 
Reported By:                Andre Klapper
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   5764
Category:                   Other
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             10-27-2008 04:42 PDT
Last Modified:              10-27-2008 05:14 PDT
====================================================================== 
Summary:                    Disabling features not disabling corresponding
command line options & Buggybox not erroring on unknown options
Description: 
Forwarding from https://bugs.maemo.org/show_bug.cgi?id=3132 .

STEPS TO REPRODUCE THE PROBLEM:

~/tst $ ls -la foo
-rw-r--r--    1 user     users          36 May  3 23:08 foo
~/tst $ cat foo
CCCCCC 2
AAAAAA 1
BBBBBB 4
DDDDDD 6
~/tst $ for n in 1 2; do echo busybox $n; busybox sort -n -k$n foo; done
busybox 1
AAAAAA 1
BBBBBB 4
CCCCCC 2
DDDDDD 6
busybox 2
AAAAAA 1
BBBBBB 4
CCCCCC 2
DDDDDD 6

In Busybox 1.6.1 (and also 1.4.1 - see bug
http://busybox.net/bugs/view.php?id=1637 comment
http://busybox.net/bugs/view.php?id=9 where I first
raised this issue) on N810/N800, the -k parameter is always interpreted
as
applying to the first field even when the user wishes to sort on the
second
field.

The -k parameter and sorting on fields other than the first/default field
should be fully supported in all recent versions of busybox.

EXPECTED OUTCOME:

>From Ubuntu Feisty Fawn "sort" command:

neil at nm-tyan:~$ uname -a
Linux nm-tyan 2.6.22-14-generic http://busybox.net/bugs/view.php?id=1 SMP Tue
Feb 12 07:42:25 UTC 2008 i686
GNU/Linux
neil at nm-tyan:~$ which sort
/usr/bin/sort
neil at nm-tyan:~$ for n in 1 2; do echo sort $n; sort -n -k$n foo;done
sort 1
AAAAAA 1
BBBBBB 4
CCCCCC 2
DDDDDD 6
sort 2
AAAAAA 1
CCCCCC 2
BBBBBB 4
DDDDDD 6

ACTUAL OUTCOME:

busybox only ever sorts on the first field even when instructed to sort on
the
second, third etc. field. Consequently the following list is NOT
correctly
sorted on the second field:

busybox 2
AAAAAA 1
BBBBBB 4
CCCCCC 2
DDDDDD 6


http://bugs.busybox.net/view.php?id=1144 implies that the fix should have
gone to Busybox v1.7 or v1.8.  However, when I tested with Busybox
1.10 in Maemo Fremantle, it still exhibited this issue.

And when testing this more, none of:
- using letters (and no -n) instead of numbers,
- putting the letter to second char column, or
- using TAB instead of space
helps.  Busybox sort -k option doesn't do anything. Etch Busybox v1.1.3
worked
fine.

Then I started to look into Busybox 1.10 sources. In our version
CONFIG_FEATURE_SORT_BIG isn't currently enabled.  *Keys and -k work only
if
it's enabled*.

This is the most annoying thing in Busybox.  If you configure out
features, it
doesn't disable the corresponding command line options, it just silently
ignores them (in "ps" case, it ignores all options).  This means that when
e.g.
building software using BB, Busybox can just silently corrupt the
generated
data; when installing software, installation scripts that given Busybox
configuration breaks, don't fail as they should etc.
====================================================================== 

---------------------------------------------------------------------- 
 vda - 10-27-08 05:14  
---------------------------------------------------------------------- 
Works in current svn:

# for n in 1 2; do echo ./busybox $n; ./busybox sort -n -k$n foo; done
./busybox 1
AAAAAA 1
BBBBBB 4
CCCCCC 2
DDDDDD 6
./busybox 2
AAAAAA 1
CCCCCC 2
BBBBBB 4
DDDDDD 6

GNU sort does exactly the same:

# for n in 1 2; do echo $n; sort -n -k$n foo; done
1
AAAAAA 1
BBBBBB 4
CCCCCC 2
DDDDDD 6
2
AAAAAA 1
CCCCCC 2
BBBBBB 4
DDDDDD 6


> Then I started to look into Busybox 1.10 sources. In our version
> CONFIG_FEATURE_SORT_BIG isn't currently enabled. *Keys and -k work
> only if it's enabled*.

D'oh. You disabled the feature and then complain that it doesn't work.

>This is the most annoying thing in Busybox. If you configure out
features,
>it doesn't disable the corresponding command line options,
>it just silently ignores them (in "ps" case, it ignores all options).

The opposite behavior would just annoy different group of people, which
prefers utilities to ignore some switches instead of bombing out. umount
ignores -v (verbose) switch. Do you want it to die instead? How is that
useful?

> This means that when e.g. building software using BB, Busybox can just
> silently corrupt the generated data

D'oh again. If you plan to build software on the machine you install
busybox on, you'd better enable most of the options, since you want
maximum compatibility. Disabling options implies that you know that in
this particular installation it's ok. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
10-27-08 04:42  Andre Klapper  New Issue                                    
10-27-08 04:42  Andre Klapper  Status                   new => assigned     
10-27-08 04:42  Andre Klapper  Assigned To               => BusyBox         
10-27-08 05:14  vda            Note Added: 0014284                          
======================================================================




More information about the busybox-cvs mailing list