Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current selection does not change to newly created dir, if current working directory path contains a symlink #1767

Closed
9 tasks done
7ocb opened this issue Nov 20, 2023 · 2 comments · Fixed by #1770
Closed
9 tasks done
Labels

Comments

@7ocb
Copy link

7ocb commented Nov 20, 2023

Environment details (Put x in the checkbox along with the information)

  • Operating System:

    ❯ uname -a
    Linux elkbook 6.5.9-arch2-1 #1 SMP PREEMPT_DYNAMIC Thu, 26 Oct 2023 00:52:20 +0000 x86_64 GNU/Linux
    
  • Desktop Environment: xmonad

  • Terminal Emulator: xterm

  • Shell:

    ❯ zsh --version
    zsh 5.9 (x86_64-pc-linux-gnu
    
  • Custom desktop opener (if applicable):

  • Program options used: none

  • Configuration options set: default

  • Plugins are installed: None

  • Issue exists on nnn master

Exact steps to reproduce the issue

Preparation:

Test directory structure:

test-structure/dir
test-structure/outer
test-structure/outer/dir # symlink to "test-structure/dir"

script to spawn:

#!/bin/sh

mkdir test-structure
mkdir test-structure/{dir,outer}
ln -s ../dir test-structure/outer

Reproducing:

  1. Start nnn
  2. Cd to test-structure/dir
  3. Create directories aaa and ccc - note each time directory is created, nnn shifts selection so cursor points to newly created entry - this working as expected.
  4. Cd to test-structure/outer/dir
  5. Create directory bbb - note that selection is not changed and cursor stays on same entry, new entry appears after some delay. Expected: as in 3: newly created item expected to be selected after creation.

Debugging notes:

It seems to me that the problem is that in tmp = get_cwd_entry(path, tmp, &len); ( file nnn.c line 7857 ), in get_cwd_entry in this case cwdpath will contain "symlinked" path (i.e. path via symlink) while entrypath will contain absolute (real) path to the entry being created. Because of this in this case entrypath is not considered as subpath of cwdpath.

@7ocb 7ocb added the bug label Nov 20, 2023
@jarun
Copy link
Owner

jarun commented Nov 21, 2023

Please raise a PR.

@7ocb
Copy link
Author

7ocb commented Nov 21, 2023

#1770

@N-R-K N-R-K linked a pull request Nov 22, 2023 that will close this issue
@github-actions github-actions bot locked and limited conversation to collaborators Dec 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants