-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Paolo Bonzini on 1/29/2008 7:19 AM: |> | I didn't know source used the path. Actually I thought the contrary... |> |> . has always used PATH; but in older shells, it also implicitly tacked . |> onto its path search. Since this was a security hole for trojan files, |> POSIX forbids implicit `.'. Thus, the only safe way to source a file in |> the current directory is with anchored notation, since you can't rely on |> `.' being in the user's PATH. | | Uhm, I have: | | bonzinip$ echo echo foo > bar | bonzinip$ . bar | foo | | And . is not in the PATH: | | bonzinip$ chmod +x bar | bonzinip$ bar | -bash: bar: command not found | | Then I try within scripts and behavior is the same: | | bonzinip$ echo . bar > baz | bonzinip$ chmod +x baz | bonzinip$ sh --version | GNU bash, version 2.05b.0(1)-release (powerpc-apple-darwin8.0) | bonzinip$ ./baz | foo | bonzinip$ POSIXLY_CORRECT=1 sh baz | foo | | Even with bash 3.2: | | bonzinip$ /sw/bin/bash --version | GNU bash, version 3.2.9(1)-release (powerpc-apple-darwin8.10.0) | Copyright (C) 2005 Free Software Foundation, Inc. | bonzinip$ /sw/bin/bash baz | foo | bonzinip$ POSIXLY_CORRECT=1 /sw/bin/bash baz | foo | | /me is confused...
Hmm. Bash explicitly documents that it behaves differently depending on whether it is in POSIX mode - from bash-3.2/POSIX: ~ 28. The `.' and `source' builtins do not search the current directory ~ for the filename argument if it is not found by searching `PATH'. It looks like we've discovered a bash bug. - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHnzjH84KuGfSFAYARAiEUAJ9daSG5G7xXlPGyW0i88zu02zznqwCfdOMP nKPxBGFPgh33k14nVZT8Kbg= =KoSc -----END PGP SIGNATURE-----