From: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] daemonlib.sh: call tty before executing service
Date: Fri, 21 Jun 2019 18:26:41 +0800 [thread overview]
Message-ID: <5D0CB0E1.8020205@cn.fujitsu.com> (raw)
In-Reply-To: <1766730430.29482900.1561112032870.JavaMail.zimbra@redhat.com>
> ----- Original Message -----
>> On my machine, polkit-0.112-22.el7.x86_64 has contained the [1] patch.
>>
>> This patch leads service acitons(such as restart) don't stop if it doesn't
>> find controlling terminal. Even the service has been executed successfully.
>> You can reproduce it with the following code:
>>
>> test.sh
>> ----------------------------------------------
>> echo "restart daemon"
>> systemctl restart rsyslog.service>/dev/null 2>&1
>> echo "restart success"
>> ----------------------------------------------
>> ./test.sh& (it doesn't stop)
>> restart daemon
>>
>> ps -auxf
>> --------------------------------------------------
>> .... pts/1 T \_ /bin/bash ./test.sh
>> .... pts/1 T \_ systemctl restart rsyslog.service
>> .... pts/1 Tl \_ /usr/bin/pkttyagent --notify-fd 6
>> -------------------------------------------------
>>
>> /var/log/secure
>> ------------------------------------------------
>> polkitd[1310]: Registered Authentication Agent for unix-process:18472:252325
>> (system bus name :1.105 [/usr/bin/pkttyagent --notify-fd 6 --fallback],
>> object
>> path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
>> ------------------------------------------------
>>
>> This change leads to syslog[1-10] testcase hang. I fix it by adding tty
>> beforce
>> service, so these cases don't hang.
> Bug 1711536 - polkit-0.112-22.el7 breaks restarting services from background process
> https://bugzilla.redhat.com/show_bug.cgi?id=1711536
>
> Not sure though we should be adding workarounds for what seems like a bug.
Hi Jan
I also think it may be a polkit rpm bug because this action is too abnormal.
Or, we can ask polkit mantainer about it on gitlab.
Regards
Yang Xu
> Regards,
> Jan
>
>> (pkttyagent: PolkitAgentTextListener leaves echo tty disabled if
>> SIGINT/SIGTERM)
>> [1]https://gitlab.freedesktop.org/polkit/polkit/commit/bfb722bbe5a503095cc7e860f282b142f5aa75f1
>>
>> Signed-off-by: Yang Xu<xuyang2018.jy@cn.fujitsu.com>
>> ---
>> testcases/lib/daemonlib.sh | 24 ++++++++++++------------
>> 1 file changed, 12 insertions(+), 12 deletions(-)
>>
>> diff --git a/testcases/lib/daemonlib.sh b/testcases/lib/daemonlib.sh
>> index 0de3f86af..5807cbea0 100644
>> --- a/testcases/lib/daemonlib.sh
>> +++ b/testcases/lib/daemonlib.sh
>> @@ -47,43 +47,43 @@ fi
>> start_daemon()
>> {
>> if [ $HAVE_SYSTEMCTL -eq 1 ]; then
>> - systemctl start $1.service> /dev/null 2>&1
>> + tty | systemctl start $1.service> /dev/null 2>&1
>> elif command -v service>/dev/null 2>&1; then
>> - service $1 start> /dev/null 2>&1
>> + tty | service $1 start> /dev/null 2>&1
>> else
>> - /etc/init.d/$1 start> /dev/null 2>&1
>> + tty |/etc/init.d/$1 start> /dev/null 2>&1
>> fi
>> }
>>
>> stop_daemon()
>> {
>> if [ $HAVE_SYSTEMCTL -eq 1 ]; then
>> - systemctl stop $1.service> /dev/null 2>&1
>> + tty | systemctl stop $1.service> /dev/null 2>&1
>> elif command -v service>/dev/null 2>&1; then
>> - service $1 stop> /dev/null 2>&1
>> + tty | service $1 stop> /dev/null 2>&1
>> else
>> - /etc/init.d/$1 stop> /dev/null 2>&1
>> + tty | /etc/init.d/$1 stop> /dev/null 2>&1
>> fi
>> }
>>
>> status_daemon()
>> {
>> if [ $HAVE_SYSTEMCTL -eq 1 ]; then
>> - systemctl is-active $1.service> /dev/null 2>&1
>> + tty | systemctl is-active $1.service> /dev/null 2>&1
>> elif command -v service>/dev/null 2>&1; then
>> - service $1 status> /dev/null 2>&1
>> + tty | service $1 status> /dev/null 2>&1
>> else
>> - /etc/init.d/$1 status> /dev/null 2>&1
>> + tty | /etc/init.d/$1 status> /dev/null 2>&1
>> fi
>> }
>>
>> restart_daemon()
>> {
>> if [ $HAVE_SYSTEMCTL -eq 1 ]; then
>> - systemctl restart $1.service> /dev/null 2>&1
>> + tty | systemctl restart $1.service> /dev/null 2>&1
>> elif command -v service>/dev/null 2>&1; then
>> - service $1 restart> /dev/null 2>&1
>> + tty | service $1 restart> /dev/null 2>&1
>> else
>> - /etc/init.d/$1 restart> /dev/null 2>&1
>> + tty | /etc/init.d/$1 restart> /dev/null 2>&1
>> fi
>> }
>> --
>> 2.18.1
>>
>>
>>
>>
>> --
>> Mailing list info: https://lists.linux.it/listinfo/ltp
>>
>
> .
>
next prev parent reply other threads:[~2019-06-21 10:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-21 9:53 [LTP] [PATCH] daemonlib.sh: call tty before executing service Yang Xu
2019-06-21 10:13 ` Jan Stancek
2019-06-21 10:26 ` Yang Xu [this message]
2019-08-01 9:20 ` Yang Xu
2019-08-01 11:38 ` Jan Stancek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5D0CB0E1.8020205@cn.fujitsu.com \
--to=xuyang2018.jy@cn.fujitsu.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox