Bug #7940

Mistaken use of inline rescues in stdlib

Added by Mon ouïe about 1 year ago. Updated 4 months ago.

[ruby-core:52813]
Status:Closed
Priority:Normal
Assignee:David Black
Category:lib
Target version:2.1.0
ruby -v:ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux] Backport:

Description

Hey,

There are two uses of inline rescues in stdlib that look dubious. They are unlikely to ever cause any harm, but still. They've been there for a while now, and are still in trunk. I attached a patch that changes both of them.

In cgi/session.rb:

  def delete
    File::unlink @path+".lock" rescue nil
    File::unlink @path+".new" rescue nil
    File::unlink @path rescue Errno::ENOENT
  end

The rescue part should be on the next line (this has been introduced in a commit that changed indentation).

In scanf.rb:660:

seek(startposition + matchedsofar, IO::SEEKSET) rescue Errno::ESPIPE

was more likely meant to just silence Errno::ESPIPE exceptions.

inline_rescue.patch Magnifier (929 Bytes) Mon ouïe, 02/24/2013 09:22 PM


Related issues

Related to ruby-trunk - Feature #7688: Error hiding with rb_rescue() on Comparable#==, #coerce a... Open 01/12/2013

Associated revisions

Revision 40367
Added by Takeyuki FUJIOKA 12 months ago

  • lib/cgi/session.rb: update rescue in delete session file only Errno::ENOENT.[Bug #7940]

Revision 44196
Added by Nobuyoshi Nakada 4 months ago

scanf.rb: fix rescue modifier

  • lib/scanf.rb (IO#scanf): fix mistaken use of rescue modifier. a patch by Mon_Ouie at . [Bug #7940]

History

#1 Updated by Eric Hodel about 1 year ago

  • Assignee set to Takeyuki FUJIOKA
  • Priority changed from Low to Normal
  • Target version set to 2.1.0

#2 Updated by Eric Hodel about 1 year ago

  • Status changed from Open to Assigned

#3 Updated by Takeyuki FUJIOKA 12 months ago

I am maintainer of cgi* but not maintainer of lib/scanf.rb

May I commit with lib/scanf.rb ?

#4 Updated by Yui NARUSE 12 months ago

xibbar (Takeyuki FUJIOKA) wrote:

I am maintainer of cgi* but not maintainer of lib/scanf.rb

May I commit with lib/scanf.rb ?

Commit your part and assign this to dblack.

#5 Updated by Takeyuki FUJIOKA 12 months ago

Sorry I was misunderstanding that lib/scanf.rb does not have a maintainer.

#6 Updated by Takeyuki FUJIOKA 12 months ago

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

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


  • lib/cgi/session.rb: update rescue in delete session file only Errno::ENOENT.[Bug #7940]

#7 Updated by Takeyuki FUJIOKA 12 months ago

  • Status changed from Closed to Assigned
  • Assignee changed from Takeyuki FUJIOKA to David Black

update only my part.
please consider your part > dblack.

#8 Updated by Takeyuki FUJIOKA 12 months ago

  • % Done changed from 100 to 50

#9 Updated by Benoit Daloze 12 months ago

Related issue for the C counterpart: #7688.

#10 Updated by Zachary Scott 12 months ago

I've tweeted @davidablack asking him to check this ticket.

He has been inactive for a long time, though.

#11 Updated by Charlie Somerville 7 months ago

Bump.

Should dblack be discharged under the 3 month rule? He has not been active for quite some time.

#12 Updated by Nobuyoshi Nakada 4 months ago

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

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


scanf.rb: fix rescue modifier

  • lib/scanf.rb (IO#scanf): fix mistaken use of rescue modifier. a patch by Mon_Ouie at . [Bug #7940]

Also available in: Atom PDF