From: alice > Sent: 13 February 2023 09:24 .... > > The 'test/[' command is almost certainly a shell builtin. > > The program in /usr/bin is almost never executed. > > when one is using busybox ash as a shell, is /usr/bin/test (from busybox > symlink) and "builtin test" not the same code in the end (same for [)? i.e. > this case, which is probably using busybox ash (needs confirmation).
On my busbox system [ is a shell builtin and /usr/bin/[ a program. Both just call stat(filename) for test -r filename. I don't get a fail for a non-readable directory (but can only run as root). Plausibly there is some hackery involved, but putting programs like 'ash' into busybox probably requires linking them to a .o and then making most of the symbols static and renaming 'main'. So it is difficult to share the code for 'test' unless is is all moved out into a common library. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales) _______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox