-
Notifications
You must be signed in to change notification settings - Fork 348
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
Use wordexp to resolve variables like $HOME in path like settings #1215
Use wordexp to resolve variables like $HOME in path like settings #1215
Conversation
Codecov Report
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. @@ Coverage Diff @@
## master #1215 +/- ##
==========================================
- Coverage 66.19% 66.16% -0.04%
==========================================
Files 46 46
Lines 7671 7698 +27
==========================================
+ Hits 5078 5093 +15
- Misses 2593 2605 +12
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today! |
ece52ce
to
3dd33d7
Compare
Are there convincing use cases for needing command expansion? If not, then I would not include it. It can always be added later. I think both not expanding undefined variables and expanding them are fine. Not expanding might make it easier for the user to spot errors. It would be nice if the error message would be a bit more specific depending on the return value of wordexp. Maybe you can use some implementation somewhere that has this already (for example in i3). Keep in mind the license of course. |
3dd33d7
to
8958394
Compare
I agree that command substitution is not that important at the moment and adding some functionality later on is easier than removing it (and breaking configs).
I've expanded the warnings for each possible case. Please check, whether that suffices. I've also expanded the documentation where paths are expanded (basically, PS: I've checked the build failure and AFAICT |
8958394
to
7ec7005
Compare
@fwsmit any further actions required? |
I'll take a look once I have the time |
7ec7005
to
3458da5
Compare
It seems like the wordexp implementation in musl leaks memory and thus a new suppression is required to pass CI. It also doesn't fully implement all POSIX features and thus at least one test has to be deactivated in that case.
3458da5
to
b558997
Compare
Thanks, the implementation and documentation look good. I'll go ahead and merge it. |
This fixes #1173 - in combination with #1210
This is a spin-off of #1210 to properly handle environment variables for defining path like variables.
Open questions:
wordexp
?0
(like e.g. i3wm does) - allows for a maximum of flexibility. E.g. the output of a script could be used to set the variable (default_icon = $(some_random_command)
), but this also allows for arbitrary code execution.WRDE_NOCMD
- prohibits expansion of commands, but allows for all variables - even undefined ones.WRDE_NOCMD | WRDE_UNDEF
- strictest way of expansion, which ignores undefined variablesLOG_W
enough to inform user of failed expansion? Should this be more detailed wrt. kind of failure?