Skip to content

yaml parsing error #73

@CompuRoot

Description

@CompuRoot

There is something wrong with yaml parsing, let show example:

tasks:                                                                                                                                                                
  task1:                                                                                                                                                              
    dir: /etc                                                                                                                                                         
    command:                                                                                                                                                          
      - /bin/ls -la                                                                                                                                                   
      - /bin/pwd                                                                                                                                                      
      - /bin/printf '%s\nLine-2\n' '=========== Line #1 ==================' 

Even hash symbol # is enclosed in single quotes, it treated as a comment symbol and as result:
reached EOF without closing quote '

An attempt to escape hash sign as:

tasks:                                                                                                                                                                
  task1:                                                                                                                                                              
    dir: /etc                                                                                                                                                         
    command:                                                                                                                                                          
      - /bin/ls -la                                                                                                                                                   
      - /bin/pwd                                                                                                                                                      
      - /bin/printf '%s\nLine-2\n' '=========== Line \#1 =================='

will fix the problem, but escaping is visible as:
=========== Line \#1 ==================
which is also wrong.

More serious issue happened if we going to process tasks via context:

tasks:                                                                                                                                                                
  task1:                                                                                                                                                              
    context: ctx-bin-sh                                                                                                                                               
    dir: /etc                                                                                                                                                         
    command:                                                                                                                                                          
      - /bin/ls -la                                                                                                                                                   
      - /bin/pwd                                                                                                                                                      
      - /bin/printf '%s\nLine-2\n' '=========== Line 1 =================='                                                                                           
                                                                                                                                                                      
contexts:                                                                                                                                                             
  ctx-bin-sh:                                                                                                                                                         
    executable:                                                                                                                                                       
      bin: /bin/sh                                                                                                                                                    
      args:                                                                                                                                                           
        - -c                                                                                                                                                          
    before: echo "================================================================================"                                                                   
    after: echo "--------------------------------------------------------------------------------"

First of all before & after assigned in ctx-bin-sh won't show content.
Commands in task1 will pass commands to ctx-bin-sh the only first part ignoring rest of the string.
(quoting commands as "/bin/ls -la" won't help either)
So, /bin/ls -la will be executed simply as /bin/sh (where -la get lost).
printf command will be fired without arguments at all, so result is /bin/printf: missing operand

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions