xorg-server: Changes to 'debian-experimental'
debian/changelog | 3 +++
debian/local/xvfb-run | 32 +++++++++++++++++++++-----------
2 files changed, 24 insertions(+), 11 deletions(-)
New commits:
commit 81e2cbb3dea9ca293d22a3dfc56724513350cfbb
Author: Kees Cook <kees@debian.org>
Date: Wed Nov 25 17:48:44 2009 +0100
xvfb-run: make concurrent invocations work
Using xvfb-run multiple times concurrently can fail if both get the same
display number. Retry a few times to fix this.
diff --git a/debian/changelog b/debian/changelog
index 7477666..daa31b3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,9 @@ xorg-server (2:1.7.0-2) UNRELEASED; urgency=low
replacing our Turn-on-ModeDebug-by-default.patch.
* Number our patches to make it easier to keep track of things. Requested
by the Ubuntu folks.
+ * xvfb-run: retry a few times if Xvfb can't be started when using
+ --auto-servernum, to make concurrent invocations work (closes: #521075).
+ Thanks, Kees Cook!
-- Julien Cristau <jcristau@debian.org> Sun, 04 Oct 2009 17:39:13 +0200
diff --git a/debian/local/xvfb-run b/debian/local/xvfb-run
index 4c2f4e0..cec120c 100644
--- a/debian/local/xvfb-run
+++ b/debian/local/xvfb-run
@@ -109,7 +109,7 @@ eval set -- "$ARGS"
while :; do
case "$1" in
- -a|--auto-servernum) SERVERNUM=$(find_free_servernum) ;;
+ -a|--auto-servernum) SERVERNUM=$(find_free_servernum); AUTONUM="yes" ;;
-e|--error-file) ERRORFILE="$2"; shift ;;
-f|--auth-file) AUTHFILE="$2"; shift ;;
-h|--help) SHOWHELP="yes" ;;
@@ -148,22 +148,32 @@ trap clean_up EXIT
# directory to house one.
if [ -z "$AUTHFILE" ]; then
XVFB_RUN_TMPDIR="$(mktemp -d -t $PROGNAME.XXXXXX)"
- AUTHFILE="$XVFB_RUN_TMPDIR/Xauthority"
+ # Create empty file to avoid xauth warning
+ AUTHFILE=$(tempfile -n "$XVFB_RUN_TMPDIR/Xauthority")
fi
# Start Xvfb.
MCOOKIE=$(mcookie)
-XAUTHORITY=$AUTHFILE xauth source - << EOF >>"$ERRORFILE" 2>&1
+tries=10
+while [ $tries -gt 0 ]; do
+ tries=$(( $tries - 1 ))
+ XAUTHORITY=$AUTHFILE xauth source - << EOF >>"$ERRORFILE" 2>&1
add :$SERVERNUM $XAUTHPROTO $MCOOKIE
EOF
-XAUTHORITY=$AUTHFILE Xvfb ":$SERVERNUM" $XVFBARGS $LISTENTCP >>"$ERRORFILE" \
- 2>&1 &
-XVFBPID=$!
-sleep "$STARTWAIT"
-if ! kill -0 $XVFBPID 2>/dev/null; then
- echo "Xvfb failed to start" >&2
- exit 1
-fi
+ XAUTHORITY=$AUTHFILE Xvfb ":$SERVERNUM" $XVFBARGS $LISTENTCP >>"$ERRORFILE" 2>&1 &
+ XVFBPID=$!
+
+ sleep "$STARTWAIT"
+ if kill -0 $XVFBPID 2>/dev/null; then
+ break
+ elif [ -n "$AUTONUM" ]; then
+ # The display is in use so try another one (if '-a' was specified).
+ SERVERNUM=$(find_free_servernum)
+ continue
+ fi
+ error "Xvfb failed to start" >&2
+ exit 1
+done
# Start the command and save its exit status.
set +e
Reply to: