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

Update libfuse patch #37

Closed
wants to merge 1 commit into from
Closed

Update libfuse patch #37

wants to merge 1 commit into from

Conversation

Bqleine
Copy link

@Bqleine Bqleine commented Jul 4, 2024

This new patch searches for fusermount and fusermount3 in both the compiled path, and in PATH. The error codes for each try are displayed in case of failure to find a suitable binary:

noe@lignux /tmp [env]$ ./z05szmzfqcc82i2ikcz7q18aihj9lb10-hello-appimage-pack.AppImage 
fuse: failed to exec fusermount, tried the following:
	/var/empty/fusermount3 : No such file or directory
	fusermount3 : No such file or directory
	/var/empty/fusermount : No such file or directory
	fusermount : No such file or directory

Cannot mount AppImage, please check your FUSE setup.
You might still be able to extract the contents of this AppImage 
if you run it with the --appimage-extract option. 
See https://github.com/AppImage/AppImageKit/wiki/FUSE 
for more information
open dir error: No such file or directory

This pull request should close #36, #32, #16, #35, #31, and #15.

What do you think @probonopd @TheAssassin ?
P.S. sorry if I've been rude. I've made too much of a big deal out of things, I really appreciate your work on AppImages.

@Bqleine
Copy link
Author

Bqleine commented Jul 4, 2024

I've abandonned the idea of trying future fusermount versions for simplicity.

@probonopd
Copy link
Member

Thanks for your contribution @Bqleine, really appreciate it. Never came across as rude, no need to apologize.

I've abandonned the idea of trying future fusermount versions for simplicity.

Imho that's actually a really important part of the solution. If you could add that back, I'd be all for it!

@Bqleine
Copy link
Author

Bqleine commented Jul 5, 2024

Are you sure about this? I feel like the user would not expect that his AppImage searches for fusermount versions that don't exist, and it would confuse them if they're trying to debug problems.
There's also no sign of a new major version of libfuse being released any time in the future (https://github.com/libfuse/libfuse/?tab=readme-ov-file#development-status) and even if one were to be released fusermount3 would still be available for users for a long time. Long enough to update the AppImage.

@Samueru-sama
Copy link

I would like to add that distros that only ship fusermount3 symlink it to fusermount so it is highly unlikely that in the future this wouldn't be the case.

Imo, a more proper solution would be to automate the --appimage-extract-and-run function so that if there isn't a working fuse on the system that is used automatically as a fallback.

@probonopd
Copy link
Member

Imo, a more proper solution would be to automate the --appimage-extract-and-run function so that if there isn't a working fuse on the system that is used automatically as a fallback.

This is not what we want, as people would just leave their FUSE setup broken.

@Bqleine
Copy link
Author

Bqleine commented Jul 20, 2024

So can we merge this? I don't want to implement the checking for future versions because I think its a bad idea for security and as @Samueru-sama pointed out it would not be very useful. Nevertheless, this fix is important as buffer overflows are important security concerns.

@Samueru-sama
Copy link

Samueru-sama commented Jul 20, 2024

I also want to point out that older versions of linux mint are affected by the current bug of the hardcoded fusermount path so hopefully this can be fixed soon.

@probonopd
Copy link
Member

probonopd commented Jul 21, 2024

Yes, I'd also like to get a proper fix merged soon. To get this merged, we need to:

  • Also check for future fusermount versions (at least as a last resort)
  • Get @TheAssassin to review this

This new patch searches for fusermount and fusermount3..99 in both the
compiled path, and in PATH.

The error codes for each try are displayed in case of failure to find
a suitable binary.
@Bqleine
Copy link
Author

Bqleine commented Aug 10, 2024

@probonopd What do you think of this new patch?
Example output:

