Project

General

Profile

Actions

Bug #7940

closed

Mistaken use of inline rescues in stdlib

Added by Mon_Ouie (Mon ouïe) almost 12 years ago. Updated about 11 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux]
Backport:
[ruby-core:52813]

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(start_position + matched_so_far, IO::SEEK_SET) rescue Errno::ESPIPE

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


Files

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

Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #7688: Error hiding with rb_rescue() on Comparable#==, #coerce and othersClosedEregon (Benoit Daloze)Actions

Updated by drbrain (Eric Hodel) almost 12 years ago

  • Assignee set to xibbar (Takeyuki FUJIOKA)
  • Priority changed from 3 to Normal
  • Target version set to 2.1.0

Updated by drbrain (Eric Hodel) almost 12 years ago

  • Status changed from Open to Assigned

Updated by xibbar (Takeyuki FUJIOKA) over 11 years ago

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

May I commit with lib/scanf.rb ?

Updated by naruse (Yui NARUSE) over 11 years 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.

Updated by xibbar (Takeyuki FUJIOKA) over 11 years ago

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

Actions #6

Updated by xibbar (Takeyuki FUJIOKA) over 11 years 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]

Updated by xibbar (Takeyuki FUJIOKA) over 11 years ago

  • Status changed from Closed to Assigned
  • Assignee changed from xibbar (Takeyuki FUJIOKA) to dblack (David Black)

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

Updated by xibbar (Takeyuki FUJIOKA) over 11 years ago

  • % Done changed from 100 to 50

Updated by Eregon (Benoit Daloze) over 11 years ago

Related issue for the C counterpart: #7688.

Updated by zzak (zzak _) over 11 years ago

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

He has been inactive for a long time, though.

Updated by Anonymous about 11 years ago

Bump.

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

Actions #12

Updated by nobu (Nobuyoshi Nakada) about 11 years 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 [ruby-core:52813]. [Bug #7940]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0