[Buildroot] [PATCH v2 2/2] coreutils: optimize the '[' symlink

Baruch Siach baruch at tkos.co.il
Thu Jul 12 19:02:18 UTC 2018


Hi Arnout,

Arnout Vandecappelle writes:
> On 11-07-18 21:51, Baruch Siach wrote:
>> Link '[' directly to the coreutils binary instead of going through
>> 'test'.
>
>  One more small question: did you do a runtime test to be sure that this
> actually works? (That said, if this doesn't work, then the previous one also
> can't have worked.)

Tested in chroot now:
# readlink /usr/bin/[
coreutils
# if /usr/bin/[ 0 -eq 0 ]; then echo true; else echo false; fi
true
# if /usr/bin/[ 1 -eq 0 ]; then echo true; else echo false; fi
false

baruch

>> Suggested-by: Arnout Vandecappelle <arnout at mind.be>
>> Signed-off-by: Baruch Siach <baruch at tkos.co.il>
>> ---
>> v2: New patch in this series
>> ---
>>  package/coreutils/coreutils.mk | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/package/coreutils/coreutils.mk b/package/coreutils/coreutils.mk
>> index 2fb4a32c794f..7e7251ff7396 100644
>> --- a/package/coreutils/coreutils.mk
>> +++ b/package/coreutils/coreutils.mk
>> @@ -112,7 +112,7 @@ endif
>>  
>>  define COREUTILS_CLEANUP
>>  	# link for archaic shells
>> -	ln -fs test $(TARGET_DIR)/usr/bin/[
>> +	ln -fs coreutils $(TARGET_DIR)/usr/bin/[
>>  	# gnu thinks chroot is in bin, debian thinks it's in sbin
>>  	rm -f $(TARGET_DIR)/usr/bin/chroot
>>  	ln -sf ../bin/coreutils $(TARGET_DIR)/usr/sbin/chroot

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -



More information about the buildroot mailing list