[Toybox] Shell error messages.

Rob Landley rob at landley.net
Mon May 4 10:25:56 PDT 2020


In toysh I'm using normal perror_msg() which does strerr(errno), ala:

# walrus
sh: walrus: No such file or directory
# /usr
sh: /usr: Permission denied
# exit

But bash is doing:

$ walrus
bash: walrus: command not found
$ /usr
bash: /usr: Is a directory

On the one hand, this is libc's problem: "not found" is a MUCH better error
message than "no such file or directory or symlink or dev node or fifo or named
pipe or unix domain socket" and there IS an EISDIR that the kernel apparently
isn't returning for exec of a directory...?

Um, hello kernel? man 2 execve says it CAN return EISDIR... if ld.so is a directory:

       EISDIR An ELF interpreter was a directory.

But if the file you RAN was a directory, it gives EPERM. Great.

The problem with me trying to micromanage this and produce my own error messages
is 2/3 of the world speaks something other than english. The libc messages are
(potentially) translated where toybox is not. So I want to return the libc error
messages where I can, and restrict the english error message vocabulary to about
a dozen words when I can't. (Hence "bad" everything. Yes I'm aware the help text
kinda undermines that. Part of my todo item to wire up gzip to display
compressed help includes adding a way to substitute in different translated help
text through that input path, although I'm not sure I want to merge it into
toybox because that hole has no bottom. Still, if somebody ELSE wants to
maintain that...)

Anyway, thingy. Todo item.

Rob


More information about the Toybox mailing list