-
Notifications
You must be signed in to change notification settings - Fork 45
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
--workdir=~/tmp/rpminspect creates literal ~ directory in PWD #22
Comments
I agree, that is unexpected. Though it's not technically wrong. ~ is a perfectly legal filename character. :) I will fix this up. Thank you for these reports, they are really helpful. |
~ expansion is generally handled by your shell, but when using long options most shells do not expand the ~ character and pass the string directly in the argument vector. What I have done is add ~ expanding for the workdir argument if you have a ~ in the string. See the glob(3) man page for details on the functionality. I am using the GLOB_TILDE_CHECK functionality, so there are some additional checks to ensure the user is there and such. Since I am relying on glob(3), I will get GLOB_NOMATCH back if the path does not exist. That is a side effect of using glob(3). So if you are going to use the long option syntax of rpminspect, keep this in mind. |
In other words, if the directory in my home doesn't exists, literal ~ is created, but if it exists, it is used? I bet that this will also bite somebody, but If anything else would be more complicated, i think it is fine. |
It won't create it for workdir because glob() can't successfully expand it. Before this fix it would create it though because the ~ was carried through to the mkdirp() function. This fix will prevent that. |
~ expansion is generally handled by your shell, but when using long options most shells do not expand the ~ character and pass the string directly in the argument vector. What I have done is add ~ expanding for the workdir argument if you have a ~ in the string. See the glob(3) man page for details on the functionality. I am using the GLOB_TILDE_CHECK functionality, so there are some additional checks to ensure the user is there and such. Since I am relying on glob(3), I will get GLOB_NOMATCH back if the path does not exist. That is a side effect of using glob(3). So if you are going to use the long option syntax of rpminspect, keep this in mind.
~ expansion is generally handled by your shell, but when using long options most shells do not expand the ~ character and pass the string directly in the argument vector. What I have done is add ~ expanding for the workdir argument if you have a ~ in the string. See the glob(3) man page for details on the functionality. I am using the GLOB_TILDE_CHECK functionality, so there are some additional checks to ensure the user is there and such. Since I am relying on glob(3), I will get GLOB_NOMATCH back if the path does not exist. That is a side effect of using glob(3). So if you are going to use the long option syntax of rpminspect, keep this in mind.
This command creates a directory called literally ~ in PWD. That is somewhat unexpected.
The text was updated successfully, but these errors were encountered: