<p>While inspecting <a href="https://github.com/ohrrpgce/ohrrpgce/files/3537794/c_debug_archive_nezbid_dataloss.txt">c_debug_archive.txt</a> which nezbid sent me while investigating bug <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="484883650" data-permission-text="Issue title is private" data-url="https://github.com/ohrrpgce/ohrrpgce/issues/35" data-hovercard-type="issue" data-hovercard-url="/ohrrpgce/ohrrpgce/issues/35/hovercard" href="https://github.com/ohrrpgce/ohrrpgce/issues/35">#35</a>, I discovered a lot of errors like</p>
<pre><code>! 0 open files:
! ERROR: rename(C:\Users\apit\AppData\Roaming\OHRRPGCE\working0.tmp\\general.reld.tmp, C:\Users\apit\AppData\Roaming\OHRRPGCE\working0.tmp\\general.reld) failed: Permission denied
! showerror: user continued
! SerializeBin: could not rename C:\Users\apit\AppData\Roaming\OHRRPGCE\working0.tmp\\general.reld.tmp to C:\Users\apit\AppData\Roaming\OHRRPGCE\working0.tmp\\general.reld
</code></pre>
<p>Apparently <code>rename</code> on Windows fails with a <code>Permission denied</code> error if any program has the file open (the old file, being replaced, or the new one? I'm not sure which is the problem here). Doing some research, I found <a href="https://stackoverflow.com/questions/3764072/c-win32-how-to-wait-for-a-pending-delete-to-complete/" rel="nofollow">this stackoverflow discussion</a> about <strong>virus scanners and search indexers</strong> opening files after you write to them, which will delay attempts to delete it, randomly break programs that delete and recreate files, and, I believe, also break <code>rename</code>, though I didn't find anyone complaining about that.</p>
<p>Possible solutions to <code>rename</code> failing are:</p>
<ul>
<li>wait a little while and try again</li>
<li>fallback to a copy followed by a delete. Only the delete ought to fail if there's still a problem</li>
</ul>
<p>Marking this a blocker because it's serious and fixable.</p>
<p>This doesn't provide any explanation for why bug <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="484883650" data-permission-text="Issue title is private" data-url="https://github.com/ohrrpgce/ohrrpgce/issues/35" data-hovercard-type="issue" data-hovercard-url="/ohrrpgce/ohrrpgce/issues/35/hovercard" href="https://github.com/ohrrpgce/ohrrpgce/issues/35">#35</a> happens, so I filed it as a separate bug. I'm clueless about that one.</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/ohrrpgce/ohrrpgce/issues/36?email_source=notifications&email_token=AMWGWZUSR66EVUTSCNNGHZTQGH2KHA5CNFSM4IPH2SQ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HHGYF7A">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AMWGWZUENMJG2UEFGXPVVXTQGH2KHANCNFSM4IPH2SQQ">mute the thread</a>.<img src="https://github.com/notifications/beacon/AMWGWZU2WMSZ4SGEVAIX47LQGH2KHA5CNFSM4IPH2SQ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HHGYF7A.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/ohrrpgce/ohrrpgce/issues/36?email_source=notifications\u0026email_token=AMWGWZUSR66EVUTSCNNGHZTQGH2KHA5CNFSM4IPH2SQ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HHGYF7A",
"url": "https://github.com/ohrrpgce/ohrrpgce/issues/36?email_source=notifications\u0026email_token=AMWGWZUSR66EVUTSCNNGHZTQGH2KHA5CNFSM4IPH2SQ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HHGYF7A",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>