Skip to content

Win32/Path.inc: "NUL" is not regular file (clang -o NUL fails) #8892

@llvmbot

Description

@llvmbot
Bugzilla Link 8520
Resolution FIXED
Resolved on Aug 21, 2011 09:06
Version trunk
OS Windows XP
Blocks llvm/llvm-bugzilla-archive#9099
Reporter LLVM Bugzilla Contributor
CC @AaronBallman

Extended Description

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;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzilla

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions