-
Notifications
You must be signed in to change notification settings - Fork 327
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
File size displayed incorrectly after copy #1417
Comments
I did some investigation, it looks like the random size comes from the I was able to trigger the same problem by copying a single file that was very large (10G). The sequence of events looks like this:
This seems to be an extension of the problem where the file size doesn't update when writing to an already existing file (e.g. try running the commands |
If I understand this correctly, the core of the issue is located here: https://github.com/gokcehan/lf/blob/master/nav.go#L517 There seem to be quite a few issues are related to this as well, like #1172 #776 #1226 Any changes to files that do not trigger an updated mtime stat will be ignored until a manual reload, which is most noticeable when using the period option, but also affect issues like this one. There are some cases where executing "reload" at certain functions would work but ideally any changes to files that were done outside of lf would also be updated. The question is how this can be done efficiently. Other file managers may already have a solution that could also work for lf. |
Would it be easily possible to use ctime instead of mtime to trigger the update in the checkDir function? If so, I think that would solve all of these issues |
That line of code you pointed out is indeed where the mtime check happens, but anyway the main problem is that writing to a file does not modify the containing directory. Checking the ctime of the directory won't help in this case either. I guess it would be possible to fix this by introducing some kind of |
You are right and changing the check to ctime will probably not fix this issue, but I am pretty sure many of the related/linked issues would be solved, leaving us with a more simple solution for this one like a single forced check after copy operations. edit: Maybe anyone can tell how other file managers do this? |
I tried with I had a very quick look at the code, it looks like the copy operation does a hard refresh of the directory when it finishes: https://github.com/ranger/ranger/blob/136416c7e2ecc27315fe2354ecadfe09202df7dd/ranger/core/loader.py#L146-L147 Though I have never really worked with |
When copying multiple large files to a different directory, lf incorrectly lists the file size of the last copied file.
Using the option "set period 1" for autorefresh
When copying file a and b (both 500MB) to a new directory, lf will first show file a with a random size between 0 and 500.
When multiple lf instance are showing the same target directory, the listed sizes even differ between lf instances.
After file a has finished copying, it is correctly displayed with the correct size, however after file b has finished copying, the correct size is not show and instead a random file size value is listed.
This can probably be fixed by refreshing the file stats after the copy job has finished.
The text was updated successfully, but these errors were encountered: