"commands: arglist" mismatch between behaviour and documentation?

"[email protected]" <[email protected]> Wed, 13 Sep 2023 06:38:56 -0700 (PDT)
Newsgroups gmane.comp.sysutils.cfengine.general
Message-ID <[email protected]>
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

-- David Lee

-- 
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/7bc39900-c022-4f37-b3fc-2a3a49fc20d8n%40googlegroups.com.