UNC path issues with PROBE-FILE & ENSURE-DIRECTORIES-EXIST

Bug #492053 reported by Matthew Swank on 2009-12-03
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Medium
Unassigned

Bug Description

I try to load a system located on a Windows server using a UNC path. I have write permissions to the resource, and it works if I used a mapped drive instead.
Here's an example:
> sbcl.exe --no-sysinit --no-userinit
This is SBCL 1.0.33.2, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.

This is experimental prerelease support for the Windows platform: use
at your own risk. "Your Kitten of Death awaits!"
* (require :asdf)

("ASDF")
* (push "//server/share/" asdf:*central-registry*)

("//server/share/" (MERGE-PATHNAMES ".sbcl/systems/" (USER-HOMEDIR-PATHNAME))
 (LET ((ASDF::HOME (POSIX-GETENV "SBCL_HOME")))
   (WHEN (AND ASDF::HOME (NOT (STRING= ASDF::HOME "")))
     (MERGE-PATHNAMES "site-systems/" (TRUENAME ASDF::HOME))))
 *DEFAULT-PATHNAME-DEFAULTS*)
* (require :test)

debugger invoked on a SIMPLE-ERROR:

Win32 Error [CreateDirectoryW@8] - 123
The filename, directory name, or volume label syntax is incorrect.

Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [TRY-RECOMPILING] Try recompiling test
  1: [RETRY ] Retry performing #<ASDF:COMPILE-OP NIL {241C4801}> on
                       #<ASDF:CL-SOURCE-FILE "test" {240E7841}>.
  2: [ACCEPT ] Continue, treating #<ASDF:COMPILE-OP NIL {241C4801}> on
                       #<ASDF:CL-SOURCE-FILE "test" {240E7841}> as having been
                       successful.
  3: [ABORT ] Exit debugger, returning to top level.

(SB-UNIX:UNIX-MKDIR "\\\\server\\" #<unavailable argument>)
0]

 test.asd:
(asdf:defsystem :test
  :version "0"
  :description ""
  :maintainer " <user@domain>"
  :author " <user@domain>"
  :licence ""
  :components ((:file "test"))
  ;; :long-description ""
  )

