Snappy-debug bug

Filing here because there’s no bug tracker for snappy-debug.

I had snappy-debug.security scanlog running in a terminal today, and it died. I was running the libreoffice snap, and used the file dialog to open/save a file. When I went back to the snappy-debug window, i saw this:


Traceback (most recent call last):
  File "/snap/snappy-debug/414/bin/snappy-security-scanlog", line 1195, in <module>
    sys.exit(main())
  File "/snap/snappy-debug/414/bin/snappy-security-scanlog", line 1183, in main
    from_end=opt.only_new, exclude=opt.exclude)
  File "/snap/snappy-debug/414/bin/snappy-security-scanlog", line 209, in __init__
    self.scan_log(logs, snap_name, follow, from_end)
  File "/snap/snappy-debug/414/bin/snappy-security-scanlog", line 377, in scan_log
    _scan_line(line, snap_name)
  File "/snap/snappy-debug/414/bin/snappy-security-scanlog", line 315, in _scan_line
    self._print_entry(entry)
  File "/snap/snappy-debug/414/bin/snappy-security-scanlog", line 261, in _print_entry
    sys.stdout.write("%s\n" % out)
UnicodeEncodeError: 'ascii' codec can't encode character '\xc0' in position 271: ordinal not in range(128)

@popey - thanks for the report. Can you also give the libreoffice denials?

@jdstrand tricky as they’re all just a list of denials about files in my ~/Downloads folder. For example:

 = AppArmor =
Time: Nov  6 16:57:50
Log: apparmor="ALLOWED" operation="open" profile="libreoffice-soffice" name=2F686F6D652F616C616E2F446F63756D656E74732F4170706C69636174696F6E7320746F2074617267657420736E6170 pid=10693 comm="pool-soffice" re
quested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
File: /home/alan/Documents/Applications to target snap (read)
Suggestion:
* add 'home' to 'plugs'

I’ve seen this in other python apps. I believe it’s trying to coerce the unicode character 0x00C0 (á) into ASCII resulting in 0x00 (null) and 0xC0 ( in the extended ASCII table sometimes known as the ANSI table) characters of which 0xC0 is the failing one because it has a decimal value of 192 which is larger than the ASCII set’s maximum value of 128.

ref: https://en.wikipedia.org/wiki/C0_and_C1_control_codes

Unsurprisingly I do have filenames with unicode characters in them which may have triggered it. Files like this.

'Screenshot_2019-10-30 Edit monolith Snap packages Alan Pope 🍺🐧🐱 🦄.png'

1 Like

image

FYI, I am able to reproduce this in the snap, but not a system with a newer python3. I’ll work through that difference and update the tool accordingly.

Just pushed a change that should resolve this:

$ sudo snappy-debug
INFO: Following '/var/log/syslog'. If have dropped messages, use:
INFO: $ sudo journalctl --output=short --follow --all | sudo snappy-debug
kernel.printk_ratelimit = 0
= AppArmor =
Time: Nov 26 15:31:41
Log: apparmor="DENIED" operation="open" profile="snap.hello-world.sh" name=2F7661722F746D702FC3A1 pid=7992 comm="cat" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
File: /var/tmp/á (read)
Suggestion:
* adjust program to use TMPDIR or /tmp

Will need 0.35-snapd2.42.2+git which is on its way to edge.

1 Like