-
Notifications
You must be signed in to change notification settings - Fork 328
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
Very serious - Folders being displayed as empty after being renamed #914
Comments
Read about the |
If you do the "How to reproduce" steps in lf instead of an external file manager, it behaves correctly – i.e. the folderA does not appear empty. So there is no bug. |
Indeed, the period option should give the expected behaviour. It is very weird that it is not defaulted to 1, I noticed someone just a few days ago with the same issue, this is clearly a usability problem that goes against what's usually expected of a file manager. I've noticed that dolphin does the same thing at times, which also sucks. Regarding the bug, that's a classic "It works for me!" mate. Here's a gif so I can more clearly explain myself. What's worse is that not even the period option at 1 does anything to solve this. |
The motivation for zero Can you show your |
hmm, I mean I'm all for performance, but the main goal of a file manager is to display the files that currently exist in a folder. If it fails at that for whatever reason, it's unfortunately failing it's main goal. It's 2022, we have crappy fully responsive apps written in freaking JS but we can't have a responsive file manager in the terminal? It don't think such a basic thing would be considered "performance bloat". As for the lfrc, here it is, nothing special really.
|
Hmm, now for me the caching issue sometimes happens and sometimes it doesn't... |
"Good" to know. There's definitely something devious going on under the surface mate! |
Can you try chaining commands for this action?
|
I had the same issues, also if I created new directories or files in them via a self built command in lfrc. DusanLesans comment helped out, after chaining my commands with reload evereything works as expected. (set period ... did not help). EDIT: no, does not help always, happens randomly. |
This is caused by the
The problem is that when deleting a directory, the corresponding entry is not deleted from the cache. This is the code that performs the delete: This means that when another directory is renamed to the path of the deleted directory, it will load the stale entry from the cache, causing it to be displayed incorrectly. Setting the It looks like deleting the stale entry immediately doesn't work, since --- a/nav.go
+++ b/nav.go
@@ -1426,6 +1426,7 @@ func (nav *nav) rename() error {
return err
}
+ delete(nav.dirCache, newPath)
dir := nav.loadDir(filepath.Dir(newPath))
if dir.loading { In the meantime, you can also disable directory caching by adding |
No, please don't do this! If you set "nodircache" lf does not remember what you selected the last time and deletes (if you delete) where you are on at the moment. I had this several times now and deleted things I did not want to delete. It seems like a mixture of bug and sluttery (by myself) to me. |
@dase78 Do you have a minimal set of steps to reproduce this issue? I don't actually use |
@joelim-work Yes, I reproduced it now again: Could you also try, this seems serious? |
@dase78 I tried it just now with a config file containing nothing but 2023-02-10.22-44-26.mp4 |
BTW, this is the code that performs the actual delete. The first thing it does is call
If you want to get to the bottom of this, you can try adding some |
Oh, and also I am starting to think that this is a separate problem and a new issue should be created, rather than discussing it here. |
So I tried again several things, I think I know, what was happening: I could reproduce my failure but I guess it was, because I had set: I took out the "reload" and now everything works as expected with deleting files. [I don't know, should we report this?] Can you reproduce? |
@dase78 I tried this just now and can confirm that is the problem you're experiencing. The
When a directory is reloaded, the current file is initially reset to the first entry. However the original current file prior to the reload will be restored (via the
This is why the current file after a Adding |
I think it's also worth pointing out that this issue also occurs when you rename the original directory to something else instead of deleting it. The original example given was:
If you change the step |
Yes, I agree. And chaining |
Hi.
So, I've found a pretty serious bug that could easily lead to some data loss, as it'd led me had I not backups.
How ot reproduce:
Have two folders:
folderA - has files inside
folderB - is empty
delete folderB
rename folderA to folderB
now folderB (previsouyl folderA) will appear empty, even though it's not!
I'm guessing this is due to some sort of caching, but it's quite dangerous. Shouldn't the folders refresh every second or something like that?
Edit: Indeed, I just tested lf and dolphin opened side by side. If I create a file in lf, it shows up in dolphin after a second. If I do the same in dolphin, it doesn't show up in lf! This unfortunately makes lf unusable, tbh. If you need help in fixing this one, I can give a hand.
Edit2: I just tested with ranger, and it indeed reacts to a new created file in dolphin, as it should. Midnight Commander doesn't, but if you can refresh the folder with CTRL+R (which sucks btw)
The text was updated successfully, but these errors were encountered: