<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">> it is about reading a file just after it is written<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Reading a file right after it is written is probably one of the most common operations during a build process and it is done successfully by many tools on hundreds of thousands of files. It is odd that only vtkWrapPython runs into problems.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Is it possible that the .cxx file that cannot be created (<a href="https://public.kitware.com/pipermail/vtk-developers/2018-September/036360.html">https://public.kitware.com/pipermail/vtk-developers/2018-September/036360.html</a>) existed
 before and has just been recently deleted? That would explain the problem you are having.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">“The DeleteFile function marks a file for deletion on close. Therefore, the file deletion does not occur until the last handle to the file is closed. Subsequent calls to CreateFile to open the file fail with ERROR_ACCESS_DENIED.” (<a href="https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-deletefilea">https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-deletefilea</a>)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">If anti-virus software has any influence on the build process then most likely then there is some fragile mechanisms in place and the problem likely would occur with any other software that monitors the file system. You cannot possibly
 identify and disable all these software.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Andras<span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Andrew Maclean <andrew.amaclean@gmail.com>
<br>
<b>Sent:</b> Wednesday, September 26, 2018 7:34 AM<br>
<b>To:</b> Brad King <brad.king@kitware.com><br>
<b>Cc:</b> David Gobbi <david.gobbi@gmail.com>; Andras Lasso <lasso@queensu.ca>; VTK Developers <vtk-developers@vtk.org><br>
<b>Subject:</b> Re: [vtk-developers] Python Wrapping fails in master build.<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Thanks for this, I'll see if I can exclude this directory and I'll try it out tomorrow. <o:p></o:p></p>
<div>
<p class="MsoNormal">Andrew Maclean<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Wed, 26 Sep. 2018, 21:29 Brad King, <<a href="mailto:brad.king@kitware.com">brad.king@kitware.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">On 09/26/2018 12:22 AM, David Gobbi wrote:<br>
> Brad, have there been any new discoveries about why compiler tests<br>
> and custom-command outputs fail to open their output files on Windows<br>
> as described in [cmake issue 12957]?<br>
<br>
That failure was due to not being able to remove or replace the<br>
`.exe` files used for the checks, and it was almost always due to<br>
an antivirus tool locking the files.  That's why the fix was to<br>
just use a different `.exe` name each time.  Even without an AV<br>
tool, NTFS does not have synchronous delete operations.  We could<br>
work around that by renaming a file out of the way before deleting<br>
it, but so far the existing workaround has been sufficient (and the<br>
renaming could also race with AV locks).<br>
<br>
Using a different name isn't an option here, but also this one looks<br>
a bit different because it is about reading a file just after it is<br>
written.  Likely the antivirus tool is monitoring all filesystem<br>
operations and opens the file just after creation in order to scan<br>
it.  Since the purpose of the check is to avoid letting viruses run<br>
the AV tool likely opens the file without any sharing permissions.<br>
<br>
This kind of AV operation is mostly invisible for humans creating<br>
and reading files, but causes headaches for build systems and other<br>
use cases that do rapid creation and use of files.  I think the best<br>
solution is to just exclude one's development directories from the<br>
AV configuration.<br>
<br>
-Brad<o:p></o:p></p>
</blockquote>
</div>
</div>
</body>
</html>