Issue #3399 has been updated by nahi.

Description updated
Assignee set to nobu


----------------------------------------
Feature #3399: UNC path is not handled properly
https://bugs.ruby-lang.org/issues/3399#change-24719

Author: jojelino
Status: Open
Priority: Low
Assignee: nobu
Category: core
Target version: 2.0.0


=begin
 (gdb)
 0x62d4a4f1      2835        BUFINIT();
 (gdb) print s
 $5 = 0xc7dfa0 "//?/D:/ruby2/lib/ruby/site_ruby/1.9.1"
 this is from rbconfig.rb
   CONFIG = {}
   CONFIG["DESTDIR"] = DESTDIR
   CONFIG["MAJOR"] = "1"
   CONFIG["MINOR"] = "9"
   CONFIG["TEENY"] = "1"
   CONFIG["PATCHLEVEL"] = "-1"
   CONFIG["INSTALL"] = '/usr/bin/ginstall -c'
   CONFIG["EXEEXT"] = ".exe"
   CONFIG["prefix"] = (TOPDIR || DESTDIR + "d:/ruby2")
   CONFIG["ruby_install_name"] = "ruby"
   CONFIG["RUBY_INSTALL_NAME"] = "ruby"
   CONFIG["RUBY_SO_NAME"] = "msvcrt-ruby191"
   CONFIG["PACKAGE"] = "ruby"
   CONFIG["BUILTIN_TRANSSRCS"] = " newline.c"
   CONFIG["MANTYPE"] = "doc"
   CONFIG["NROFF"] = "/usr/bin/nroff"
   CONFIG["vendorhdrdir"] = "$(rubyhdrdir)/vendor_ruby"
   CONFIG["sitehdrdir"] = "$(rubyhdrdir)/site_ruby"
   CONFIG["rubyhdrdir"] = "$(includedir)/$(RUBY_BASE_NAME)-$(ruby_version)"
   CONFIG["UNIVERSAL_INTS"] = ""
   CONFIG["UNIVERSAL_ARCHNAMES"] = ""
   CONFIG["configure_args"] = " 'optflags=-mno-cygwin -O4' '--enable-load-relative' '--target=i686-pc-mingw32' '--prefix=/usr/mingw' '--disable-install-doc' 'target_alias=i686-pc-mingw32'"
   CONFIG["vendordir"] = "$(rubylibprefix)/vendor_ruby"
   CONFIG["sitedir"] = "$(rubylibprefix)/site_ruby"
   CONFIG["ruby_version"] = "1.9.1"
   CONFIG["sitearch"] = "i386-msvcrt"
   CONFIG["arch"] = "i386-mingw32"
   CONFIG["RI_BASE_NAME"] = "ri"
   CONFIG["ridir"] = "$(datarootdir)/$(RI_BASE_NAME)"
   CONFIG["rubylibprefix"] = "$(libdir)/$(RUBY_BASE_NAME)"
   CONFIG["MAKEFILES"] = "Makefile GNUmakefile"
   CONFIG["THREAD_MODEL"] = "win32"
   CONFIG["EXPORT_PREFIX"] = " "
   CONFIG["COMMON_HEADERS"] = "winsock2.h windows.h"
   CONFIG["COMMON_MACROS"] = ""
   CONFIG["COMMON_LIBS"] = "m"
   CONFIG["MAINLIBS"] = ""
   CONFIG["ENABLE_SHARED"] = "yes"
   CONFIG["DLDLIBS"] = ""
   CONFIG["SOLIBS"] = "$(LIBS)"
   CONFIG["LIBRUBYARG_SHARED"] = "-l$(RUBY_SO_NAME)"
   CONFIG["LIBRUBYARG_STATIC"] = "-l$(RUBY_SO_NAME)-static"
   CONFIG["LIBRUBYARG"] = "$(LIBRUBYARG_SHARED)"
   CONFIG["LIBRUBY"] = "lib$(RUBY_SO_NAME).dll.a"
   CONFIG["LIBRUBY_ALIASES"] = ""
   CONFIG["LIBRUBY_SO"] = "$(RUBY_SO_NAME).dll"
   CONFIG["LIBRUBY_A"] = "lib$(RUBY_SO_NAME)-static.a"
   CONFIG["RUBYW_INSTALL_NAME"] = "$(RUBYW_BASE_NAME)"
   CONFIG["rubyw_install_name"] = "$(RUBYW_INSTALL_NAME)"
   CONFIG["LIBRUBY_DLDFLAGS"] = " -mno-cygwin -Wl,--enable-auto-image-base,--enable-auto-import -Wl,--out-implib=$(LIBRUBY) $(RUBYDEF)"
   CONFIG["LIBRUBY_LDSHARED"] = "$(CC) -mno-cygwin -shared $(if $(filter-out -g -g0,$(debugflags)),,-g3)"
   CONFIG["warnflags"] = "-Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long"
   CONFIG["debugflags"] = "-g"
   CONFIG["optflags"] = "-mno-cygwin -O4"
   CONFIG["cxxflags"] = " $(optflags) $(debugflags) $(warnflags)"
   CONFIG["cflags"] = " $(optflags) $(debugflags) $(warnflags)"
   CONFIG["cppflags"] = ""
   CONFIG["INSTALLDOC"] = "nodoc"
   CONFIG["RDOCTARGET"] = "nodoc"
   CONFIG["EXECUTABLE_EXTS"] = ".exe .com .cmd .bat"
   CONFIG["ARCHFILE"] = ""
   CONFIG["EXTOUT"] = ".ext"
   CONFIG["PREP"] = "miniruby$(EXEEXT)"
   CONFIG["TEST_RUNNABLE"] = "yes"
   CONFIG["setup"] = "Setup"
   CONFIG["EXTSTATIC"] = ""
   CONFIG["STRIP"] = "strip"
   CONFIG["TRY_LINK"] = ""
   CONFIG["LIBPATHENV"] = ""
   CONFIG["RPATHFLAG"] = ""
   CONFIG["LIBPATHFLAG"] = " -L%s"
   CONFIG["LINK_SO"] = ""
   CONFIG["LIBEXT"] = "a"
   CONFIG["DLEXT2"] = ""
   CONFIG["DLEXT"] = "so"
   CONFIG["LDSHAREDXX"] = "$(CXX) -mno-cygwin -shared $(if $(filter-out -g -g0,$(debugflags)),,-g3)"
   CONFIG["LDSHARED"] = "$(CC) -mno-cygwin -shared $(if $(filter-out -g -g0,$(debugflags)),,-g3)"
   CONFIG["CCDLFLAGS"] = " -mno-cygwin "
   CONFIG["STATIC"] = ""
   CONFIG["ARCH_FLAG"] = ""
   CONFIG["DLDFLAGS"] = " -mno-cygwin  -Wl,--enable-auto-image-base,--enable-auto-import $(DEFFILE)"
   CONFIG["ALLOCA"] = ""
   CONFIG["CHDIR"] = "cd -P"
   CONFIG["RMALL"] = "rm -fr"
   CONFIG["RMDIRS"] = "rmdir -p"
   CONFIG["CP"] = "cp"
   CONFIG["RM"] = "rm -f"
   CONFIG["CAPITARGET"] = "nodoc"
   CONFIG["DOXYGEN"] = "doxygen"
   CONFIG["DOT"] = ""
   CONFIG["MAKEDIRS"] = "/usr/bin/mkdir -p"
   CONFIG["MKDIR_P"] = "/usr/bin/mkdir -p"
   CONFIG["INSTALL_DATA"] = "$(INSTALL) -m 644"
   CONFIG["INSTALL_SCRIPT"] = "$(INSTALL)"
   CONFIG["INSTALL_PROGRAM"] = "$(INSTALL)"
   CONFIG["SET_MAKE"] = ""
   CONFIG["LN_S"] = "ln -s"
   CONFIG["DLLWRAP"] = "dllwrap"
   CONFIG["WINDRES"] = "windres"
   CONFIG["NM"] = "nm"
   CONFIG["OBJCOPY"] = ":"
   CONFIG["OBJDUMP"] = "objdump"
   CONFIG["ASFLAGS"] = ""
   CONFIG["AS"] = "as"
   CONFIG["AR"] = "ar"
   CONFIG["RANLIB"] = "ranlib"
   CONFIG["try_header"] = ""
   CONFIG["COUTFLAG"] = "-o "
   CONFIG["OUTFLAG"] = "-o "
   CONFIG["CPPOUTFILE"] = "-o conftest.i"
   CONFIG["GNU_LD"] = "yes"
   CONFIG["GCC"] = "yes"
   CONFIG["EGREP"] = "/usr/bin/grep -E"
   CONFIG["GREP"] = "/usr/bin/grep"
   CONFIG["CPP"] = "$(CC) -E"
   CONFIG["CXXFLAGS"] = "$(cxxflags)"
   CONFIG["CXX"] = "g++"
   CONFIG["OBJEXT"] = "o"
   CONFIG["CPPFLAGS"] = " $(DEFS) $(cppflags)"
   CONFIG["LDFLAGS"] = "-L. -mno-cygwin "
   CONFIG["CFLAGS"] = "$(cflags)"
   CONFIG["CC"] = "gcc"
   CONFIG["target_os"] = "mingw32"
   CONFIG["target_vendor"] = "pc"
   CONFIG["target_cpu"] = "i386"
   CONFIG["target"] = "i386-pc-mingw32"
   CONFIG["host_os"] = "cygwin"
   CONFIG["host_vendor"] = "pc"
   CONFIG["host_cpu"] = "i686"
   CONFIG["host"] = "i686-pc-cygwin"
   CONFIG["build_os"] = "cygwin"
   CONFIG["build_vendor"] = "pc"
   CONFIG["build_cpu"] = "i686"
   CONFIG["build"] = "i686-pc-cygwin"
   CONFIG["RUBYW_BASE_NAME"] = "rubyw"
   CONFIG["RUBY_BASE_NAME"] = "ruby"
   CONFIG["RUBY_RELEASE_DATE"] = "2010-06-05"
   CONFIG["RUBY_PROGRAM_VERSION"] = "1.9.3"
   CONFIG["BASERUBY"] = "ruby"
   CONFIG["target_alias"] = "i386-pc-mingw32"
   CONFIG["host_alias"] = ""
   CONFIG["build_alias"] = ""
   CONFIG["LIBS"] = " -mno-cygwin -lshell32 -lws2_32 -limagehlp "
   CONFIG["ECHO_T"] = ""
   CONFIG["ECHO_N"] = "-n"
   CONFIG["ECHO_C"] = ""
   CONFIG["DEFS"] = ""
   CONFIG["mandir"] = "$(datarootdir)/man"
   CONFIG["localedir"] = "$(datarootdir)/locale"
   CONFIG["libdir"] = "$(exec_prefix)/lib"
   CONFIG["psdir"] = "$(docdir)"
   CONFIG["pdfdir"] = "$(docdir)"
   CONFIG["dvidir"] = "$(docdir)"
   CONFIG["htmldir"] = "$(docdir)"
   CONFIG["infodir"] = "$(datarootdir)/info"
   CONFIG["docdir"] = "$(datarootdir)/doc/$(PACKAGE)"
   CONFIG["oldincludedir"] = "/usr/include"
   CONFIG["includedir"] = "$(prefix)/include"
   CONFIG["localstatedir"] = "$(prefix)/var"
   CONFIG["sharedstatedir"] = "$(prefix)/com"
   CONFIG["sysconfdir"] = "$(prefix)/etc"
   CONFIG["datadir"] = "$(datarootdir)"
   CONFIG["datarootdir"] = "$(prefix)/share"
   CONFIG["libexecdir"] = "$(exec_prefix)/libexec"
   CONFIG["sbindir"] = "$(exec_prefix)/sbin"
   CONFIG["bindir"] = "$(exec_prefix)/bin"
   CONFIG["exec_prefix"] = "$(prefix)"
   CONFIG["PACKAGE_URL"] = ""
   CONFIG["PACKAGE_BUGREPORT"] = ""
   CONFIG["PACKAGE_STRING"] = ""
   CONFIG["PACKAGE_VERSION"] = ""
   CONFIG["PACKAGE_TARNAME"] = ""
   CONFIG["PACKAGE_NAME"] = ""
   CONFIG["PATH_SEPARATOR"] = ":"
   CONFIG["SHELL"] = "/bin/sh"
   CONFIG["rubylibdir"] = "$(rubylibprefix)/$(ruby_version)"
   CONFIG["archdir"] = "$(rubylibdir)/$(arch)"
   CONFIG["sitelibdir"] = "$(sitedir)/$(ruby_version)"
   CONFIG["sitearchdir"] = "$(sitelibdir)/$(sitearch)"
   CONFIG["vendorlibdir"] = "$(vendordir)/$(ruby_version)"
   CONFIG["vendorarchdir"] = "$(vendorlibdir)/$(sitearch)"
   CONFIG["topdir"] = File.dirname(__FILE__)
 
 i use gdb(cygwin) to debug ruby, cygwin thinks  unc path \\?\ is appended to debugee path. but this could have been eliminated or leaved as it is. i suspeced that ruby thinks it as regular path and substitutes \ to /. the result is total disaster. it is clear that every corresponding native win32 api fails because there is no //?/ unc path.
 (gdb)
 0x62d4a4f1      2835        BUFINIT();
 (gdb) print s
 $5 = 0xc7dfa0 "//?/D:/ruby2/lib/ruby/site_ruby/1.9.1"
 3072            HANDLE h = FindFirstFile(skipprefix(b), &wfd);
 1: $eax = 0x0
 (gdb) print b
 $5 = 0xc7ec78 "//?/D:/ruby2/lib/ruby/site_ruby/1.9.1"
=end



-- 
http://bugs.ruby-lang.org/