Hi,
  Your patch is much cleaner than mine, good job.

   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  
      cd ~test         (test is NOT a user name on my system)
          returns 'current_dir/~test'    <== Why should this produce an 
error?

  As my previous Example.  I have a directory as follows:

            hydra(Wpad02}$pwd;ls
            /home/thornton/WorkPads/Wpad02
            ATTIC  ~chuck  file_scan.rb  md5_compare.rb  ~test  tst.rb
            hydra(Wpad02}$

             'ATTIC'  '~chuck'  and  '~test'  are directories!

The result with either your change or mine with 'tst.rb'

            ruby 1.8.7 (2008-05-31 patchlevel 0) [x86_64-linux]
            Starting Directory = .
            Dir = /home/thornton/WorkPads/Wpad02/~test
            Dir = /home/thornton/WorkPads
            Dir = /home/thornton/WorkPads/Wpad02/ATTIC
            Dir = /home/thornton/WorkPads/Wpad02
            Dir = /home/chuck
            hydra(Wpad02}$


ATTIC and ~test are legitimate and should be processed.
~chuck is unreachable without quoting and this is correct
since there is a user named 'chuck'.

NOW, I myself would not consider applying ~name conversion
for any user accept the current user, but BASH does otherwise.

I am simply trying to align expand_path to the way linux (BASH)
processes these names.

I look forward to you response.   I am retired and generally work
late a night USA time, so you should be able to catch during your
day if we  are lucky.

 Chuck T.




  
> Hi,
>
> At Sun, 20 Jul 2008 05:52:07 +0900,
> C.E. Thornton wrote in [ruby-core:17865]:
>   
>>   I modified file.c to incorporated previous suggestions
>> and my mistaken interpretation of Bash Semantics.
>>     
>
> This is my patch, though still I'm not sure if it should ignore
> the failure of user name.
>
> 
> Index: file.c > =================================================================== > --- file.c (revision 18135) > +++ file.c (working copy) > @@ -2649,5 +2649,6 @@ file_expand_path(VALUE fname, VALUE dnam > if (!pwPtr) { > endpwent(); > - rb_raise(rb_eArgError, "user %s doesn't exist", buf); > + s = --b; > + goto relative; > } > dirlen = strlen(pwPtr->pw_dir); > @@ -2697,4 +2698,5 @@ file_expand_path(VALUE fname, VALUE dnam > #endif > else if (!is_absolute_path(s)) { > + relative: > if (!NIL_P(dname)) { > file_expand_path(dname, Qnil, result); >
> > -- Competency and chastity have much in common, they both encompass their own punishment! -- C.E. Thornton -- Hawthorne Press --