Bug 7754 - tl-sso-password can print errors if target exits quickly
Summary: tl-sso-password can print errors if target exits quickly
Status: NEW
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: VSM Agent (show other bugs)
Version: trunk
Hardware: PC Unknown
: P2 Normal
Target Milestone: LowPrio
Assignee: Bugzilla mail exporter
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-26 15:49 CEST by Pierre Ossman
Modified: 2024-02-14 09:01 CET (History)
1 user (show)

See Also:
Acceptance Criteria:


Attachments

Description Pierre Ossman cendio 2021-08-26 15:49:41 CEST
You normally use tl-sso-password (or tl-sso-passphrase) as such:

> $ tl-sso-password | command --password-on-stdin

However if "command" exits very quickly then tl-sso-password will not have a functional pipe to write to and results in:

> $ tl-sso-password | echo
> 
> Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
> BrokenPipeError: [Errno 32] Broken pipe

(echo is used because it closes stdin right away)

This is not a regression from converting to Python 3, as the same thing happens in 4.12.1:

> $ tl-sso-password | echo
> 
> close failed in file object destructor:
> sys.excepthook is missing
> lost sys.stderr

It does however seem to be more likely in ThinLinc 4.13.0 as we're getting the following on a Scientific Linux 7.9 system:

> Running /opt/thinlinc/etc/xstartup.d/01-tl-kinit.sh (Obtaining Kerberos ticket)
> kinit: Configuration file does not specify default realm when parsing name cendio
> Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
> BrokenPipeError: [Errno 32] Broken pipe

But when using ThinLinc 4.12.1 there is no such crash.


This behaviour is discussed upstream here:

https://bugs.python.org/issue11380

To handle this is seems like we should do a manual flush of stdout and be prepared for BrokenPipeError.

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