When the shell searches for a command name in the PATH and finds a shell script, POSIX specifies that it shall pass the command name as argv[0] and in the child shell script, $0 shall be set from argv[0] (POSIX Standard, section 3.9.1.1, line 779-784).
However, for an LSB shell, the system may implement either this behavior or $0 may be set to an absolute pathname of the shell script. [1]
When PATH is used to locate a file for the dot utility, and a matching file is on the PATH but is not readable, the behavior is undefined (unlike POSIX which apparently requires the shell to continue searching through the rest of the PATH, POSIX Standard, section 3.14.4, line 1493-1498).
[1] | For example, bash behaves in the following way:
When bash is executing an executable rather than a shell script, it seems to behave in the POSIX way. |