I was supposed to just triage this, but this looked like a nice, easy way to end the day on a win, so I just went ahead and investigated. The regression was introduced in 2.0.0 when the upstream author did a major refactoring. I wrote the smallest fix I could come up with, and sent the patch to the upstream author (literally, sending them an email — ah, the good old days...).
Attached is said patch. I'm waiting for their feedback before uploading, but if someone wants to jump ahead go for it! ** Patch added: "0001-tree-list-call-printinfo-on-error-cases-too.patch" https://bugs.launchpad.net/ubuntu/+source/tree/+bug/2113790/+attachment/5883260/+files/0001-tree-list-call-printinfo-on-error-cases-too.patch ** Changed in: tree (Ubuntu) Status: Confirmed => Triaged ** Changed in: tree (Ubuntu) Assignee: (unassigned) => Simon Chopin (schopin) -- You received this bug notification because you are a member of Debcrafters packages, which is subscribed to tree in Ubuntu. https://bugs.launchpad.net/bugs/2113790 Title: JSON and XML output broken if path invalid Status in tree package in Ubuntu: Triaged Bug description: using tree, if the target folder does not exist then the JSON or XML output options are broken. XML output (using input flag -X) has no open tag for the name field and a random close tag for 'unknown'. JSON output (using input flag -J) creates an array, the JSON object in the array has no open bracket and the entire 'type' key/value pair is missing. This makes the JSON object in the array start with a comma. This issue was discovered on Ubuntu 24.04.2 LTS using tree version v2.1.1 Functionality is correct and as expected on another machine running Ubuntu 18.04.5 LTS using tree version v1.7.0 Unfortunately I do not have another machine with anything newer than 18.04.5 to test when the issue first appeared. --------------------------------------------------------- 1.) $ lsb_release -rd No LSB modules are available. Description: Ubuntu 24.04.2 LTS Release: 24.04 2.) $ lsb_release -rd No LSB modules are available. Description: Ubuntu 24.04.2 LTS Release: 24.04 showhq@showhq-2025:/usr/lib/cgi-bin/tech$ tree --version tree v2.1.1 © 1996 - 2023 by Steve Baker, Thomas Moore, Francesc Rocher, Florian Sesser, Kyosuke Tokoro showhq@showhq-2025:/usr/lib/cgi-bin/tech$ apt-cache policy tree tree: Installed: 2.1.1-2ubuntu3 Candidate: 2.1.1-2ubuntu3 Version table: *** 2.1.1-2ubuntu3 500 500 http://us.archive.ubuntu.com/ubuntu noble/universe amd64 Packages 100 /var/lib/dpkg/status 3.) Expected: same as v1.7.0 - valid JSON with the -J flag and valid XML with the -X flag. 4.) Reality: Invalid JSON and XML To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/tree/+bug/2113790/+subscriptions -- Mailing list: https://launchpad.net/~debcrafters-packages Post to : [email protected] Unsubscribe : https://launchpad.net/~debcrafters-packages More help : https://help.launchpad.net/ListHelp

