[LLVMbugs] [Bug 8520] New: Win32/Path.inc: "NUL" is not regular file (clang -o NUL fails)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Nov 1 01:57:47 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=8520

           Summary: Win32/Path.inc: "NUL" is not regular file (clang -o
                    NUL fails)
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: System Library
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: geek4civic at gmail.com
                CC: llvmbugs at cs.uiuc.edu


C:\path\to> clang foo.c -S -o nul
error: unable to rename temporary 'nul-000000' to output file 'nul': 'Can't
move

      'nul-000000' to 'nul': Cannot create a file when that file already
exists.

'
1 error generated.
clang: error: unable to remove file:

===

It is due to sys::Path::isRegularFile().

My workaround is below. It seems there is no way to detect
reserved filenames ("nul", "con", &c) with Win32API.

--- a/lib/System/Win32/Path.inc
+++ b/lib/System/Win32/Path.inc
@@ -369,6 +369,9 @@ bool
 Path::isRegularFile() const {
   if (isDirectory())
     return false;
+  if (getBasename().size() == 3
+      && memcmp(getBasename().data(), "nul", 3) == 0)
+    return false;
   return true;
 }

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list