<p>Symlinks, directories, and the magical <code>..</code> entry have never played well together.<br>
However, tools usually are consistent in the interpretation of <code>..</code> in this context:<br>
Either it is the parent of the symlink folder, or the parent of the target folder.</p>
<p>In geany, however, it just causes strange and subtle errors, which is never a good thing.</p>
<p>Here's an example so I have things to talk about.<br>
Note that I write <code>~</code> only for succinctness.  Geany correctly uses only the fully expanded paths.</p>
<pre><code># Setup
~/test$ mkdir -p realdir/subdir
~/test$ ln -s realdir/subdir/ symlinksubdir
~/test$ echo "Some text" > realdir/existingfile.txt
~/test$ echo "Different words" > toplevelfile.txt
~/test$ cd realdir/subdir/

# Demonstrate behavior in plain folders
~/test/realdir/subdir$ ls ..
existingfile.txt  subdir
~/test/realdir/subdir$ geany ../newfile.txt  # (1) Opens a tab for a not-yet-existing file ~/test/realdir/newfile.txt
~/test/realdir/subdir$ geany ../existingfile.txt  # (2) Opens the existing file
~/test/realdir/subdir$ cd ../../symlinksubdir

# Demonstrate behavior in symlink folders
~/test/symlinksubdir$ ls ..  # The entry '..' points to '~/test/realdir', not '~/test'
existingfile.txt  subdir
~/test/symlinksubdir$ touch ../toplevelfile.txt  # Shell expansion sees '..' as pointing to '~/test', not '~/test/realdir'
~/test/symlinksubdir$ geany ../newfile.txt  # (3) Opens a tab for a not-yet-existing file ~/test/newfile.txt
~/test/symlinksubdir$ geany ../existingfile.txt  # (4) Fails when fetching file information (?), refuses to open a new tab.
~/test/symlinksubdir$ geany ../toplevelfile.txt  # (5) Opens a tab for a "not-yet-existing" file ~/test/toplevelfile.txt
</code></pre>
<p>Expected behavior, flavor "parent of symlink":</p>
<ul>
<li>Command 3 opens a tab for a not-yet-existing file <code>~/test/newfile.txt</code> (matches actual behavior)</li>
<li>Command 4 opens a tab for a not-yet-existing file <code>~/test/existingfile.txt</code> (differs)</li>
<li>Command 5 opens a tab for the already existing file <code>~/test/toplevelfile.txt</code> (differs)</li>
</ul>
<p>Expected behavior, flavor "parent of target dir":</p>
<ul>
<li>Command 3 opens a tab for a not-yet-existing file <code>~/test/realdir/newfile.txt</code> (differs)</li>
<li>Command 4 opens a tab for the already existing file <code>~/test/realdir/existingfile.txt</code> (differs)</li>
<li>Command 5 opens a tab for a not-yet-existing file <code>~/test/realdir/toplevelfile.txt</code> (differs)</li>
</ul>
<p>Expected behavior, flavor "avoid weirdness":</p>
<ul>
<li>Command 3 refuses to resolve <code>symlinksubdir/..</code> at all (differs)</li>
<li>Command 4 refuses to resolve <code>symlinksubdir/..</code> at all (matches actual behavior)</li>
<li>Command 5 refuses to resolve <code>symlinksubdir/..</code> at all (differs)</li>
</ul>
<p>Note that the cases 3 and 4 "only" cause confusion about where a file is or will end up.<br>
In case 5, a user might attempt to write something into a file (i.e., add to a TODO-style list),<br>
find it empty on the current machine, and save it – and thus, without any warning, overwrite the existing file.<br>
Data loss.  Sad panda.</p>
<p>I have no idea how the "Open File" dialog stuff relates to this.  The bugtracker apparently knows nothing like this.</p>
<p>If I were to touch the code that deals with the file name resolution and handling,<br>
which flavor would you prefer for a PR?  Parent-of-symlink or parent-of-target?</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/1567">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABDrJ-Ly1SAqMJNkbOanZI0GktQmlm4Qks5sTibAgaJpZM4OozKG">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ABDrJ0GrmKM_F2CkPfzRD7tMudoUuIB-ks5sTibAgaJpZM4OozKG.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/1567"></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":"DESCRIPTION","message":"Opening symlink-ish files (#1567)"}],"action":{"name":"View Issue","url":"https://github.com/geany/geany/issues/1567"}}}</script>