How to prevent Jenkins from adding single quotes to parameterized vlaues

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to prevent Jenkins from adding single quotes to parameterized vlaues

norve
I basically have a string parameter that contains values from other parameter fields, which I then use again in the Execute shell command.
However, Jenkins adds single quotes in erroneous places within that string, which makes the executing application unable to parse the arguments.

Example:

Name: OPTS Default Value: -e "arg1=${VAR1} arg2=${VAR2} arg3={VAR3}" Execute shell Command: ./build_app $OPTS Console Output: ./build_app -e '"arg1=value1' arg2=value2 'arg3=value3"'

Notice the placement of the single quotes preceding the opening double quote and after value1, and before arg3 and after the closing double quote. These were not added by me.

I have also tried:
Command: ./build_app $(echo $OPTS)

but it renders the same results.

I am trying to figure out if this is expected behavior or if this is an actual bug.
The only other mention of this issue was found here (which went unanswered): http://stackoverflow.com/questions/28260083/how-do-i-prevent-jenkins-from-single-quoting-the-parameterized-value

I am currently running Jenkins 1.642.


Thanks!

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/2956f859-9701-492a-9268-d2bbea1ae466%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to prevent Jenkins from adding single quotes to parameterized vlaues

norve
I've also tried doing this:
Name: OPTS
Default Value: -o tmp -e "arg1=${VAR1} arg2=${VAR2} arg3=${VAR3}"

Execute shell command:
ARGS=$(echo $OPTS)
./build_app $ARGS

Console Output:

++ echo -o tmp -e '"arg1=value1' arg2=value2 'arg3=value3"'
+ ARGS='-o tmp -e "arg1=${VAR1} arg2=${VAR2} arg3={VAR3}"'
+ ./build_app  -o tmp -e '"arg1=value1' arg2=value2 'arg3=value3"'

So it seems the parameter variable itself doesn't contain the single quotes, just when it's being referenced. And the single quotes only appear around wherever there's double quotes in the string.

On Friday, December 18, 2015 at 4:21:20 PM UTC-5, [hidden email] wrote:
I basically have a string parameter that contains values from other parameter fields, which I then use again in the Execute shell command.
However, Jenkins adds single quotes in erroneous places within that string, which makes the executing application unable to parse the arguments.

Example:

Name: OPTS Default Value: -e "arg1=${VAR1} arg2=${VAR2} arg3={VAR3}" Execute shell Command: ./build_app $OPTS Console Output: ./build_app -e '"arg1=value1' arg2=value2 'arg3=value3"'

Notice the placement of the single quotes preceding the opening double quote and after value1, and before arg3 and after the closing double quote. These were not added by me.

I have also tried:
Command: ./build_app $(echo $OPTS)

but it renders the same results.

I am trying to figure out if this is expected behavior or if this is an actual bug.
The only other mention of this issue was found here (which went unanswered): <a href="http://stackoverflow.com/questions/28260083/how-do-i-prevent-jenkins-from-single-quoting-the-parameterized-value" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fstackoverflow.com%2Fquestions%2F28260083%2Fhow-do-i-prevent-jenkins-from-single-quoting-the-parameterized-value\46sa\75D\46sntz\0751\46usg\75AFQjCNEWjko3MCkuqjkOjSsZr2QBBSY5HQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fstackoverflow.com%2Fquestions%2F28260083%2Fhow-do-i-prevent-jenkins-from-single-quoting-the-parameterized-value\46sa\75D\46sntz\0751\46usg\75AFQjCNEWjko3MCkuqjkOjSsZr2QBBSY5HQ&#39;;return true;">http://stackoverflow.com/questions/28260083/how-do-i-prevent-jenkins-from-single-quoting-the-parameterized-value

I am currently running Jenkins 1.642.


Thanks!

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/ae6da2f1-0391-4f15-97e8-e114734dc1a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to prevent Jenkins from adding single quotes to parameterized vlaues

Daniel Beck
I answered this on IRC. Here's basically the same answer again:
http://stackoverflow.com/a/34364786

On 18.12.2015, at 22:57, [hidden email] wrote:

