Bug 12448 - xinit's startx tries to trap 'ERR'
Summary: xinit's startx tries to trap 'ERR'
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: App/xinit (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-16 14:25 UTC by Tilman Sauerbeck
Modified: 2011-10-15 22:37 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Don't try to trap 'ERR' (449 bytes, patch)
2007-09-16 14:29 UTC, Tilman Sauerbeck
no flags Details | Splinter Review

Description Tilman Sauerbeck 2007-09-16 14:25:05 UTC
b9d07ef3e07ef6f00a2f1cc730a481e5e1291f5b added the following line to the startx script:

trap "rm -f $xserverauthfile" ERR HUP INT QUIT ILL TRAP KILL BUS TERM
                              ^^^

startx is advertised as being a POSIX shell script, but POSIX compatible shells don't need to handle ERR in trap (there's no SIGERR).
This change causes startx to fail if dash is used for /bin/sh.
Comment 1 Tilman Sauerbeck 2007-09-16 14:29:09 UTC
Created attachment 11593 [details] [review]
Don't try to trap 'ERR'

Matthieu, is this patch okay with you?
Comment 2 Matthieu Herrb 2007-09-16 22:56:46 UTC
(In reply to comment #1)
> Created an attachment (id=11593) [details]
> Don't try to trap 'ERR'
> 
> Matthieu, is this patch okay with you?
> 

Sure, at least as a temporarly way to fix the issue. 

When I'll have some time to revisit the issue, I'll add some autoconf magic 
to detect if a bourne-like shell with ERR support is available and use it 
in that case. At least for my case, ERR was one of the main reason that causes startx to leave .serverauth files around. 
Comment 3 Brice Goglin 2007-09-16 23:06:15 UTC
We had several people request an automatic way to remove serverauth files in Debian too. But the most annoying problem was actually in case of hard reboot. And you have no way to trap this. So we just moved serverauth files to a temporary file in /tmp so that they are automatically cleaned on reboot (at least on Linux).
Comment 4 Tilman Sauerbeck 2007-09-16 23:34:20 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > Created an attachment (id=11593) [details] [details]
> > Don't try to trap 'ERR'
> > 
> > Matthieu, is this patch okay with you?
> > 
> 
> Sure, at least as a temporarly way to fix the issue. 

Committed in 52121e9de907c61a16e41f0f08acecc1dc1546e5.
I'll roll 1.0.7 later today.

> When I'll have some time to revisit the issue, I'll add some autoconf magic 
> to detect if a bourne-like shell with ERR support is available and use it 
> in that case. At least for my case, ERR was one of the main reason that causes
> startx to leave .serverauth files around. 

I'm not sure whether that will work. Say you build xinit with having bash as /bin/sh. Later you switch /bin/sh over from bash to dash, which will cause startx to break.
Comment 5 Martin Mokrejs 2009-01-30 10:27:42 UTC
This bug could be closed as the fix went into the tree, right? At least on Gentto linux with x11-apps/xinit-1.0.8-r3 the ERR trap is gone. True, I did not bother to investigate what Gentoo patches were applied. But if Tilman said it was applied ...?
Comment 6 Matthieu Herrb 2009-01-30 12:50:02 UTC
Would nice to see the patches that move the serverauth files to /tmp, but for now I'm closing this. 
Thanks for the remainder.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.