Hello Chris, or anyone else affected, Accepted tree into questing-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/tree/2.2.1-1ubuntu0.1 in a few hours, and then in the -proposed repository.
Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users. If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed- questing to verification-done-questing. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-questing. In either case, without details of your testing we will not be able to proceed. Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping! N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days. ** Changed in: tree (Ubuntu Plucky) Status: New => Fix Committed ** Tags added: verification-needed-plucky -- 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: Fix Released Status in tree source package in Jammy: Fix Committed Status in tree source package in Noble: Fix Committed Status in tree source package in Plucky: Fix Committed Status in tree source package in Questing: Fix Committed Bug description: [Impact] When using tree with JSON (-J) or XML (-X) output on a nonexistent directory, the generated output is malformed - missing required opening tags/braces and fields. This makes the output invalid and unusable for tools or scripts that parse it. The fix ensures proper initialisation of markup output objects, restoring valid JSON and XML generation. [Test Plan] 1. Start a fresh container and install `tree` and `jq`. 2. Run the following command to check the JSON output: ```sh tree -J /nonexistentdir --noreport | jq ``` If the bug is present, the following error message will be printed: ``` jq: parse error: Expected value before ',' at line 2, column 1 ``` 3. Run this command to check the XML output: ```sh tree -X /nonexistentdir --noreport ``` If the bug is present, the following error message will be printed: ``` Error: XML syntax error on line 4: unexpected end element </unknown> ``` 4. To verify that the command works when it's run against an existing directory, run the following: ```sh mkdir -p /tmp/testdir/foo [ $(tree -J /tmp/testdir/ | jq '.[0].contents[0].name') == '"foo"' ] || echo "test failed" [ "$(tree -X /tmp/testdir/ | xq -q 'tree > directory > directory' -a name)" == 'foo' ] || echo "test failed" ``` 5. Run `tree` without any option: ```sh tree /tmp/testdir/ ``` The successful execution of the command should produce the following output: ``` /tmp/testdir/ └── foo 2 directories, 0 files ``` [Where problems could occur] The change affects how error cases are printed for invalid or inaccessible directories. Potential regressions could include incorrect JSON/XML or general command output format when running `tree` against existing directories, which is addressed in the testplan. [Original report] 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

