YAML results don't display correctly as literal strings

Bug #1071265 reported by Javier Collado
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
UTAH
Fix Released
Low
Javier Collado

Bug Description

Sometimes the yaml output doesn't display as literal strings the output from commands like in the following fragment:

  stderr: "DEBUG: Calling 'ls /tmp/tmpLsm5FK'\nDEBUG: stdout: file1\nfile2\nfile3\n\
    \nDEBUG: stderr: \nDEBUG: returncode: 0\nDEBUG: Checking for 'file1' in 'ls' output\n\
    DEBUG: Checking for 'file2' in 'ls' output\nDEBUG: Checking for 'file3' in 'ls'\
    \ output\nDEBUG: Calling 'ls -l /tmp/tmpLsm5FK/file1'\nDEBUG: stdout: -r-xr-xr-x\
    \ 1 root root 0 Oct 25 13:01 /tmp/tmpLsm5FK/file1\n\nDEBUG: stderr: \nDEBUG: returncode:\
    \ 0\nDEBUG: Calling 'ls -l /tmp/tmpLsm5FK/file2'\nDEBUG: stdout: -rw-rw-rw- 1\
    \ root root 0 Oct 25 13:01 /tmp/tmpLsm5FK/file2\n\nDEBUG: stderr: \nDEBUG: returncode:\
    \ 0\nDEBUG: Calling 'ls -l /tmp/tmpLsm5FK/file3'\nDEBUG: stdout: -rwxrwxrwx 1\
    \ root root 0 Oct 25 13:01 /tmp/tmpLsm5FK/file3\n\nDEBUG: stderr: \nDEBUG: returncode:\
    \ 0\n"

Note: this bug is related to: bug1040753

Related branches

Revision history for this message
Javier Collado (javier.collado) wrote :

The problem is that yaml doesn't serialize as literal string those that have whitespace characters before a newline character as in the following example:

>>> import yaml
>>> print yaml.dump('hello world\n', default_style='|')
|
  hello world

>>> print yaml.dump('hello world \n', default_style='|')
"hello world \n"

The solution would be to make sure that whitespace is removed, so that the strings are serialized as expected.

Changed in utah:
status: New → Triaged
importance: Undecided → Low
assignee: nobody → Javier Collado (javier.collado)
description: updated
description: updated
Changed in utah:
status: Triaged → In Progress
Changed in utah:
status: In Progress → Fix Committed
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.