Re: "commands: arglist" mismatch between behaviour and documentation?
"'Vratislav Podzimek' via help-cfengine" <[email protected]> Wed, 13 Sep 2023 15:55:25 +0200
| Newsgroups | gmane.comp.sysutils.cfengine.general |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 2023-09-13 at 06:38 -0700, [email protected] wrote: > Using 3.18.5 community edition on RHEL9; also 3.15 on RHEL7 and RHEL8 > > Documentation https://docs.cfengine.com/docs/3.18/reference-promise-types-commands.html gives the example: > ------------------------------------------------- > commands: "/bin/echo one" args => "two three", arglist => { "four", "five" }; > So in the example above the command would be: > /bin/echo one two three four five > ------------------------------------------------- > > It also states:------------------------------------------------- > That's particularly useful when there are embedded spaces and quotes in your arguments... > ------------------------------------------------- > > So I'm trying to build something, specifically requiring that "embedded spaces" claim. But I hit a problem, so strip it down to a proof-of-concept script: > ------------------------------------------------- > #! /bin/bash > echo "argcount: $#" > for (( i=1 ; i<=$#; i++)) > do > echo "${i}:${!i}" > done > ------------------------------------------------- > > At the command line I verify the script: > ------------------------------------------------- > $ ./modules/printargs A B "C with spaces" D > argcount: 4 > 1:A > 2:B > 3:C with spaces > 4:D > $ > ------------------------------------------------- > (Four arguments, the third being three words with embedded spaces.) > > I then run it from within our CFEngine framework: > ------------------------------------------------- > commands: > any:: > "$(gcom.modulesdir)/printargs" > arglist => { "A", "B", "C with spaces", "D" }; > ------------------------------------------------- > > But instead of receiving four arguments, it receives six: here's the CFE "inform" output: > ------------------------------------------------- > info: Executing 'no timeout' ... '[...]/modules/printargs A B C with spaces D' > notice: Q: ".../printargs A B ": argcount: 6 > Q: ".../printargs A B ": 1:A > Q: ".../printargs A B ": 2:B > Q: ".../printargs A B ": 3:C > Q: ".../printargs A B ": 4:with > Q: ".../printargs A B ": 5:spaces > Q: ".../printargs A B ": 6:D > info: Last 7 quoted lines were generated by promiser > ------------------------------------------------- > That useful "embedded spaces" claim in the documentation seems to be being ignored. > > Is the bug/problem: > * in the code > * or in the documentation > * or in my interpretation of the documentation > Help appreciated Definitely looks like a bug in the CFEngine code to me. I'm just surprised there's no failing test for this. Please report the issue at https://northerntech.atlassian.net/browse/CFE Thanks! -- Vratislav -- You received this message because you are subscribed to the Google Groups "help-cfengine" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/help-cfengine/651c503487b0a5a994e8751cbd6f375cdeee18c7.camel%40northern.tech.
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEENAH7ns+FyuCe6j1XmyV2peQQR/QFAmUBv00ACgkQmyV2peQQ R/SC/RAAsXq/ljWHKnHCLphfyI+J4Lbyk9+HBgAxDrNmJQBaUwQNMXeuJhn40dqo xsbLO4QiBHgzSarnrpdQARebc1xqGT6gSKQ46o0qt5b4Rukj6XNRJm+U2TvsbrYd A7UD2iqrtvo9HK288eWWm1d3/LxeG+7MPv5WkPDDZyndxqos3cT9xJyzde/MHekk jonBhQAdmOxegDo4yFSlxa37bjzKZ1TaHEanoK5Ka60umDETroLyn72IjiWqaWnb kG3IohIzEMdv7zldXHP5qi30VV3CAT3RrV6wL2ZO+IIW7uuDXY4S9f4CNzLKVL9i kKvFb2msDfw7pszET+2wIvAl6PHK3LsJ9LepLivuw+4kOhWSNZw7edrgyFiJMaMN V4CfKewbSLaw4lEokVyVl48lRLDB3VFY/Pc7wLmfm203/gx5vW6/XiL1cx0LhK+H 29tY4mgDb619R4NCHnxAlXGyyJEZ88UHMruxXz4O6V9c3ABK9IRFOeG2DYck+oeD YyDQWDcPj/7xreA9wqqwwbzTyFeotLbKZZ0eCO6F2tKvf8nbgsar+zDuVVIAUH1L JnnPlcV7yHvCeno4EsynRxSiKDJdk4jZp1D/5ldX0Ob8wOcu3RYkzKlqjucVW6N8 cC8GW17iKs+XnOkbkFd76t09a2rsiP0mPvgGeH9kCaxuRQkS4lE= =zlTO -----END PGP SIGNATURE-----