noe@lignux /tmp$ guix shell -C -- ./gj06dax4z6p35ip3j84mn78sgsqg8mn8-hello-appimage-pack.AppImage 
fuse: failed to exec fusermount, tried the following:
	/var/empty/fusermount : No such file or directory
	fusermount : No such file or directory
	/var/empty/fusermount3 : No such file or directory
	fusermount3 : No such file or directory
	/var/empty/fusermount4 : No such file or directory
	fusermount4 : No such file or directory
	/var/empty/fusermount5 : No such file or directory
	fusermount5 : No such file or directory
	/var/empty/fusermount6 : No such file or directory
	fusermount6 : No such file or directory
	/var/empty/fusermount7 : No such file or directory
	fusermount7 : No such file or directory
	/var/empty/fusermount8 : No such file or directory
	fusermount8 : No such file or directory
	/var/empty/fusermount9 : No such file or directory
	fusermount9 : No such file or directory
	/var/empty/fusermount10 : No such file or directory
	fusermount10 : No such file or directory
	/var/empty/fusermount11 : No such file or directory
	fusermount11 : No such file or directory
	/var/empty/fusermount12 : No such file or directory
	fusermount12 : No such file or directory
	/var/empty/fusermount13 : No such file or directory
	fusermount13 : No such file or directory
	/var/empty/fusermount14 : No such file or directory
	fusermount14 : No such file or directory
	/var/empty/fusermount15 : No such file or directory
	fusermount15 : No such file or directory
	/var/empty/fusermount16 : No such file or directory
	fusermount16 : No such file or directory
	/var/empty/fusermount17 : No such file or directory
	fusermount17 : No such file or directory
	/var/empty/fusermount18 : No such file or directory
	fusermount18 : No such file or directory
	/var/empty/fusermount19 : No such file or directory
	fusermount19 : No such file or directory
	/var/empty/fusermount20 : No such file or directory
	fusermount20 : No such file or directory
	/var/empty/fusermount21 : No such file or directory
	fusermount21 : No such file or directory
	/var/empty/fusermount22 : No such file or directory
	fusermount22 : No such file or directory
	/var/empty/fusermount23 : No such file or directory
	fusermount23 : No such file or directory
	/var/empty/fusermount24 : No such file or directory
	fusermount24 : No such file or directory
	/var/empty/fusermount25 : No such file or directory
	fusermount25 : No such file or directory
	/var/empty/fusermount26 : No such file or directory
	fusermount26 : No such file or directory
	/var/empty/fusermount27 : No such file or directory
	fusermount27 : No such file or directory
	/var/empty/fusermount28 : No such file or directory
	fusermount28 : No such file or directory
	/var/empty/fusermount29 : No such file or directory
	fusermount29 : No such file or directory
	/var/empty/fusermount30 : No such file or directory
	fusermount30 : No such file or directory
	/var/empty/fusermount31 : No such file or directory
	fusermount31 : No such file or directory
	/var/empty/fusermount32 : No such file or directory
	fusermount32 : No such file or directory
	/var/empty/fusermount33 : No such file or directory
	fusermount33 : No such file or directory
	/var/empty/fusermount34 : No such file or directory
	fusermount34 : No such file or directory
	/var/empty/fusermount35 : No such file or directory
	fusermount35 : No such file or directory
	/var/empty/fusermount36 : No such file or directory
	fusermount36 : No such file or directory
	/var/empty/fusermount37 : No such file or directory
	fusermount37 : No such file or directory
	/var/empty/fusermount38 : No such file or directory
	fusermount38 : No such file or directory
	/var/empty/fusermount39 : No such file or directory
	fusermount39 : No such file or directory
	/var/empty/fusermount40 : No such file or directory
	fusermount40 : No such file or directory
	/var/empty/fusermount41 : No such file or directory
	fusermount41 : No such file or directory
	/var/empty/fusermount42 : No such file or directory
	fusermount42 : No such file or directory
	/var/empty/fusermount43 : No such file or directory
	fusermount43 : No such file or directory
	/var/empty/fusermount44 : No such file or directory
	fusermount44 : No such file or directory
	/var/empty/fusermount45 : No such file or directory
	fusermount45 : No such file or directory
	/var/empty/fusermount46 : No such file or directory
	fusermount46 : No such file or directory
	/var/empty/fusermount47 : No such file or directory
	fusermount47 : No such file or directory
	/var/empty/fusermount48 : No such file or directory
	fusermount48 : No such file or directory
	/var/empty/fusermount49 : No such file or directory
	fusermount49 : No such file or directory
	/var/empty/fusermount50 : No such file or directory
	fusermount50 : No such file or directory
	/var/empty/fusermount51 : No such file or directory
	fusermount51 : No such file or directory
	/var/empty/fusermount52 : No such file or directory
	fusermount52 : No such file or directory
	/var/empty/fusermount53 : No such file or directory
	fusermount53 : No such file or directory
	/var/empty/fusermount54 : No such file or directory
	fusermount54 : No such file or directory
	/var/empty/fusermount55 : No such file or directory
	fusermount55 : No such file or directory
	/var/empty/fusermount56 : No such file or directory
	fusermount56 : No such file or directory
	/var/empty/fusermount57 : No such file or directory
	fusermount57 : No such file or directory
	/var/empty/fusermount58 : No such file or directory
	fusermount58 : No such file or directory
	/var/empty/fusermount59 : No such file or directory
	fusermount59 : No such file or directory
	/var/empty/fusermount60 : No such file or directory
	fusermount60 : No such file or directory
	/var/empty/fusermount61 : No such file or directory
	fusermount61 : No such file or directory
	/var/empty/fusermount62 : No such file or directory
	fusermount62 : No such file or directory
	/var/empty/fusermount63 : No such file or directory
	fusermount63 : No such file or directory
	/var/empty/fusermount64 : No such file or directory
	fusermount64 : No such file or directory
	/var/empty/fusermount65 : No such file or directory
	fusermount65 : No such file or directory
	/var/empty/fusermount66 : No such file or directory
	fusermount66 : No such file or directory
	/var/empty/fusermount67 : No such file or directory
	fusermount67 : No such file or directory
	/var/empty/fusermount68 : No such file or directory
	fusermount68 : No such file or directory
	/var/empty/fusermount69 : No such file or directory
	fusermount69 : No such file or directory
	/var/empty/fusermount70 : No such file or directory
	fusermount70 : No such file or directory
	/var/empty/fusermount71 : No such file or directory
	fusermount71 : No such file or directory
	/var/empty/fusermount72 : No such file or directory
	fusermount72 : No such file or directory
	/var/empty/fusermount73 : No such file or directory
	fusermount73 : No such file or directory
	/var/empty/fusermount74 : No such file or directory
	fusermount74 : No such file or directory
	/var/empty/fusermount75 : No such file or directory
	fusermount75 : No such file or directory
	/var/empty/fusermount76 : No such file or directory
	fusermount76 : No such file or directory
	/var/empty/fusermount77 : No such file or directory
	fusermount77 : No such file or directory
	/var/empty/fusermount78 : No such file or directory
	fusermount78 : No such file or directory
	/var/empty/fusermount79 : No such file or directory
	fusermount79 : No such file or directory
	/var/empty/fusermount80 : No such file or directory
	fusermount80 : No such file or directory
	/var/empty/fusermount81 : No such file or directory
	fusermount81 : No such file or directory
	/var/empty/fusermount82 : No such file or directory
	fusermount82 : No such file or directory
	/var/empty/fusermount83 : No such file or directory
	fusermount83 : No such file or directory
	/var/empty/fusermount84 : No such file or directory
	fusermount84 : No such file or directory
	/var/empty/fusermount85 : No such file or directory
	fusermount85 : No such file or directory
	/var/empty/fusermount86 : No such file or directory
	fusermount86 : No such file or directory
	/var/empty/fusermount87 : No such file or directory
	fusermount87 : No such file or directory
	/var/empty/fusermount88 : No such file or directory
	fusermount88 : No such file or directory
	/var/empty/fusermount89 : No such file or directory
	fusermount89 : No such file or directory
	/var/empty/fusermount90 : No such file or directory
	fusermount90 : No such file or directory
	/var/empty/fusermount91 : No such file or directory
	fusermount91 : No such file or directory
	/var/empty/fusermount92 : No such file or directory
	fusermount92 : No such file or directory
	/var/empty/fusermount93 : No such file or directory
	fusermount93 : No such file or directory
	/var/empty/fusermount94 : No such file or directory
	fusermount94 : No such file or directory
	/var/empty/fusermount95 : No such file or directory
	fusermount95 : No such file or directory
	/var/empty/fusermount96 : No such file or directory
	fusermount96 : No such file or directory
	/var/empty/fusermount97 : No such file or directory
	fusermount97 : No such file or directory
	/var/empty/fusermount98 : No such file or directory
	fusermount98 : No such file or directory
	/var/empty/fusermount99 : No such file or directory
	fusermount99 : No such file or directory
