From: Matthew Boeh Date: 2008-07-19T10:04:37+09:00 Subject: [ruby-core:17849] Re: FAILURE of "expand_path" --32u276st3Jlj2kUU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jul 19, 2008 at 08:58:42AM +0900, C.E. Thornton wrote: > Matthew, >=20 > Well something is inconsistent somewhere. >=20 > However, the reason this came up was I > wrote a class to perform a tree scan. It recursively > stepped through to directory tree. It failed when > it ran across a directory that had a number of directories > prefixed with a tilde '~'.=20 >=20 > When you have a dir containing this > dir1: > ~dira ~dirb ~dirc >=20 > Then you list the 'files' in a dir and > then recursively call expand_path on each > dir you find and agin list the files-- > this failure stops the scan. Why are you calling File.expand_path on these? The two uses of expand_path = I'm=20 familiar with are to expand ~ and to resolve .. and ., neither of which see= m=20 to apply in this case. > I want to make it consistent with the way the > Bash Shell works. >=20 > mkdir ~dir1 produces "./~dir" NOT "/home/dir" Only if there's no user named ~dir1.=20 > Am I wrong here? No, but your patch removes the ~user -> /home/user behavior. A better fix t= o=20 match the Bourne shell behavior would be to get rid of the "user %s doesn't= =20 exist" exception entirely and leave the string unchanged. --=20 Matthew Boeh --32u276st3Jlj2kUU 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) iD8DBQFIgT7Yfi+i1R7d/ZwRAnRnAJ9bsdHBWbIE6y7CrX27kwPV460J6QCdFjHC LzpzZSVwq+058sKWI1gKDBc= =A3ZS -----END PGP SIGNATURE----- --32u276st3Jlj2kUU--