Bug 7940 - tl-config crashes when printing contents of a folder with trailing slash
Summary: tl-config crashes when printing contents of a folder with trailing slash
Status: CLOSED FIXED
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Misc (show other bugs)
Version: trunk
Hardware: PC Unknown
: P2 Normal
Target Milestone: 4.17.0
Assignee: Samuel Mannehed
URL:
Keywords: adaha_tester, relnotes
Depends on:
Blocks:
 
Reported: 2022-05-31 14:31 CEST by Linn
Modified: 2024-06-19 12:45 CEST (History)
3 users (show)

See Also:
Acceptance Criteria:
MUST: * Using tl-config with either a path ending with a slash, or a path not ending with a slash must work. SHOULD: * Any fixes to hiveconf should be pushed upstream. COULD: * The customer who suggested a solution could be notified that the fix will be included in the upcoming release.


Attachments

Description Linn cendio 2022-05-31 14:31:38 CEST
This is a regression from 4.13.0, 'tl-config -a /vsm/' works in 4.12.1 but after the Python3 conversion:

> [cendio@lab-87 ~]$ /opt/thinlinc/bin/tl-config -a /vsm/
> Traceback (most recent call last):
>   File "/opt/thinlinc/bin/../bin/hivetool", line 309, in <module>
>     main()
>   File "/opt/thinlinc/bin/../bin/hivetool", line 304, in main
>     print_walk(hive, foldername, recursive)
>   File "/opt/thinlinc/bin/../bin/hivetool", line 165, in print_walk
>     value = safe_string(value)
>   File "/opt/thinlinc/bin/../bin/hivetool", line 18, in safe_string
>     return s.encode(enc, errors="replace").decode(enc)
> AttributeError: 'NoneType' object has no attribute 'encode'

This commit looks suspicious: r37284
Comment 3 Samuel Mannehed cendio 2023-09-27 16:23:50 CEST
Note that we must remember to push fixes to hiveconf upstream.
Comment 7 Samuel Mannehed cendio 2024-05-13 11:53:27 CEST
> MUST:
> * Using tl-config with either a path ending with a slash, or a path not ending with a slash must work.
It works now. Tested build 3584 on Fedora 39.

> SHOULD:
> * Any fixes to hiveconf should be pushed upstream.
https://github.com/astrand/hiveconf/pull/2

> COULD:
> * The customer who suggested a solution could be notified that the fix will be included in the upcoming release.
I sent him an email.
Comment 8 Adam Halim cendio 2024-05-14 14:45:30 CEST
Tested the following using 4.16.0 and build 3585 on RHEL 9:
========

Crashed on 4.16.0 and works on build 3585:
> tl-config -a /vsm/
The following command crashed on both versions, but produces different tracebacks.

4.16.0:
> tl-config -R -a /vsm/
>   File "/opt/thinlinc/bin/../bin/hivetool", line 322, in <module>
>     main()
>   File "/opt/thinlinc/bin/../bin/hivetool", line 317, in main
>     print_walk(hive, foldername, recursive)
>   File "/opt/thinlinc/bin/../bin/hivetool", line 168, in print_walk
>     value = safe_string(value)
>   File "/opt/thinlinc/bin/../bin/hivetool", line 18, in safe_string
>     return s.encode(enc, errors="replace").decode(enc)
> AttributeError: 'NoneType' object has no attribute 'encode'
Build 3585:
> tl-config -R -a /vsm/
> setup_completed = 
> vsm_server_port = 9000
> vsm_agent_port = 904
> vnc_port_base = 5900
> tunnel_bind_base = 4900
> tunnelslots_per_session = 10
> Traceback (most recent call last):
>   File "/opt/thinlinc/bin/../bin/hivetool", line 583, in <module>
>     main()
>   File "/opt/thinlinc/bin/../bin/hivetool", line 578, in main
>     print_walk(hive, foldername, options.recursive)
>   File "/opt/thinlinc/bin/../bin/hivetool", line 149, in print_walk
>     section = folder.sectionname
> AttributeError: 'NoneType' object has no attribute 'sectionname'
Seems like a fix is needed in the recursive walking step.

Re-opening this bug as the first AC is not satisfied.
Comment 10 Samuel Mannehed cendio 2024-05-15 13:56:09 CEST
Fixed now.
Comment 11 Samuel Mannehed cendio 2024-05-15 16:08:50 CEST
The latest fix was also sent upstream:

https://github.com/astrand/hiveconf/pull/3
Comment 12 Adam Halim cendio 2024-05-15 16:10:38 CEST
Tested the fix, things work as intended now:
> tl-config -Ra /vsm/
> setup_completed = 
> vsm_server_port = 9000
> vsm_agent_port = 904
> vnc_port_base = 5900
> tunnel_bind_base = 4900
> tunnelslots_per_session = 10
> tunnelservices/
>     serial = 1
>     serial2 = 2
>     lpd = 3
>     nfs = 4
>     pulseaudio = 5
>     smartcard = 6

> MUST:
>     ✅ Using tl-config with either a path ending with a slash, or a path not
>        ending with a slash must work.
> 
> SHOULD:
>     ✅ Any fixes to hiveconf should be pushed upstream.
> 
> COULD:
>     ✅ The customer who suggested a solution could be notified that the fix
>        will be included in the upcoming release.
Closing as all ACs are met.

Note You need to log in before you can comment on or make changes to this bug.