This question is a follow-up from https://unix.stackexchange.com/questions/126955/percent-in-path-environment-variable. I post it here, since it is more distro-specific.
The shell used by default for sh namely dash, is not compatible with execvp because it fiddles with the $PATH variable. A standardized way of dealing with strange filenames is to use URL encoding scheme. Now I cannot use that standard because dash reserves %. To solve this I problem I have the following options
Recommend my users on Ubuntu to change the symbolic link /bin/sh to something else like bash. It is necessary to do it globally since popen(3) relies on /bin/sh.
Diverge from traditional URL encoding by using something other than %
Throw an error whenever any of the Forbidden characters (yes, Windows but these restriction is sane in a dual-boot configuration) appears.
Ideally I prefer option (1) seems the best way to go. It makes it possible to use a standardized escape scheme in filenames. However, since dash clearly behaves differently than some other shells, it will break the system if any of the system scripts rely on functionality unique to dash. Also it requires that the user has root privileges.
Option (2) implies that I have to find another symbol that does not collide anywhere. Certainly, some shell may screw up any symbol that is not a letter.
Option (3) implies too large reduction in functionality
%a%b%c
and copy it.bash
in your shebang line instead ofsh
. That would avoid all these problems altogether.