If you think this is an error, please report the issue to the AppImage runtime developpers at https://github.com/AppImage/type2-runtime along with the above output.

Cannot mount AppImage, please check your FUSE setup.
You might still be able to extract the contents of this AppImage 
if you run it with the --appimage-extract option. 
See https://github.com/AppImage/AppImageKit/wiki/FUSE 
for more information
open dir error: No such file or directory

@probonopd
Copy link
Member

Thank you very much @Bqleine. Very helpful indeed.

I think we should shorten the error output quite a bit - if no fusermount is found, we should probably just state that once. Is /var/empty misleading? I guess we are not really searching for the binaries at that path?

Copy link

Build for testing:
artifacts
Use at your own risk.

@Bqleine
Copy link
Author

Bqleine commented Aug 11, 2024

Thank you very much @Bqleine. Very helpful indeed.

I think we should shorten the error output quite a bit - if no fusermount is found, we should probably just state that once.

That’s just because we search for 99 versions, which seems a little bit over board.

Is /var/empty misleading? I guess we are not really searching for the binaries at that path?

We are really searching in that path, its the default path that fusermount was compiled with. The reason it’s « /var/empty » is simply because I built this image with GNU Guix. I could remove that second check though

@probonopd
Copy link
Member

Couldn't we just say "No fusermount binary found on the $PATH" just once if none is found?

@probonopd
Copy link
Member

probonopd commented Aug 14, 2024

It seems like FUSE nowadays also searches on the $PATH by default:
libfuse/libfuse@290c65b

They are using posix_spawnp instead of execvp though. Should we do the same? Maybe rebase this patch on the latest FUSE?

(I quickly checked: execvp replaces the current process, while posix_spawnp creates a new process. execvp does not return on success, while posix_spawnp returns to the caller. posix_spawnp seems to be preferred by some for its efficiency and simplicity in process creation.)

@s09bQ5
Copy link

s09bQ5 commented Sep 16, 2024

What if future versions of fusermount expect different parameters? I don't think it is a good idea to try unknown versions. Users can always add a symlink or wrapper script for fusermount to their system if they want to run ancient AppImages.

@probonopd
Copy link
Member

Worst case is that it will break. If we do not even try, it will break for sure. So we better try at least.

@adrianinsaval
Copy link

What's missing here to get this merged?

@probonopd
Copy link
Member

We'd need @TheAssassin to review this. Friendly ping :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants