Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 501092 - sys-apps/busybox: ar: add support for the -s option, and new ranlib applet (used by the Linux kernel)
Summary: sys-apps/busybox: ar: add support for the -s option, and new ranlib applet (u...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Embedded Gentoo Team
URL:
Whiteboard:
Keywords:
: 505578 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-02-12 16:35 UTC by Richard Yao
Modified: 2015-12-16 19:16 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Yao gentoo-dev 2014-02-12 16:35:41 UTC
Builtins in busybox are also builtins in busybox's shell. Busybox's ar does not support s, which breaks Linux kernel compilation because the Linux kernel requires it.

I see no reason why sys-apps/busybox should include ar, so lets remove it. Otherwise, we need to add the s option to it to permit Linux kernel builds to succeed.
Comment 1 Ian Stakenvicius gentoo-dev 2014-02-12 18:29:18 UTC
More specifically, the default for AR should probably match the default for RANLIB, and since RANLIB is off by default...
Comment 2 SpanKY gentoo-dev 2014-02-13 10:31:40 UTC
uhh, what now ?  so what if `busybox ar` works ?  `ar` found via the $PATH is the standard binutils ar.

the fact that ranlib is disabled does not mean ar should also be.  ranlib is an optional post-processing optimization step to create an index in large archives.  ar itself is a simple archive management utility.
Comment 3 Andreas Klauer 2014-02-13 14:46:00 UTC
The beauty of Gentoo's busybox is that it's not castrated like Debian's. Why is anyone trying to build Linux from within a busybox shell anyway? Also, you can just alias ar=/usr/bin/ar as a workaround. Not sure if busybox has a setting to try the binary before builtin... it certainly has a setting to disable the builtin in the first place, but that causes other issues / requires you to create a ton of symlinks...
Comment 4 Richard Yao gentoo-dev 2014-02-13 22:00:55 UTC
(In reply to SpanKY from comment #2)
> uhh, what now ?  so what if `busybox ar` works ?  `ar` found via the $PATH
> is the standard binutils ar.
> 
> the fact that ranlib is disabled does not mean ar should also be.  ranlib is
> an optional post-processing optimization step to create an index in large
> archives.  ar itself is a simple archive management utility.

Invoking a shell builtin ignores $PATH and all busybox utilities are builtins for the busybox shell. The busybox shell interpreter is remarkably POSIX conformant and quite excellent for a couple of reasons. However, the non-POSIX conformant ar builtin breaks things like the Linux build system. The two main reasons why using busybox as /bin/sh is desireable are:

1. It performs better, which is noticeable on systems with weak CPUs. Users like this.
2. It enables early detection of POSIX conformance bugs, which helps Gentoo FreeBSD.

That being said, I am inclined to think that we have no reason to have ar in busybox. Is there any reason why we need it? If we really do need it, we could just enable CONFIG_AR_POSIX and this problem will go away.
Comment 5 Richard Yao gentoo-dev 2014-02-13 22:05:41 UTC
(In reply to Andreas Klauer from comment #3)
> The beauty of Gentoo's busybox is that it's not castrated like Debian's. Why
> is anyone trying to build Linux from within a busybox shell anyway? Also,
> you can just alias ar=/usr/bin/ar as a workaround. Not sure if busybox has a
> setting to try the binary before builtin... it certainly has a setting to
> disable the builtin in the first place, but that causes other issues /
> requires you to create a ton of symlinks...

The association between busybox shell and the build failure is very hard to make. I have had to explain this multiple times to several very intelligent people for them to understand what was happening. Failing to correct it is like leaving bear traps on the ground in an unlit room where people are expected to walk. The idea that people should have to workaround problems 99.9% of them cannot understand is sadistic.

Also, I don't know what your complaint is with Debian's busybox, but that has nothing to do with Gentoo.
Comment 6 Anthony Basile gentoo-dev 2014-02-13 22:11:21 UTC
(In reply to SpanKY from comment #2)
> uhh, what now ?  so what if `busybox ar` works ?  `ar` found via the $PATH
> is the standard binutils ar.
> 

On my regular desktop system, I did the following:

# rm sh
# ln -sf busybox sh
# sh
# which ar
/usr/bin/ar
# ls -alh /usr/bin/ar
lrwxrwxrwx    1 root     root          22 Dec 23 03:22 /usr/bin/ar -> x86_64-pc-linux-gnu-ar
# ar
BusyBox v1.21.0 (2013-12-07 13:59:16 EST) multi-call binary.

Usage: ar [-o] [-v] [-p] [-t] [-x] ARCHIVE FILES

Extract or list FILES from an ar archive

	-o	Preserve original dates
	-p	Extract to stdout
	-t	List
	-x	Extract
	-v	Verbose

# echo $PATH
/root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.3:/usr/lib64/subversion/bin


So it seems that even if binutils' ar is in $PATH, when your sh is busybox, invoking ar invokes the builtin.
Comment 7 Anthony Basile gentoo-dev 2014-02-13 22:14:44 UTC
(In reply to Richard Yao from comment #5)

> I have had to explain this multiple times to several very intelligent
> people for them to understand what was happening.

I was one of them. Even easier steps to reproduce:



blueness@yellow ~ $ busybox sh
~ $ ls -alh `which ar`
lrwxrwxrwx    1 root     root          22 Dec 23 03:22 /usr/bin/ar -> x86_64-pc-linux-gnu-ar
~ $ ar
BusyBox v1.21.0 (2013-12-07 13:59:16 EST) multi-call binary.

Usage: ar [-o] [-v] [-p] [-t] [-x] ARCHIVE FILES

Extract or list FILES from an ar archive

	-o	Preserve original dates
	-p	Extract to stdout
	-t	List
	-x	Extract
	-v	Verbose
Comment 8 SpanKY gentoo-dev 2014-02-14 17:35:44 UTC
(In reply to Richard Yao from comment #4)

the default busybox shell is meant as a rescue shell, not as a build shell.  there are a lot of builtins that can easily break a lot of packages/tests.  i don't think the default config should be considered safe for that use.  so i have no intention of cutting out utils from the rescue shell simply because it breaks this use case.

it would make more sense to create another USE flag that'd produce a second busybox with reduced command set.

so as this bug stands, the answer is "no".
Comment 9 Richard Yao gentoo-dev 2014-02-14 19:22:03 UTC
(In reply to SpanKY from comment #8)
> (In reply to Richard Yao from comment #4)
> 
> the default busybox shell is meant as a rescue shell, not as a build shell. 
> there are a lot of builtins that can easily break a lot of packages/tests. 
> i don't think the default config should be considered safe for that use.  so
> i have no intention of cutting out utils from the rescue shell simply
> because it breaks this use case.
> 
> it would make more sense to create another USE flag that'd produce a second
> busybox with reduced command set.
> 
> so as this bug stands, the answer is "no".

I don't think you understand what my request is here. It is not to remove ar from busybox, but to make it stop having a POSIX non-conformant ar builtin. That means either removing ar or adding POSIX support. Adding POSIX support is a single config option. Do you have any objection to that?
Comment 10 SpanKY gentoo-dev 2014-02-16 02:42:58 UTC
(In reply to Richard Yao from comment #9)

perhaps you should refresh & re-read your own posts ?  you specifically requested its removal.

you're certainly free to send patches to upstream busybox to add additional flags like this to it.
Comment 11 Richard Yao gentoo-dev 2014-02-22 18:52:26 UTC
(In reply to SpanKY from comment #10)
> (In reply to Richard Yao from comment #9)
> 
> perhaps you should refresh & re-read your own posts ?  you specifically
> requested its removal.

I stated there are two options for handling this and recommended removal.

> you're certainly free to send patches to upstream busybox to add additional
> flags like this to it.

The code is *already* there. You just need to flip it on with CONFIG_AR_POSIX.
Comment 12 Hiroshi Takenaka 2014-03-23 10:04:55 UTC
By the way, how can I build the kernel?
I have also been in trouble in this issue for a month.
Comment 13 Alex Xu (Hello71) 2014-03-25 01:21:21 UTC
*** Bug 505578 has been marked as a duplicate of this bug. ***