maintainer-feedback requested: [Bug 270496] ports-mgmt/pkg: Broken JSON with -o EVENT_PIPE

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 28 Mar 2023 14:44:38 UTC
Bugzilla Automation <bugzilla@FreeBSD.org> has asked freebsd-pkg (Nobody)
<pkg@FreeBSD.org> for maintainer-feedback:
Bug 270496: ports-mgmt/pkg: Broken JSON with -o EVENT_PIPE
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270496



--- Description ---
We're using a fork of the pkgng module in ansible.
Our fork uses '-o EVENT_PIPE' to parse the output from pkg.

Our module sometimes fails with a JSONDecodeError and I've tracked it down to
this output from pkg:

'{ "type": "INFO_INSTALL_FINISHED", "data": { "pkgname": "php81-sysvsem",
"pkgversion": "8.1.17", "message": "[{"message":"This file has been added to
automatically load the installed
extension:\n/usr/local/etc/php/ext-20-sysvsem.ini","type":"install"}]"}}'

I assume the problem is the quotes around the array in data.message