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

Add variable expansion to root_share and debug services #96

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

xiota
Copy link

@xiota xiota commented Mar 5, 2024

Uses os.path.expandvars() to expand variables in root_share and debug services.

Tested with $HOME variable and non-variable $TEST. Existing configs containing $ will not break as long as the word does not correspond to a variable.

Closes #61

@rusty-snake
Copy link
Contributor

rusty-snake commented Mar 5, 2024

Maybe expanduser (i.e. ~ -> /home/user) would be somethning some users expect too.

It's always hard to explain that $HOME and ~ are shell things. And that they are different things.

@igo95862
Copy link
Owner

igo95862 commented Mar 6, 2024

Hello @xiota

I don't like not having explicit control over how inputs are mutated.

One idea that might be interesting is changing behavior based on if raw_bwrap_args is a string or a list on the services file. The lists would work as is but strings would be treated as shell commands.

For example,

raw_bwrap_args='''
--setenv X "$Y"
'''

This uses the TOML multi line string syntax and would be shlex split and variables would be expanded.

By the way is there a particular reason you would want the environment variables to be used? Does your $HOME change a lot?

@xiota
Copy link
Author

xiota commented Mar 7, 2024

interpreting variables for arguments is fairly common. It increases configuration flexibility while decreasing implementation complexity. Separate home share and root share are no longer needed. Complicated workarounds to add functionality are no longer needed. Instances can be portable. They can be used by different users on different computers.

Compatibility with existing configurations should be high because the use of $ in paths and arguments on Linux/Unix is uncommon.

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.

[Req] Combine home share and root share?
3 participants