[Toybox] FreeBSD porting, removing bashisms
Ed Maste
emaste at freebsd.org
Tue Mar 29 16:38:37 PDT 2016
On 29 March 2016 at 23:01, Rob Landley <rob at landley.net> wrote:
>
> There's also a bunch of Linux Standard Base headers #included from
> toys.h, which bsd may not have. (Most bsds have a linux emulation layer
> these days, but I don't know how that works in with building stuff
> natively...)
Yes, it's not used (or available) for native builds -- the syscalls
and ioctls aren't available in that case. The Linux emulation layer
would be used when running an unmodified Linux toybox binary. I'm
happy enough to just avoid building the Linux-specific tools for now.
> I've intentionally kept bashisms in the scripts because toybox's
> built-in shell (toysh, currently just a stub) is intended to provide a
> "reasonable bash replacement". (About the same level of bash extensions
> beyond posix that our that sed or ls implementations have beyond posix.)
In that case, having a small bash equivalent sounds good to me. What
do you think about changing #!/bin/bash to #!/usr/bin/env bash then?
diff --git a/scripts/make.sh b/scripts/make.sh
index d3dc8eb..d09cac0 100755
--- a/scripts/make.sh
+++ b/scripts/make.sh
@@ -1,1 +1,1 @@
-#!/bin/bash
+#!/usr/bin/env bash
Another error shows up in a few spots due to conflicts between a
couple of toybox functions and libc:
./lib/lib.h:204:7: error: conflicting types for 'strnstr'
char *strnstr(char *line, char *str);
./lib/lib.h:289:7: error: conflicting types for 'basename_r'
char *basename_r(char *name);
1459294717.0
More information about the Toybox
mailing list