Bug 1242061

Summary: race condition in gnome-welcome-tour may prevent getting-started invocation
Product: Red Hat Enterprise Linux 7 Reporter: Vladimir Benes <vbenes>
Component: gnome-initial-setupAssignee: Matthias Clasen <mclasen>
Status: CLOSED ERRATA QA Contact: Desktop QE <desktop-qa-list>
Severity: low Docs Contact:
Priority: unspecified    
Version: 7.2CC: rmatos, tpelka, vbenes
Target Milestone: rcKeywords: TestBlocker
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: gnome-initial-setup-3.14.4-2.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 08:28:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Vladimir Benes 2015-07-10 19:27:14 UTC
Description of problem:
In gnome-initial-setup there is a script that's executed after new user is created. /usr/libexec/gnome-welcome-tour.

#! /bin/sh

cfgdir=${XDG_CONFIG_DIR:-$HOME/.config}

rm -f $cfgdir/run-welcome-tour

# Don't do anything if yelp isn't installed
yelp_path=$(which yelp 2>/dev/null)
if test -z "${yelp_path}"; then
    exit
fi

if [ ! -d $cfgdir/yelp ]; then
        mkdir $cfgdir/yelp
        cat <<EOF >>$cfgdir/yelp/yelp.cfg
[documents/help%3Agnome-help]
geometry=(1024, 709)
EOF
fi

yelp help:gnome-help/getting-started


I think this part:
cfgdir=${XDG_CONFIG_DIR:-$HOME/.config}

can be in some cases started too soon and cfgdir variable is not set and thus script crashes and thus yelp with getting started documentation is not executed.

I've added sleep 1 to the beginning of the script and it seems to help.t

Version-Release number of selected component (if applicable):
gnome-shell-3.14.4-13.el7.x86_64
gdm-3.14.2-5.el7.x86_64
gnome-initial-setup-3.14.4-1.el7.x86_64

How reproducible:
50% in automation

Steps to Reproduce:
1.delete all users and start gdm service
2.select lenguage, keyboard, timezone
3.add user and password
4.start using RHEL

Actual results:
sometimes, yelp is not shown

Expected results:
yelp should be always shown

Additional info:

Comment 2 Matthias Clasen 2015-07-13 11:13:59 UTC
I'm not sure I understand.
"The script crashes" means what exactly ?
What line fails, and in what way ?

Comment 3 Vladimir Benes 2015-07-13 11:55:36 UTC
(In reply to Matthias Clasen from comment #2)
> I'm not sure I understand.
we were debugging this with Rui and he was quite confused as well but this prevents yelp to be started very likely because of undefined variable here 
cfgdir=${XDG_CONFIG_DIR:-$HOME/.config}

> "The script crashes" means what exactly ?
the script very likely just exits sooner. We tried to add printfs into every single line and it exited just in the middle see:
http://fpaste.org/242674/14365366/ (line 308)

> What line fails, and in what way ?
the script was like this
http://fpaste.org/243768/88195143/

adding 2 seconds to the beginning of the script was just enough to make it passing. Not sure what was wrong. But it seems like same race condition that can be fixed with just a second or two just after /bin/sh line

Comment 4 Matthias Clasen 2015-07-15 14:48:31 UTC
Ray and I looked at this today, and reproduced the problem in two ways by tweaking the gnome-welcome-tour script:

1) adding a sufficient sleep after the rm -rf ~/.config/run-welcome-tour

2) changing the yelp call at the end to exec yelp ...

The race condition here is between the script removing the run-welcome-tour and then proceeding to launch yelp, and gnome-session monitoring the existence of the run-welcome-tour file and killing the autostarted script when the file disappears.

A simple fix is to delay removing the run-welcome-tour file until yelp is launched.

Comment 6 Vladimir Benes 2015-07-17 13:20:28 UTC
Working well now, no failure in ~80 times executed user add test. Thanks!

Comment 7 Tomas Pelka 2015-09-17 12:11:47 UTC
Moving to verified based on c6.

Comment 9 errata-xmlrpc 2015-11-19 08:28:33 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2157.html