Skip to content

Add variable expansion to root_share and debug services - #96

Open
xiota wants to merge 1 commit into
igo95862:masterfrom
xiota:pr-expandvars
Open

xiota wants to merge 1 commit into
igo95862:masterfrom
xiota:pr-expandvars

Conversation

@xiota

@xiota xiota commented Mar 5, 2024

Copy link
Copy Markdown

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

rusty-snake commented Mar 5, 2024 •

Copy link
Copy Markdown
Contributor

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

igo95862 commented Mar 6, 2024

Copy link
Copy Markdown
Owner

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

xiota commented Mar 7, 2024 •

Copy link
Copy Markdown
Author

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