<p>Sigh.<br>
<code>PATH_MAX</code> is not our only problem here. <code>PATH_MAX</code> is actually 260, in case this wasn't known already before. In <code>src/win32.c</code> we also use the constant <code>MAX_PATH</code> which seems to be 260 as well.</p>
<p>But even with more than 260 (tried to trick 1024 into <code>get_path_max()</code>) doesn't help as it seems the <code>realpath()</code> in <code>src/tagmanager/tm_sourcefile.c</code> is broken for such paths. Maybe because we use <code>GetFullPathNameA()</code> here and do not pass properly encoded filenames. But this is just a guess.<br>
What I know so far after a little debugging is that <code>realpath()</code> returns an empty string for such filenames and those empty strings are compared with each other, hence only the first such file is opened because at the second file Geany things the file with the realpath <code>""</code> is already opened.</p>
<p>The comment on the <code>realpath()</code> function states it was just taken from a bug report. And the comment sounds a bit like as if I wrote it years ago :). Maybe nowadays there are better, more reliable ways to get a unique filename on Windows?</p>
<p>I won't debug this issue further for now as preparing the release is more important and fixing this issue takes probably more time than we have before the release.<br>
Anyway, any ideas are welcome!</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/geany/geany/issues/1534#issuecomment-314531324">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABDrJwxRPSgivtLfUnHGUhU0JGYWA5-Zks5sM75MgaJpZM4OPMx0">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ABDrJ8gcpTQCPrRoNJay18cC-DSiTZB-ks5sM75MgaJpZM4OPMx0.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/geany/geany/issues/1534#issuecomment-314531324"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/geany/geany","title":"geany/geany","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/geany/geany"}},"updates":{"snippets":[{"icon":"PERSON","message":"@eht16 in #1534: Sigh.\r\n`PATH_MAX` is not our only problem here. `PATH_MAX` is actually 260, in case this wasn't known already before. In `src/win32.c` we also use the constant `MAX_PATH` which seems to be 260 as well.\r\n\r\nBut even with more than 260 (tried to trick 1024 into `get_path_max()`) doesn't help as it seems the `realpath()` in `src/tagmanager/tm_sourcefile.c` is broken for such paths. Maybe because we use `GetFullPathNameA()` here and do not pass properly encoded filenames. But this is just a guess.\r\nWhat I know so far after a little debugging is that `realpath()` returns an empty string for such filenames and those empty strings are compared with each other, hence only the first such file is opened because at the second file Geany things the file with the realpath `\"\"` is already opened.\r\n\r\nThe comment on the `realpath()` function states it was just taken from a bug report. And the comment sounds a bit like as if I wrote it years ago :). Maybe nowadays there are better, more reliable ways to get a unique filename on Windows?\r\n\r\nI won't debug this issue further for now as preparing the release is more important and fixing this issue takes probably more time than we have before the release.\r\nAnyway, any ideas are welcome!"}],"action":{"name":"View Issue","url":"https://github.com/geany/geany/issues/1534#issuecomment-314531324"}}}</script>