Package: libruby1.8
Version: 1.8.2-2
Severity: normal

Hello,

  in the attached script you can find a detailed description of what
  seems to be a bug in fileutils.rb. Namely, that FileUtils.mv(o, d)
  fails to remove 'o' after copying to 'd' if the files are in separate
  partitions.

  As noted in the script, two other Debian users have been able to
  reproduce, and another two non-Debian users failed to.

  Thanks.


-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable'), (101, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.10-1-686
Locale: LANG=es_ES.UTF-8, LC_CTYPE=es_ES.UTF-8 (charmap=UTF-8)

Versions of packages libruby1.8 depends on:
ii  libc6                       2.3.2.ds1-20 GNU C Library: Shared libraries an

-- no debconf information

-- 
Adeodato Simó
    EM: asp16 [ykwim] alu.ua.es | PK: DA6AE621
    Listening to: Presuntos Implicados - La mujer que mueve el mundo
 
Proper treatment will cure a cold in seven days, but left to itself, a
cold will hang on for a week.
                -- Darrell Huff
#! /usr/bin/ruby -w

#
# This Ruby program tries to check whether FileUtils.mv does
# successfully remove the original file when moving across different
# partitions. If your system has separate partitions for /tmp and /home,
# it should work out of the box for you.
#
# Reproducible by me and two other people in #ruby-lang, who were both
# Debian users. Other people, using other distros, failed to reproduce.
#
# -- Adeodato Simà <[EMAIL PROTECTED]>, 2005-02-16

require 'fileutils'

from = '/tmp/RUBYBUG'
to = File.join(ENV['HOME'], 'RUBYBUG')

# Create the original file
File.open(from, 'w') {}

begin
  # Try File.rename first to catch EXDEV
  File.rename(from, to)
rescue Errno::EXDEV
  puts "OK, files in different partitions, trying FileUtils.mv"
  FileUtils.mv(from, to)

  ### Now try to open 'from', to see if it was successfully removed or
  ### not. Note that if it wasn't removed, the above FileUtils.mv call
  ### seems to return nil instad of 0.
  begin
    File.open(from, 'r') { |d| puts "BUG!, '#{from}' exists" }
  rescue Errno::ENOENT
    puts "OK, '#{from}' was successfully removed by FileUtils.mv"
  end
else
  puts "/tmp and #{to} are not in separate partitions, can't check"
end

Reply via email to