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

Pick up LD_PRELOAD when set by the user #279

Merged
merged 1 commit into from
Apr 4, 2024

Conversation

guihkx
Copy link
Contributor

@guihkx guihkx commented Apr 4, 2024

This allows users to set an override for LD_PRELOAD, e.g.:

flatpak override --user "--env=LD_PRELOAD=$HOME/.var/app/com.spotify.Client/useful_lib.so" com.spotify.Client

This allows users to set an override for LD_PRELOAD, e.g.:

flatpak override --user "--env=LD_PRELOAD=$HOME/.var/app/com.spotify.Client/useful_lib.so" com.spotify.Client
@flathubbot
Copy link
Contributor

Started test build 112207

@flathubbot
Copy link
Contributor

Build 112207 successful
To test this build, install it from the testing repository:

flatpak install --user https://dl.flathub.org/build-repo/95022/com.spotify.Client.flatpakref

@Erick555
Copy link
Contributor

Erick555 commented Apr 4, 2024

Did you tested it?

Variables in --env aren't expanded so $HOME will be literal $HOME nonsense path instead of actual homedir. It's also probable that inheriting arbitrary LD_PRELOAD from host may break something.

@TingPing
Copy link
Member

TingPing commented Apr 4, 2024

It would never automatically inherit from host so that isn’t a problem.

I do wonder what the use case is though.

@guihkx
Copy link
Contributor Author

guihkx commented Apr 4, 2024

Did you tested it?

Yup, I did. It works.

Variables in --env aren't expanded so $HOME will be literal

In the example I gave, the only scenario where $HOME wouldn't get expanded, is if we wrapped it around single quotes ('), as far as I know. I've tested this with Bash and Fish shell.

I do wonder what the use case is though.

Adblockers, mostly. Though I'm not exactly sure if it'd be appropriate for me to link them here?

@TingPing TingPing merged commit 6767a63 into flathub:master Apr 4, 2024
1 check passed
@guihkx guihkx deleted the pickup-ld_preload branch April 4, 2024 16:46
@Erick555
Copy link
Contributor

Erick555 commented Apr 4, 2024

It would never automatically inherit from host so that isn’t a problem.

What do you mean? Flatpak does inherit LD_PRELOAD from host, I even linked issue about it.

@guihkx
Copy link
Contributor Author

guihkx commented Apr 4, 2024

Flatpak does inherit LD_PRELOAD from host

It does, indeed. Though I question if it's a behavior we should care about.

In my opinion, if users have LD_PRELOAD set globally on their machine, and that somehow causes some Flatpak app to break, it's a problem they introduced.

On my tests, Spotify didn't break even when I tried to preload an invalid lib, e.g.:

flatpak run --env=LD_PRELOAD=/foo/libcef.so com.spotify.Client

@TingPing
Copy link
Member

TingPing commented Apr 4, 2024

I even linked issue about it.

Oh wow. Sorry you're right. It just sounded so crazy I made an assumption.

@TingPing
Copy link
Member

TingPing commented Apr 4, 2024

flatpak/flatpak#5765

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.

None yet

4 participants