~ubuntu-branches/ubuntu/raring/ruby1.9.1/raring-security

« back to all changes in this revision

Viewing changes to lib/tempfile.rb

  • Committer: Package Import Robot
  • Author(s): Antonio Terceiro, Lucas Nussbaum, Daigo Moriwaki, James Healy, Antonio Terceiro
  • Date: 2012-06-02 07:42:28 UTC
  • mfrom: (21.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20120602074228-09t2jgg1ozrsnnfo
Tags: 1.9.3.194-1
[ Lucas Nussbaum ]
* Add hurd-path-max.diff. Fixes FTBFS on Hurd. (Closes: #648055)

[ Daigo Moriwaki ]
* Removed debian/patches/debian/patches/sparc-continuations.diff,
  which the upstream has applied.
* debian/rules:
  - Bumped up tcltk_ver to 8.5.
  - Used chrpath for tcltklib.so to fix a lintian error,
    binary-or-shlib-defines-rpath.
* debian/control:
  - Suggests ruby-switch. (Closes: #654312)
  - Build-Depends: chrpath.
* debian/libruby1.9.1.symbols: Added a new symbol for
  rb_str_modify_expand@Base.
* debian/run-test-suites.bash:
  - Corrected options for test-all.
  - Enabled timeout to allow hang tests to be aborted.

[ James Healy ]
* New upstream release: 1.9.3p194 (Closes: #669582)
  + This release includes a fix for CVE-2011-0188 (Closes: #628451)
  + This release also does not segfault when running the test suite under
    amd64 (Closes: #674347)
* Enable hardened build flags (Closes: #667964)
* debian/control:
  - depend on specific version on coreutils
  - update policy version (no changes)

[ Antonio Terceiro ]
* debian/ruby1.9.1.postinst:
  + bump alternatives priority for `ruby` to 51 so that Ruby 1.9 has a
    higher priority than Ruby 1.8 (50).
  + bump alternatives priority for `gem` to 181 so that the Rubygems
    provided by Ruby 1.9 has priority over the one provided by the rubygems
    package.
* debian/control: added myself to Uploaders:
* debian/libruby1.9.1.symbols: update with new symbols added in 1.9.3p194
  upstream release.
* debian/manpages/*: fix references to command names with s/1.9/1.9.1/
* debian/rules: skip running DRB tests, since they seem to make the build
  hang. This should close #647296, but let's way and see. Also, with this do
  not need to timeout the test suite anymore.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#
2
2
# tempfile - manipulates temporary files
3
3
#
4
 
# $Id: tempfile.rb 33089 2011-08-26 23:54:49Z drbrain $
 
4
# $Id: tempfile.rb 34572 2012-02-12 07:54:28Z knu $
5
5
#
6
6
 
7
7
require 'delegate'
162
162
  end
163
163
 
164
164
  def _close    # :nodoc:
165
 
    @tmpfile.close if @tmpfile
166
 
    @tmpfile = nil
167
 
    @data[1] = nil if @data
 
165
    begin
 
166
      @tmpfile.close if @tmpfile
 
167
    ensure
 
168
      @tmpfile = nil
 
169
      @data[1] = nil if @data
 
170
    end
168
171
  end
169
172
  protected :_close
170
173
 
224
227
  #                    # to do so again.
225
228
  #   end
226
229
  def unlink
227
 
    # keep this order for thread safeness
228
230
    return unless @tmpname
229
231
    begin
230
 
      if File.exist?(@tmpname)
231
 
        File.unlink(@tmpname)
232
 
      end
233
 
      # remove tmpname from remover
234
 
      @data[0] = @data[2] = nil
235
 
      @tmpname = nil
 
232
      File.unlink(@tmpname)
 
233
    rescue Errno::ENOENT
236
234
    rescue Errno::EACCES
237
235
      # may not be able to unlink on Windows; just ignore
 
236
      return
238
237
    end
 
238
    # remove tmpname from remover
 
239
    @data[0] = @data[1] = nil
 
240
    @tmpname = nil
239
241
  end
240
242
  alias delete unlink
241
243
 
267
269
    end
268
270
 
269
271
    def call(*args)
270
 
      if @pid == $$
271
 
        path, tmpfile = *@data
272
 
 
273
 
        STDERR.print "removing ", path, "..." if $DEBUG
274
 
 
275
 
        tmpfile.close if tmpfile
276
 
 
277
 
        # keep this order for thread safeness
278
 
        if path
279
 
          File.unlink(path) if File.exist?(path)
 
272
      return if @pid != $$
 
273
 
 
274
      path, tmpfile = *@data
 
275
 
 
276
      STDERR.print "removing ", path, "..." if $DEBUG
 
277
 
 
278
      tmpfile.close if tmpfile
 
279
 
 
280
      if path
 
281
        begin
 
282
          File.unlink(path)
 
283
        rescue Errno::ENOENT
280
284
        end
281
 
 
282
 
        STDERR.print "done\n" if $DEBUG
283
285
      end
 
286
 
 
287
      STDERR.print "done\n" if $DEBUG
284
288
    end
285
289
  end
286
290
  # :startdoc: