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

No expansion of nested environment variables in environment variable overrides #674

Closed
6b6279 opened this issue Apr 1, 2024 · 2 comments

Comments

@6b6279
Copy link

6b6279 commented Apr 1, 2024

Hello,

I am not sure if this is a shortcoming of Flatpak itself, but it seems like nested envvars in envvar overwrites are not evaluated, e.g., the overwrite MYDATADIR=$XDG_DATA_HOME/custom isn't evaluated into MYDATADIR=/home/foo/.var/app/foo.bar.Example/data/custom, but according to flatpak run --command=sh --devel, it's declared literally, so that the variable literally contains the substring $XDG_DATA_HOME.

I've discovered this trying to set DOOMWADDIR for Crispy Doom: fabiangreffrath/crispy-doom#1193

@rusty-snake
Copy link

There is no concept of "nested environment variables" in POSIX (i.e. setenv(3)/getenv(3)). They are plain strings w/o any logic/runtime beyond <NAME>=<VALUE>. FOOBAR=$FOO/bar in bash works because the right side is evaluated with features such as "parameter expansion" or "command substitution".

Flatseal could (=technically possible) expand those variables at the time when you enter/save them but not when you flatpak run. This is likely not what you want since you could also just enter the expanded path. (And $XDG_DATA_HOME might have an unexpected value due to flatpak).

As you already said, this limitation comes from flatpak. Where I could find two relevant issues:

flatpak/flatpak#4596
flatpak/flatpak#1415

@6b6279
Copy link
Author

6b6279 commented Apr 1, 2024

I see. Like you said, if Flatseal were to expand envvars upon "entry" (e.g., string replacement in the entry field), it'd cause other issues, ex., $XDG_DATA_HOME being incorrectly replaced. I guess I am better off manually typing in the exact paths.

@6b6279 6b6279 closed this as completed Apr 1, 2024
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

No branches or pull requests

2 participants