Tiny Core Linux
Tiny Core Base => TCB Bugs => Topic started by: cpoakes on September 10, 2013, 07:50:46 PM
-
Typing "mounted" at the (busybox ash) shell prompt hangs until Ctrl-C (SIGINT) in CorePlus 5.0rc1 and dCore 5.0rc2. Command "which" does not find any executable named mounted. Command "sudo find / -name mounted" returns nothing. Command "busybox mounted" is an error. There is no "builtin" or "help" to identify shell builtins, however "strings /bin/sh" (operating on link to busybox) shows only messages containing the word, but no bare word as with other builtin shell commands.
If you create a script named "mounted" and place it in the First directory of your PATH , the script will not execute. Executes if you specify a full pathname for the command. It is as if /bin/busybox ash is treating it as a builtin...
On dd-wrt (busybox ash), openwrt (busybox ash), Buffalo NAS (busybox ash) typing "mounted" gives the expected:
$ mounted
ash: mounted not found
What in the world is (not) happening?
-
mounted is an ash function in /etc/init.d/tc-functions
mounted /dev/sda1
returns 0 if /dev/sda1 is mounted, and 1 if it is not.
mounted /dev/sda1 && echo "yes" || echo "no"
if mounted $DEV ; then
echo "$DEV is mounted
else
echo "$DEV" is not mounted
fi
-
Thanks - this was driving me crazy. Had issued "set" to see what functions were defined in the shell, but apparently this is a bashism - no function definitions were reported. But I should've tried an "unset mounted" anyway. Anyone know how to get ash to report defined functions?
Removed the line sourcing tc-functions from my .ashrc - all is well.
Suggestion: /etc/init.d/tc-functions mounted() should quote the "$1" argument. Without the quotes, a null string causes grep to utilize "/etc/mtab" as the pattern on stdin - certainly not the intended action. Would also keep the command from appearing to hang while waiting for an end-of-file.