Tiny Core Base > TCB Bugs
useBusybox function causes syntax error in GUI terminal
GNUser:
Hi Rich. I can confirm that if I change the useBusybox function in /etc/init.d/tc-functions from this:
--- Code: ---useBusybox(){
. /etc/init.d/busybox-aliases
}
--- End code ---
to this:
--- Code: ---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 '
}
--- End code ---
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.
GNUser:
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?
Rich:
Hi GNUser
--- Quote from: GNUser on March 28, 2023, 08:38:13 AM --- ... P.S. aliasing sudo to sudo seems bizarre, ...
--- End quote ---
Agreed. It is not present in TCL10's /etc/init.d/busybox-aliases either.
Rich:
Hi GNUser
I had an idea I'd like to get feedback on.
Remove /e tc/init.d/busybox-aliases.
Change useBusybox to:
--- Code: ---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
}
--- End code ---
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:
--- Code: ---alias mount="busybox mount"
alias mount="busybox mount"
--- End code ---
In TC4 everything was provide by busybox. After that, some commands
were provided by busybox.suid , including those 2.
curaga:
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.
Navigation
[0] Message Index
[*] Previous page
Go to full version