test.lisp:
(cl:in-package :cl-user)
(defun foo () 'bar)

 tag os-win32

Can you provide a deeper backtrace? I'm guessing the issue is someone calling ENSURE-DIRECTORIES-EXIST and it failing to do the right thing.

Nikodemus Siivola (nikodemus) wrote :

 tag os-windows -os-win32

Download full text (6.4 KiB)

I was able to reproduce this bug, and obtained a backtrace and a description of the pathname object in question.

Digging further, I see that ensure-directories-exist ignores the result of mkdir for some reason, but that's not the real issue... There's something weird with PROBE-FILE and UNC-filespec directories.

My session transcript follows:

Z:\sbcl-git-two>src\runtime\sbcl.exe --core output\sbcl.core
This is SBCL 1.0.32.38, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.

This is experimental prerelease support for the Windows platform: use
at your own risk. "Your Kitten of Death awaits!"
* (require :asdf)

("ASDF")
* (push "//vboxsvr//virtualbox-host/lisp-winapi/" asdf:*central-registry*)

("//vboxsvr//virtualbox-host/lisp-winapi/"
 (MERGE-PATHNAMES ".sbcl/systems/" (USER-HOMEDIR-PATHNAME))
 (LET ((ASDF::HOME (POSIX-GETENV "SBCL_HOME")))
   (WHEN (AND ASDF::HOME (NOT (STRING= ASDF::HOME "")))
     (MERGE-PATHNAMES "site-systems/" (TRUENAME ASDF::HOME))))
 *DEFAULT-PATHNAME-DEFAULTS*)
* (require :lisp-winapi)

debugger invoked on a SIMPLE-ERROR:

Win32 Error [CreateDirectoryW@8] - 123
The filename, directory name, or volume label syntax is incorrect.

Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [TRY-RECOMPILING] Try recompiling winapi-package
  1: [RETRY ] Retry performing #<ASDF:COMPILE-OP NIL {241BC8F9}> on
                       #<ASDF:CL-SOURCE-FILE "winapi-package" {240DD2F9}>.
  2: [ACCEPT ] Continue, treating #<ASDF:COMPILE-OP NIL {241BC8F9}> on
                       #<ASDF:CL-SOURCE-FILE "winapi-package" {240DD2F9}> as
                       having been successful.
  3: [ABORT ] Exit debugger, returning to top level.

(SB-UNIX:UNIX-MKDIR "\\\\vboxsvr\\" #<unavailable argument>)
0] back

0: (SB-UNIX:UNIX-MKDIR "\\\\vboxsvr\\" #<unavailable argument>)
1: (ENSURE-DIRECTORIES-EXIST
    #P"\\\\vboxsvr\\virtualbox-host\\lisp-winapi\\winapi-package.fasl")[:EXTERNAL]
2: (SB-IMPL::%MAP-FOR-EFFECT-ARITY-1
    #<FUNCTION ENSURE-DIRECTORIES-EXIST>
    (#P"\\\\vboxsvr\\virtualbox-host\\lisp-winapi\\winapi-package.fasl"))
3: ((SB-PCL::FAST-METHOD ASDF:PERFORM :BEFORE
     (ASDF:COMPILE-OP ASDF:SOURCE-FILE))
    #<unavailable argument>
    #<unavailable argument>
    #<ASDF:COMPILE-OP NIL {241BC8F9}>
    #<ASDF:CL-SOURCE-FILE "winapi-package" {240DD2F9}>)
4: ((LAMBDA
        (SB-PCL::.PV. SB-PCL::.NEXT-METHOD-CALL. SB-PCL::.ARG0.
         SB-PCL::.ARG1.))
    #<unavailable argument>
    #<unavailable argument>
    #<ASDF:COMPILE-OP NIL {241BC8F9}>
    #<ASDF:CL-SOURCE-FILE "winapi-package" {240DD2F9}>)
5: ((SB-PCL::FAST-METHOD ASDF:PERFORM ASDF:AROUND
     (ASDF:COMPILE-OP ASDF:CL-SOURCE-FILE))
    #<unavailable argument>
    #S(SB-PCL::FAST-METHOD-CALL
       :FUNCTION #<CLOSURE # {242502F5}>
       :PV NIL
       :NEXT-METHOD-CALL NIL
  ...

Read more...

Nikodemus Siivola (nikodemus) wrote :

So, does UNIX-STAT work on network shares at all?

There's a comment in MAP-DIRECTORY that makes me think it/PROBE-FILE should work:

         ;; Not QUERY-FILE-SYSTEM :EXISTENCE, since it doesn't work on Windows
         ;; network shares.

but maybe I was confused and tested using a mapped drive instead. If so, PROBE-FILE needs Moar Windows Magic.

Changed in sbcl:
status: New → Confirmed
importance: Undecided → Medium
summary: - Sbcl errors loading an asdf system on a UNC path in win32
+ UNC path issues with PROBE-FILE & ENSURE-DIRECTORIES-EXIST

After a brief conversation on IRC today, I went hunting through MSDN and found the GetFileAttributes() function, which led to the following session transcript, and lends hope to the idea of closing this bug in the foreseeable future (though I'll be letting someone else do the actual work):

This is SBCL 0.9.12, an implementation of ANSI Common Lisp.

More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.

It is mostly in the public domain; some portions are provided under

BSD-style licenses. See the CREDITS and COPYING files in the

distribution for more information.

os_map: 3, 0x1000, 02000000, 0x1000.

os_map: 3, 0x2000, 05000000, 0x1000.

os_map: 3, 0x3000, 09000000, 0x15bc000.

This is experimental prerelease support for the Windows platform: use

at your own risk. "Your Kitten of Death awaits!"

* (load-shared-object "KERNEL32")

#P"KERNEL32"

* (define-alien-routine "GetFileAttributesA" (unsigned 32) (path c-string))

GETFILEATTRIBUTESA

* (getfileattributesa "c://windows")

16

* (getfileattributesa "c://")

22

* (getfileattributesa "//miyu/noshare")

4294967295

* (getfileattributesa "//miyu/share")

16

*

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers