Tiny Core Linux
Tiny Core Base => TCB Bugs => Topic started by: GNUser on March 27, 2023, 10:46:29 AM
-
These commands cause no problems when run in a terminal in my router, which is CLI only (no X):
$ . /etc/init.d/tc-functions
$ useBusybox
$
Here are same commands on my laptop, in urxvt terminal emulator inside a GUI (Xorg) session:
$ . /etc/init.d/tc-functions
$ useBusybox
sh: /etc/init.d/busybox-aliases: line 85: syntax error: unexpected "("
Another oddity is that in the GUI session, "useBusybox" and all subsequent commands are in bold. It seems something in /etc/init.d/busybox-aliases is being interpreted as an escape sequence. Is this worth looking into and fixing?
P.S. Both machines are running TCL14-beta Pure x86_64
-
Hi GNUser
I just tried it under TCL14-alpha1 Pure x86_64 and got the same message
except it was line 21. I used aterm.tcz.
You don't need . /etc/init.d/tc-functions. It's already sourced in ~/.ashrc.
-
Hi GNUser
I just tried it under TCL14-alpha1 Pure x86_64 and got the same message
except it was line 21. I used aterm.tcz.
Hi Rich. It's unsightly, isn't it? I think it would be worth fixing.
You don't need . /etc/init.d/tc-functions. It's already sourced in ~/.ashrc.
Yep, I see it in there. Good to know. Thank you.
-
Hi GNUser
I get the same results on TCL14-alpha1 x86, TCL13 x86 and x86_64.
-
Hi GNUser
Turns out this happens on TC9 x86 and TC10 x86 too:
tc@E310:~$ . /etc/init.d/busybox-aliases
sh: /etc/init.d/busybox-aliases: line 21: syntax error: unexpected "("
tc@E310:~$ . /etc/init.d/tc-functions
tc@E310:~$
I suspect what's happening is the contents of busybox-aliases is being interpreted as
a command because it doesn't use alias anymore. In TC4 useBusybox looked like this:
useBusybox(){
alias ar="busybox ar"
alias awk="busybox awk"
alias cat="busybox cat"
alias clear="busybox clear"
alias cp="busybox cp"
alias cpio="busybox cpio"
alias dc="busybox dc"
alias df="busybox df"
alias du="busybox du"
alias depmod="busybox depmod"
alias expr="busybox expr"
alias fdisk="busybox fdisk"
alias fold="busybox fold"
alias grep="busybox grep"
alias gunzip="busybox gunzip"
alias hostname="busybox hostname"
alias kill="busybox kill"
alias killall="busybox killall"
alias ls="busybox ls"
alias md5sum="busybox md5sum"
alias mount="busybox mount"
alias sed="busybox sed"
alias sort="busybox sort"
alias swapoff="busybox swapoff"
alias sync="busybox sync"
alias tar="busybox tar"
alias umount="busybox umount"
alias wc="busybox wc"
alias wget="busybox wget"
alias sudo='sudo '
}
-
Hi Rich. I can confirm that if I change the useBusybox function in /etc/init.d/tc-functions from this:
useBusybox(){
. /etc/init.d/busybox-aliases
}
to this:
useBusybox(){
alias ar="busybox ar"
alias awk="busybox awk"
alias cat="busybox cat"
alias clear="busybox clear"
alias cp="busybox cp"
alias cpio="busybox cpio"
alias dc="busybox dc"
alias df="busybox df"
alias du="busybox du"
alias depmod="busybox depmod"
alias expr="busybox expr"
alias fdisk="busybox fdisk"
alias fold="busybox fold"
alias grep="busybox grep"
alias gunzip="busybox gunzip"
alias hostname="busybox hostname"
alias kill="busybox kill"
alias killall="busybox killall"
alias ls="busybox ls"
alias md5sum="busybox md5sum"
alias mount="busybox mount"
alias sed="busybox sed"
alias sort="busybox sort"
alias swapoff="busybox swapoff"
alias sync="busybox sync"
alias tar="busybox tar"
alias umount="busybox umount"
alias wc="busybox wc"
alias wget="busybox wget"
alias sudo='sudo '
}
then typing useBusybox in a terminal emulator inside a GUI session works as intended, without any syntax errors.
Maybe the TC4-style useBusybox function should make a comeback? If so, /etc/init.d/busybox-aliases becomes superfluous and can be removed from base system.
-
Hi Rich. There are scenarios where a user might want to call useBusybox from a GUI terminal emulator, so I think this should be fixed.
I went ahead and created a pull request on GitHub to go back to the old approach where useBusybox creates actual aliases. I made sure to include cut and ps among the aliases :)
P.S. aliasing sudo to sudo seems bizarre, so I took it out. Besides, it is not present in TCL13 and TCL14-beta's /etc/init.d/busybox-aliases. It can be put back in if someone wants/needs it for some obscure reason. Maybe there used to be some hard-to-alter places where a space was missing between sudo and the command that followed it?
-
Hi GNUser
... P.S. aliasing sudo to sudo seems bizarre, ...
Agreed. It is not present in TCL10's /etc/init.d/busybox-aliases either.
-
Hi GNUser
I had an idea I'd like to get feedback on.
Remove /e tc/init.d/busybox-aliases.
Change useBusybox to:
useBusybox(){
if [ ! -f /e tc/init.d/busybox-aliases ]
then
for Command in $(busybox --list)
do
case $Command in
xyzzy|plugh) # Commands that should never be aliased go here.
continue
;;
*)
echo "alias $Command=\"busybox $Command\"" >> /e tc/init.d/busybox-aliases
;;
esac
done
for Command in $(busybox.suid --list)
do
case $Command in
xyzzy|plugh) # Commands that should never be aliased go here.
continue
;;
*)
echo "alias $Command=\"busybox.suid $Command\"" >> /e tc/init.d/busybox-aliases
;;
esac
done
fi
. /e tc/init.d/busybox-aliases
}
Sorry, the full path for busybox-aliases was causing the Forum Error
message so I had to change /etc/ to /e tc/.
The first time useBusybox gets called, it creates /e tc/init.d/busybox-aliases
and then sources it. After that it only sources it when it gets called.
This way if commands get added or removed, /e tc/init.d/busybox-aliases will
always match busyboxes configuration.
By the way, these 2 won't work:
alias mount="busybox mount"
alias mount="busybox mount"
In TC4 everything was provide by busybox. After that, some commands
were provided by busybox.suid , including those 2.
-
An alias does cause some overhead, so creating one for every command wouldn't be desirable. The aliases are specifically for those commands called from core scripts that might break when GNU/other tools are installed, due to differing args or missing deps.