> I've also tried doing this:
> Name: OPTS
> Default Value: -o tmp -e "arg1=${VAR1} arg2=${VAR2} arg3=${VAR3}"
>
> Execute shell command:
> ARGS=$(echo $OPTS)
> ./build_app $ARGS
>
> Console Output:
>
> ++ echo -o tmp -e '"arg1=value1' arg2=value2 'arg3=value3"'
> + ARGS='-o tmp -e "arg1=${VAR1} arg2=${VAR2} arg3={VAR3}"'
>
> + ./build_app  -o tmp -e '"arg1=value1' arg2=value2 'arg3=value3"'
>
> So it seems the parameter variable itself doesn't contain the single quotes, just when it's being referenced. And the single quotes only appear around wherever there's double quotes in the string.
>
> On Friday, December 18, 2015 at 4:21:20 PM UTC-5, [hidden email] wrote:
> I basically have a string parameter that contains values from other parameter fields, which I then use again in the Execute shell command.
> However, Jenkins adds single quotes in erroneous places within that string, which makes the executing application unable to parse the arguments.
>
> Example:
>
> Name: OPTS
> Default Value: -e "arg1=${VAR1} arg2=${VAR2} arg3={VAR3}"
>
> Execute shell
> Command: ./build_app $OPTS
>
>
> Console Output:
> ./build_app -e '"arg1=value1' arg2=value2 'arg3=value3"'
>
>
> Notice the placement of the single quotes preceding the opening double quote and after value1, and before arg3 and after the closing double quote. These were not added by me.
>
> I have also tried:
> Command: ./build_app $(echo $OPTS)
>
> but it renders the same results.
>
> I am trying to figure out if this is expected behavior or if this is an actual bug.
> The only other mention of this issue was found here (which went unanswered): http://stackoverflow.com/questions/28260083/how-do-i-prevent-jenkins-from-single-quoting-the-parameterized-value
>
> I am currently running Jenkins 1.642.
>
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/ae6da2f1-0391-4f15-97e8-e114734dc1a2%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/10763EB4-3809-4BAA-A8BD-CC3CF0DDE46F%40beckweb.net.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to prevent Jenkins from adding single quotes to parameterized vlaues

Aaron G
It IS adding the single quotes to build parameters!

On Friday, December 18, 2015 at 7:58:04 PM UTC-5, Daniel Beck wrote:
I answered this on IRC. Here's basically the same answer again:
<a href="http://stackoverflow.com/a/34364786" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fstackoverflow.com%2Fa%2F34364786\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGsiWTpibzznAZlro3kSVR4KnoEkw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fstackoverflow.com%2Fa%2F34364786\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGsiWTpibzznAZlro3kSVR4KnoEkw&#39;;return true;">http://stackoverflow.com/a/34364786

On 18.12.2015, at 22:57, <a href="javascript:" target="_blank" gdf-obfuscated-mailto="9X4NHgmADAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">no...@... wrote:

> I've also tried doing this:
> Name: OPTS
> Default Value: -o tmp -e "arg1=${VAR1} arg2=${VAR2} arg3=${VAR3}"
>
> Execute shell command:
> ARGS=$(echo $OPTS)
> ./build_app $ARGS
>
> Console Output:
>
> ++ echo -o tmp -e '"arg1=value1' arg2=value2 'arg3=value3"'
> + ARGS='-o tmp -e "arg1=${VAR1} arg2=${VAR2} arg3={VAR3}"'
>
> + ./build_app  -o tmp -e '"arg1=value1' arg2=value2 'arg3=value3"'
>
> So it seems the parameter variable itself doesn't contain the single quotes, just when it's being referenced. And the single quotes only appear around wherever there's double quotes in the string.
>
> On Friday, December 18, 2015 at 4:21:20 PM UTC-5, [hidden email] wrote:
> I basically have a string parameter that contains values from other parameter fields, which I then use again in the Execute shell command.
> However, Jenkins adds single quotes in erroneous places within that string, which makes the executing application unable to parse the arguments.
>
> Example:
>
> Name: OPTS
> Default Value: -e "arg1=${VAR1} arg2=${VAR2} arg3={VAR3}"
>         
> Execute shell
> Command: ./build_app $OPTS
>
>
> Console Output:
> ./build_app -e '"arg1=value1' arg2=value2 'arg3=value3"'
>
>
> Notice the placement of the single quotes preceding the opening double quote and after value1, and before arg3 and after the closing double quote. These were not added by me.
>
> I have also tried:
> Command: ./build_app $(echo $OPTS)
>
> but it renders the same results.
>
> I am trying to figure out if this is expected behavior or if this is an actual bug.
> The only other mention of this issue was found here (which went unanswered): <a href="http://stackoverflow.com/questions/28260083/how-do-i-prevent-jenkins-from-single-quoting-the-parameterized-value" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fstackoverflow.com%2Fquestions%2F28260083%2Fhow-do-i-prevent-jenkins-from-single-quoting-the-parameterized-value\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEWjko3MCkuqjkOjSsZr2QBBSY5HQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fstackoverflow.com%2Fquestions%2F28260083%2Fhow-do-i-prevent-jenkins-from-single-quoting-the-parameterized-value\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEWjko3MCkuqjkOjSsZr2QBBSY5HQ&#39;;return true;">http://stackoverflow.com/questions/28260083/how-do-i-prevent-jenkins-from-single-quoting-the-parameterized-value
>
> I am currently running Jenkins 1.642.
>
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="9X4NHgmADAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkins...@googlegroups.com.
> To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/ae6da2f1-0391-4f15-97e8-e114734dc1a2%40googlegroups.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/ae6da2f1-0391-4f15-97e8-e114734dc1a2%40googlegroups.com&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/ae6da2f1-0391-4f15-97e8-e114734dc1a2%40googlegroups.com&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/ae6da2f1-0391-4f15-97e8-e114734dc1a2%40googlegroups.com.
> For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/3d35cd9a-0dd6-407a-8ccf-a88c6b156452%40googlegroups.com.