Feature #5153

Remove rb_add_suffix

Added by Yui NARUSE over 3 years ago. Updated over 3 years ago.

[ruby-core:38736]
Status:Closed
Priority:Normal
Assignee:-

Description

rb_add_suffix in util.c is GPL and obsoleted code, so I want to remove it.

rb_add_suffix is drived from Perl's win32.c file and GPL/Artistic License.
The code is used when ruby runs with -i (inplace option).
Practically it works only when the renamed file can't create.
(the validation is also a function of the code, but it is not essential)

But this behavior is Windows specific.
On other environment, ruby simply skip the file with a warning "Can't rename %s to %s: %s, skipping file".
I think Windows should follow this.

Associated revisions

Revision 32826
Added by Usaku NAKAMURA over 3 years ago

  • util.c, include/ruby/util.h (ruby_add_suffix): remove the function.
    [Bug #5153]

  • io.c (argf_next_argv): remove the call of above function.

  • ext/-test-/add_suffix, test/-ext-/test_add_suffix.rb: remove the test
    extension module because this is only for testsing ruby_add_suffix().

  • LEGAL: remove the mention about a part of util.c, because now we
    removed the part.

  • io.c (argf_next_argv): now the new filename is not guranteed to
    use, so should check the return value of rename(2).

  • test/ruby/test_argf.rb (TestArgf#test_inplace_rename_impossible):
    now we expect same result with other platforms on no_safe_rename
    platforms (=Windows).

Revision 32826
Added by Usaku NAKAMURA over 3 years ago

  • util.c, include/ruby/util.h (ruby_add_suffix): remove the function.
    [Bug #5153]

  • io.c (argf_next_argv): remove the call of above function.

  • ext/-test-/add_suffix, test/-ext-/test_add_suffix.rb: remove the test
    extension module because this is only for testsing ruby_add_suffix().

  • LEGAL: remove the mention about a part of util.c, because now we
    removed the part.

  • io.c (argf_next_argv): now the new filename is not guranteed to
    use, so should check the return value of rename(2).

  • test/ruby/test_argf.rb (TestArgf#test_inplace_rename_impossible):
    now we expect same result with other platforms on no_safe_rename
    platforms (=Windows).

History

#1 Updated by Usaku NAKAMURA over 3 years ago

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

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


  • util.c, include/ruby/util.h (ruby_add_suffix): remove the function.
    [Bug #5153]

  • io.c (argf_next_argv): remove the call of above function.

  • ext/-test-/add_suffix, test/-ext-/test_add_suffix.rb: remove the test
    extension module because this is only for testsing ruby_add_suffix().

  • LEGAL: remove the mention about a part of util.c, because now we
    removed the part.

  • io.c (argf_next_argv): now the new filename is not guranteed to
    use, so should check the return value of rename(2).

  • test/ruby/test_argf.rb (TestArgf#test_inplace_rename_impossible):
    now we expect same result with other platforms on no_safe_rename
    platforms (=Windows).

Also available in: Atom PDF