-
Notifications
You must be signed in to change notification settings - Fork 146
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
template: allow & in arg string #809
base: master
Are you sure you want to change the base?
Conversation
As long as the "&" is escaped like \& it will treat it literally now. But if it is on its own like "&" then it will treat it like a special character. This is the Bastille file I'm using. ARG NAME CMD echo "My name is ${NAME}" > /root/my-name With --arg NAME="me \& you" |
The question is how to properly document that for the user since it is not obvious that you have to pass |
Good point. I think personally it should be a general point that if we are using special characters (anywhere) we need to try to escape them. This keeps things lined up with the rest of the BSD world/code for the most part. The other question is, Is there ever a time when the user will want to use the "specialness" of that character? And if they do, we definitely need to have a way to do both, and escaping it is the best option. IMO. |
How so? All it does is add one additional clans to the "parse_arg_value" function. And that is, if it finds \&, it will make sure it stays. |
ok I am good with it. |
I've added docs saying that it needs to be escaped if it is to be treated literally. The question is, does it work for you? |
I have now tried the following:
It does not work:
I also need to note that
and
|
You are escaping it twice there. It should only be escaped once, and without the single quotes. |
@michael-o @tschettervictor what is the status of this one. Looking at what can be closed out this weekend but not sure where we are. Last posting from Michael was he found an error. |
Will do more tests on Monday. |
Why no single quotes? So if single quotes aren't allowed then one issue is fixed and then something else will be broken. |
Did you try with the single quotes? Perhaps it does work. I didn't try that. |
The only thing which works is:
but with single quotes it does not work. It also requires two backslashes, from a user PoV the behavior is unclear and not really usable. |
what triggered this PR with a & in it? Is this something we are trying to code around a one off occurance, or is there a real use case behind it? Just curious since this regex is seeming to get complicated. |
See my example by providing GECOS and have the system resolve |
So, what if we would require it to be inside single quotes for it to be recognized literally? |
Can you rephrase with an example? I don't understand the question. |
'&' will treat it literally, where not having the single quotes will treat it as a special character. |
Then how to combine both? Two singlequotes? |
First off, what is your suggestion? What should work and be acceptable? Then we can go from there. |
My expectation would be the following that these work:
if any of these requires escaping then it should be properly documented. |
#412
The PR will make sure an escape character \ is added in front of the & character in 'arg' string ONLY if it is escaped like "\&".
It fixes #412, but I'm not sure if it will break something else down the road. It shouldn't as it only looks for \& and makes sure it stays that way.
@michael-o
@tobiastom