--17pEHd4RhPHOinZp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Jul 24, 2008 at 12:52:54AM +0900, Yukihiro Matsumoto wrote:
> Hi,
>=20
> In message "Re: [ruby-core:17874] Re: Expand_Path:  New Patch - Modified =
Processing"
>     on Mon, 21 Jul 2008 03:36:22 +0900, "C.E. Thornton" <admin@hawthorne-=
press.com> writes:
>=20
> |   It is not a failure of user name!
> |
> |   If the directory contains a dir named '~test', it is
> |a perfectly acceptable dir name.  As long as the 'name'
> |part of  '~name' is NOT a user name, it should be valid!
> |
> | Lets look at how BASH Processes these directories:
> |
> |      cd ~chuck     (A user name on my system)
> |          returns /home/chuck =20
> |      cd ~test         (test is NOT a user name on my system)
> |          returns 'current_dir/~test'    <=3D=3D Why should this produce=
 an error?
>=20
> Interestingly, zsh raises error for non-existing user name.
>=20
>   zsh% echo ~matz
>   /home/matz
>   zsh% echo ~foo
>   zsh: no such user or named directory: foo
>   zsh% echo /tmp/~foo
>   /tmp/~foo
>=20
> Hence I don't consider this behavior a bug.
>=20
> 							matz.
>=20

That's actually configurable:

% echo $SHELL
/bin/zsh
% /bin/zsh --version
zsh 4.3.4 (x86_64-unknown-linux-gnu)
% echo ~nothere
~nothere
% setopt badpattern nomatch
% echo ~nothere
zsh: no such user or named directory: nothere

I think part of the issue is that File.expand_path has at least two distinc=
t=20
uses.  One is to transform a relative path with . and .. into an absolute=
=20
path, and the other is to expand tildes. This could be solved in one of thr=
ee=20
ways: (1) adding another class method to File which only resolves relative=
=20
paths, (2) adding an argument to File.expand_path to skip the tilde expansi=
on,=20
or (3) to somehow allow tildes to be escaped. Z shell permits the last of=
=20
these, even with "badpattern nomatch" set:

% echo \~nothere
~nothere

--=20
Matthew Boeh

--17pEHd4RhPHOinZp
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD4DBQFIh2jyfi+i1R7d/ZwRAqnxAKCdwix7eVJyJjRGpGlPi62QWPvh3gCSAm3n
QfClQQbWuXNPaEgsSh+bFw==
=PWD1
-----END PGP SIGNATURE-----

--17pEHd4RhPHOinZp--

On Thu, Jul 24, 2008 at 12:52:54AM +0900, Yukihiro Matsumoto wrote:
> Hi,
>=20
> In message "Re: [ruby-core:17874] Re: Expand_Path:  New Patch - Modified =
Processing"
>     on Mon, 21 Jul 2008 03:36:22 +0900, "C.E. Thornton" <admin@hawthorne-=
press.com> writes:
>=20
> |   It is not a failure of user name!
> |
> |   If the directory contains a dir named '~test', it is
> |a perfectly acceptable dir name.  As long as the 'name'
> |part of  '~name' is NOT a user name, it should be valid!
> |
> | Lets look at how BASH Processes these directories:
> |
> |      cd ~chuck     (A user name on my system)
> |          returns /home/chuck =20
> |      cd ~test         (test is NOT a user name on my system)
> |          returns 'current_dir/~test'    <=3D=3D Why should this produce=
 an error?
>=20
> Interestingly, zsh raises error for non-existing user name.
>=20
>   zsh% echo ~matz
>   /home/matz
>   zsh% echo ~foo
>   zsh: no such user or named directory: foo
>   zsh% echo /tmp/~foo
>   /tmp/~foo
>=20
> Hence I don't consider this behavior a bug.
>=20
> 							matz.
>=20

That's actually configurable:

% echo $SHELL
/bin/zsh
% /bin/zsh --version
zsh 4.3.4 (x86_64-unknown-linux-gnu)
% echo ~nothere
~nothere
% setopt badpattern nomatch
% echo ~nothere
zsh: no such user or named directory: nothere

I think part of the issue is that File.expand_path has at least two distinc=
t=20
uses.  One is to transform a relative path with . and .. into an absolute=
=20
path, and the other is to expand tildes. This could be solved in one of thr=
ee=20
ways: (1) adding another class method to File which only resolves relative=
=20
paths, (2) adding an argument to File.expand_path to skip the tilde expansi=
on,=20
or (3) to somehow allow tildes to be escaped. Z shell permits the last of=
=20
these, even with "badpattern nomatch" set:

% echo \~nothere
~nothere

--=20
Matthew Boeh
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD4DBQFIh2jyfi+i1R7d/ZwRAqnxAKCdwix7eVJyJjRGpGlPi62QWPvh3gCSAm3n
QfClQQbWuXNPaEgsSh+bFw==
=PWD1
-----END PGP SIGNATURE-----