On Mon, Mar 8, 2010 at 7:54 PM, Rob Landley <[email protected]> wrote:
> On Sunday 07 March 2010 21:07:00 Denys Vlasenko wrote:
>> On Monday 08 March 2010 01:48, Rob Landley wrote:
>> > And VMLINUZ_SIZE is:
>> >
>> > VMLINUX_SIZE := $(shell wc -c $(objtree)/$(KBUILD_IMAGE) 2>/dev/null | \
>> > cut -d' ' -f1)
>> >
>> > VMLINUX_SIZE is blank when using busybox tools.
>> >
>> > The underlying behavioral wonkiness in busybox "cut" is:
>> >
>> > $ busybox wc -c vmlinux
>> > 3335777 vmlinux
>> > $ wc -c vmlinux
>> > 3335777 vmlinux
>> >
>> > Note that we have leading whitespace, the gnu version doesn't. This
>> > leading whitespace is confusing the kernel build, because the cut -d' '
>> > then triggers on our leading whitespace and produces an empty string,
>> > which propogates through the rest of the build to confuse the linker with
>> > a start address of "0x".
>> >
>> > Why do we have unnecessary leading whitespace? What happend to small and
>> > simple and doing no more than absolutely necessary?
>>
>> Good question, I'm redirecting it to author of busybox-1.2.1 (or earlier)
>> since 1.2.1 displays the same behavior. ;)
>
> Actually, I don't remember ever touching wc. (I'm going to have to fight with
> git, aren't I? I really hate git's UI...)
>
> It looks like wc was completely rewritten to make it much more complicated in
> cad5364599e back in 2003, and it was essentially untouched (if you don't count
> removing trailing whitespace and tweaking the GPL boilerplate) until you added
> a special case in 2006:
>
> commit 3ed001ff2631ad6911096148f47a2719a5b6d4f4
> Author: Denis Vlasenko <[email protected]>
> Date: Fri Sep 29 23:41:04 2006 +0000
>
> wc: reduce source cruft, make it so that "wc -c" (one option, no filenames
> will not print leading blanks.
>
> Which would have addressed this problem (and prevented the mips 2.6.33 kernel
> build from breaking) if it wasn't a special case. This cleanup seems to have
> added complexity rather than removing it.
>
> But really, I don't care so much why it's doing what it's doing now as how to
> fix it.
This is the fix I'm going to apply in a few minutes:
--- busybox.4/coreutils/wc.c 2010-01-12 22:15:16.000000000 +0100
+++ busybox.5/coreutils/wc.c 2010-03-08 21:59:01.837629390 +0100
@@ -88,6 +88,8 @@ int wc_main(int argc UNUSED_PARAM, char
if (!argv[0]) {
*--argv = (char *) bb_msg_standard_input;
fname_fmt = "\n";
+ }
+ if (!argv[1]) {
if (!((print_type-1) & print_type)) /* exactly one option? */
start_fmt = "%"COUNT_FMT;
}
--
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox