Git Product home page Git Product logo

Comments (9)

joelim-work avatar joelim-work commented on September 16, 2024

This is probably related to #1426. Unlike newly created files/directories, extracted files/directories typically retain their original mtime from the archive, which undermines the reloading mechanism (checking for updated mtime values) in lf.

But I found a way to work around this using the watch option, by invalidating cache entries from remove/rename updates. Can you try #1756 to see if it works?

from lf.

valoq avatar valoq commented on September 16, 2024

Now the preview will always show the directory as empty instead.

  1. extract A.zip containing the directory A with 10 files inside.
  2. delete 5 of files inside A
  3. delete A
  4. extract A.zip again
  5. lf will show the directory A as empty even though there are 10 files inside and the previous version still had 5 files.

The dircounts shows the correct number of files in the new directory though.

from lf.

joelim-work avatar joelim-work commented on September 16, 2024

Oh I fixed a bug just now in 7292788, but I think you commented before I pushed it. Can you try again?

from lf.

valoq avatar valoq commented on September 16, 2024

Still the same issue. The newly extracted directory is shown as empty

from lf.

joelim-work avatar joelim-work commented on September 16, 2024

It was working for me, but I think there's maybe one or two times where the recreated directory doesn't load for some reason and shows up as failed. I guess maybe it's not consistent, but I can't figure out why though.

from lf.

valoq avatar valoq commented on September 16, 2024

I tested this again on a fresh install and for me the bug is always present.

Given a default lfrc file, the bug would not appear at all since there is no automatic file refresh, so the question may be related to how the directory is updated.

There are three possible ways to trigger the bug that I found so far:

  1. Use an extract* command that will make the newly created directory appear (with the outdated info)
  2. use the period option
  3. use the watch option

*Command I tested this with is as follows:

cmd extract ${{
    set -f
    atool -x $f
}}
map a extract

@joelim-work
Can you reproduce the bug with your default config and the mainline branch? If so, can you share your lfrc?

from lf.

joelim-work avatar joelim-work commented on September 16, 2024

It's not a problem with updating the directory contents, it's a problem with stale entries in the directory cache. An entry will only be replaced if the corresponding directory has a later mtime than its own, and this won't be the case for directories extracted from archives. This means that the original load and period mechanisms aren't useful here. But for watch updates, cache entries can be invalidated when a remove/rename notification is received.

Anyway I ended up merging that PR after a couple more changes - it's probably a good idea to disable the load command when watch is enabled, as they are essentially competing mechanisms and seem to cause weird issues when enabled together. So now this is working for me, and I can see the updated file list when re-extracting directories.

from lf.

valoq avatar valoq commented on September 16, 2024

This fixed the issue for when the watch option is used. Thank you.

Extracting an archive will still show the outdated directory with the default lf options, though there is also no default extract command either.
One workaround I found is to modify the extract command like this:

cmd extract ${{
    set -f
    atool -x $f
}}

map a : extract; reload

That could be added to the wiki in order to help users without automated file refresh avoid the issue as well.

from lf.

joelim-work avatar joelim-work commented on September 16, 2024

The "default lf options" you're referring to just simply uses the load command I mentioned earlier. It's an internal command sent after various operations (e.g. delete, paste) to update the files (subject to mtime values being increased).

So the trick of adding reload at the end of such commands technically works, and in fact it's already been suggested in various issues before so it's nothing new. But it's also kind of a hacky workaround and I'm not sure I want to recommend such a solution in the wiki. Maybe the answer is to just encourage more users to use watch instead.

Anyway I will close this issue since it's solved now. Thanks for reporting it.

from lf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.