[LLVMbugs] [Bug 22512] New: Rewriter::overwriteChangedFiles() probably fail when target's driver differs with system tempolary dir
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sun Feb 8 19:12:22 PST 2015
http://llvm.org/bugs/show_bug.cgi?id=22512
Bug ID: 22512
Summary: Rewriter::overwriteChangedFiles() probably fail when
target's driver differs with system tempolary dir
Product: clang
Version: 3.3
Hardware: PC
OS: Windows XP
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: colinx.xu at huawei.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
As title mentioned, when I try calling Rewriter::overwriteChangedFiles, clang
reports a WINDOWS error 1224 - The requested operation cannot be performed on a
file with
a user-mapped section open (maybe 20 errors in 100 sample files). after some
debuging and analysing, I found that my target file locates in driver E, while
system tempolary directory locates in driver C. clang save all changes first in
a middle file in tempolary dir, then replace the target file via
llvm::sys::fs::rename(), this causes fail! If the source and target file
locates in the same driver, rename will always be successful and my problem be
solved.
append a few code as below:
~AtomicallyMovedFile() {
......
if (llvm::error_code ec = llvm::sys::fs::rename(TempFilename.str(),
Filename)) {
// rename fail, try the other way :
// 1. move src to the same driver of target
// 2. rename to target
SmallString<128> TmpInSameDriver = Filename;
TmpInSameDriver += "_tmp";
llvm::error_code ec2 = llvm::sys::fs::rename(TempFilename.str(),
TmpInSameDriver.str());
ec2 = llvm::sys::fs::rename(TmpInSameDriver.str(), Filename);
if (!ec2) return;
......
}
}
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150209/2c9795cd/attachment.html>
More information about the llvm-bugs
mailing list