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

Feh tries to read .tar.bz2 files and it takes a looooong time #477

Closed
ghost opened this issue Jun 27, 2019 · 7 comments
Closed

Feh tries to read .tar.bz2 files and it takes a looooong time #477

ghost opened this issue Jun 27, 2019 · 7 comments

Comments

@ghost
Copy link

ghost commented Jun 27, 2019

Steps to reproduce:

  1. Create a big .tar.bz archive in a directory with images:
$ dd if=/dev/urandom of=data.bin bs=30M count=10
$ tar cf data.tar data.bin
$ bzip2 -9 data.tar
  1. Then start feh . and use space to cycle through all the images.

It takes a long time to skip this data.tar.bz2 file (why does feh even try to load it?)

Something like this happens with .mkv files and probably others.

@derf derf added the bug label Jul 21, 2019
@derf
Copy link
Owner

derf commented Jul 21, 2019

feh relies on Imlib2 to load images.

Imlib2 contains a bzip2 loader, allowing it to seamlessly load images which were compressed using bzip2. Unfortunately, it decompresses the entire file before checking its header for the appropriate magic bytes, leading to the issue you observe.

There isn't much feh can do about this, sorry. Could you address this issue to the Imlib2 developers?

@derf derf added the Imlib2 label Jul 21, 2019
@Ferada
Copy link
Contributor

Ferada commented Oct 14, 2019

Pretty sure it's not even checking magic bytes, only the file ending. I'm trying to get this patch in to fix this.

@Ferada
Copy link
Contributor

Ferada commented Oct 15, 2019

Was merged, together with a fix for .gz too; this issue should be fixed with that.

@ghost
Copy link
Author

ghost commented Oct 17, 2019

I'll try to apply the patch and test it.

@ghost
Copy link
Author

ghost commented Oct 22, 2019

The above link (https://phab.enlightenment.org/D10398) doesn't work now (Unable to connect to MySQL!), and the latest commit to the master branch was in July.

@Ferada
Copy link
Contributor

Ferada commented Oct 22, 2019

@opennota that's hopefully a temporary problem; try fetching from https://git.enlightenment.org/legacy/imlib2.git, the last commit on master there was Tue Oct 15 20:08:43 2019 +0200 which now includes the fixes.

@ghost
Copy link
Author

ghost commented Oct 23, 2019

Works like a charm, thank you! I'll close the issue.

@ghost ghost closed this as completed Oct 23, 2019
0xd61 pushed a commit to 0xd61/imlib2 that referenced this issue Jan 20, 2022
Summary:
Decompressing should be the last step, otherwise files that can't even be loaded will take unnecessarily long only to be discarded immediately.

This is in reference to [this issue for feh](derf/feh#477) complaining about long load times in case of accidentally trying to open a big .tar.bz2 archive.

Test Plan: Ran on sample from aforementioned ticket, observed immediate response and no further ill effects.

Reviewers: kwo

Differential Revision: https://phab.enlightenment.org/D10398
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants