From: Nobuyoshi Nakada Date: 2010-07-11T09:39:34+09:00 Subject: [ruby-core:31180] Re: [Bug #3556] FileUtils.mkdir_p fails trying to create C: under Windows Hi, At Sun, 11 Jul 2010 05:20:01 +0900, Luis Lavena wrote in [ruby-core:31177]: > Further investigation pointed that the rescue of > SystemCallError in mkdir_p is evaluating for File.directory? > of dir, when dir has actually been altered inside fu_mkdir: > > path = path.sub(%r, '') > > But this change, been made in a local variable, is not seen by mkdir_p. This substitution is wrong on Windows. > So: > > 1) mkdir_p sends "C:/" to fu_mkdir > 2) fu_mkdir trims it to "C:" > 3) fu_mkdir invokes Dir.mkdir "C:" and Errno::EEXIST is raised > 4) mkdir_p catches it but evaluates File.directory? for "C:/" instead of "C:" > 5) mkdir_p re-raises the exception since File.directory?("C:/") == false > > If I'm not missing something, that is wrong. Note that C:/ and C: don't refere same directory. The latter is C:., the cwd of C: drive. At Sun, 11 Jul 2010 08:05:18 +0900, Luis Lavena wrote in [ruby-core:31179]: > The root of the issue is a broken VirtualStore folder, used > by File redirection service under x64 OS. That means that File.stat on VirtualStore folders isn't working. It seems like a bug. -- Nobu Nakada