Bug #9002

Use simpler example for File#expand_path

Added by Prathamesh Sonpatki over 1 year ago. Updated over 1 year ago.

[ruby-core:57734]
Status:Closed
Priority:Normal
Assignee:Benoit Daloze
ruby -v:ruby 2.1.0dev (2013-07-20 trunk 42078) [x86_64-linux] Backport:1.9.3: UNKNOWN, 2.0.0: UNKNOWN

Description

Use simpler example for File#exapnd_path when start_directory path is given.

0001-Use-simpler-example-for-File-expand_path-with-dir_st.patch Magnifier (719 Bytes) Prathamesh Sonpatki, 10/09/2013 02:06 AM

0001-Use-simpler-example-for-File.expand_path.patch Magnifier (1.37 KB) Prathamesh Sonpatki, 10/19/2013 10:00 PM

Associated revisions

Revision 43386
Added by Benoit Daloze over 1 year ago

  • file.c (File#expand_path): [DOC] improve documentation of File#expand_path. Based on patch by Prathamesh Sonpatki. [Bug #9002]

Revision 43386
Added by Benoit Daloze over 1 year ago

  • file.c (File#expand_path): [DOC] improve documentation of File#expand_path. Based on patch by Prathamesh Sonpatki. [Bug #9002]

History

#1 Updated by Benoit Daloze over 1 year ago

I don't know, the original example shows File.expand_path does resolve ".." and such.
Your example could be interpreted as File.expand_path being just File.join with reversed arguments.
On the other hand, ".." could be used just once in the example and probably still be clear (going to "/" does not make a lot of sense, one could just use "/bin" directly).

#2 Updated by Prathamesh Sonpatki over 1 year ago

Can we give both examples? I think the original example is a bit hard to understand due to two "..". In the first example we can show normal use and in second example, as you pointed out, how to resolve "..".
Eregon (Benoit Daloze) wrote:

I don't know, the original example shows File.expand_path does resolve ".." and such.
Your example could be interpreted as File.expand_path being just File.join with reversed arguments.
On the other hand, ".." could be used just once in the example and probably still be clear (going to "/" does not make a lot of sense, one could just use "/bin" directly).

#3 Updated by Zachary Scott over 1 year ago

  • Status changed from Open to Assigned

The original makes no sense to me, but I can see how it resolves ".." (... somehow).

I'm not even sure what the "/tmp/x" has to do with anything.

A patch to explain what's going on there would be nice, at least for my own sake :D

#4 Updated by Benoit Daloze over 1 year ago

cha1tanya (Prathamesh Sonpatki) wrote:

Can we give both examples? I think the original example is a bit hard to understand due to two "..". In the first example we can show normal use and in second example, as you pointed out, how to resolve "..".

Yes, that sounds good to me, could you update your patch?

(Sorry for the long delay to answer, I missed your response)

#5 Updated by Prathamesh Sonpatki over 1 year ago

Updated based on suggestions of @zzak and @Eregon. Please take a look

#6 Updated by Benoit Daloze over 1 year ago

  • Assignee changed from Zachary Scott to Benoit Daloze

This is better.
There is a typo "exapnd_path" and I would avoid references to your specific machine and Rails but use something more neutral. I will commit your patch with a couple changes.
Dir.pwd is also subject to change, so a static reference like FILE might be better.

Thank you for your contribution!

#7 Updated by Benoit Daloze over 1 year ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r43386.
Prathamesh, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • file.c (File#expand_path): [DOC] improve documentation of File#expand_path. Based on patch by Prathamesh Sonpatki. [Bug #9002]

#8 Updated by Prathamesh Sonpatki over 1 year ago

Thanks Benoit :)

Also available in: Atom PDF