X Strike Force XFree86 SVN commit: r1506 - in trunk/debian: . local
Author: branden
Date: 2004-06-03 12:34:39 -0500 (Thu, 03 Jun 2004)
New Revision: 1506
Modified:
trunk/debian/CHANGESETS
trunk/debian/changelog
trunk/debian/local/xvfb-run
trunk/debian/local/xvfb-run.1
Log:
Modify xvfb-run to create a temporary directory (respecting $TMPDIR) in
addition to temporary file for the X authority file; this way we do not
have to worry about whether xauth(1x) manages the authority file in a
secure fashion. Also, if the user specifies an authority file to use, do
not create it or remove it. Document these changes in behavior in
xvfb-run's manual page.
(cosmetic) Perform minor shell style cleanup on xvfb-run.
Modified: trunk/debian/CHANGESETS
===================================================================
--- trunk/debian/CHANGESETS 2004-06-03 16:34:14 UTC (rev 1505)
+++ trunk/debian/CHANGESETS 2004-06-03 17:34:39 UTC (rev 1506)
@@ -50,4 +50,12 @@
configuration file to standard output.
1505
+Modify xvfb-run to create a temporary directory (respecting $TMPDIR) in
+addition to temporary file for the X authority file; this way we do not
+have to worry about whether xauth(1x) manages the authority file in a
+secure fashion. Also, if the user specifies an authority file to use, do
+not create it or remove it. Document these changes in behavior in
+xvfb-run's manual page.
+ 1506
+
vim:set ai et sts=4 sw=4 tw=80:
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2004-06-03 16:34:14 UTC (rev 1505)
+++ trunk/debian/changelog 2004-06-03 17:34:39 UTC (rev 1506)
@@ -59,8 +59,15 @@
manpage. This option instructs dexconf to write the generated
configuration file to standard output.
- -- Branden Robinson <branden@debian.org> Thu, 3 Jun 2004 11:32:26 -0500
+ * Modify xvfb-run to create a temporary directory (respecting $TMPDIR) in
+ addition to temporary file for the X authority file; this way we do not
+ have to worry about whether xauth(1x) manages the authority file in a
+ secure fashion. Also, if the user specifies an authority file to use, do
+ not create it or remove it. Document these changes in behavior in
+ xvfb-run's manual page.
+ -- Branden Robinson <branden@debian.org> Thu, 3 Jun 2004 12:30:25 -0500
+
xfree86 (4.3.0.dfsg.1-4) unstable; urgency=medium
* The "thanks for the 'testing'" release.
Modified: trunk/debian/local/xvfb-run
===================================================================
--- trunk/debian/local/xvfb-run 2004-06-03 16:34:14 UTC (rev 1505)
+++ trunk/debian/local/xvfb-run 2004-06-03 17:34:39 UTC (rev 1506)
@@ -14,7 +14,7 @@
PROGNAME=xvfb-run
SERVERNUM=99
-AUTHFILE=$(tempfile -s .xfvb-run)
+AUTHFILE=
ERRORFILE=/dev/null
STARTWAIT=3
XVFBARGS="-screen 0 640x480x8"
@@ -82,7 +82,10 @@
-s|--server-args) XVFBARGS="$2"; shift ;;
-w|--wait) STARTWAIT="$2"; shift ;;
--) shift; break ;;
- *) echo "$PROGNAME: error while parsing option \"$1\"" >&2; USAGE=$(usage); echo "$USAGE" >&2; exit 1 ;;
+ *) echo "$PROGNAME: error while parsing option \"$1\"" >&2
+ usage >&2
+ exit 1
+ ;;
esac
shift
done
@@ -93,17 +96,28 @@
fi
if [ -z "$*" ]; then
- echo "$PROGNAME: need a command to run" >&2
+ echo "$PROGNAME: need a command to run; aborting" >&2
exit 2
fi
if ! which xauth > /dev/null; then
- echo "$PROGNAME: xauth command not found; exiting." >&2
+ echo "$PROGNAME: xauth command not found; aborting" >&2
exit 3
fi
+# If the user did not specify an X authorization file to use, set up a
+# temporary directory to house one.
+if [ -z "$AUTHFILE" ]; then
+ XVFB_RUN_TMPDIR="${TMPDIR:-/tmp}/$PROGNAME.$$"
+ if ! mkdir -p -m 700 "$XVFB_RUN_TMPDIR"; then
+ echo "$PROGNAME: temporary directory $XVFB_RUN_TMPDIR already exists;"
+ "aborting" >&2
+ exit 4
+ fi
+ AUTHFILE=$(tempfile -n "$XVFB_RUN_TMPDIR/Xauthority")
+fi
+
# start Xvfb
-rm -f $AUTHFILE
MCOOKIE=$(mcookie)
XAUTHORITY=$AUTHFILE xauth add :$SERVERNUM $XAUTHPROTO $MCOOKIE > $ERRORFILE 2>&1
XAUTHORITY=$AUTHFILE Xvfb :$SERVERNUM $XVFBARGS $LISTENTCP > $ERRORFILE 2>&1 &
@@ -121,7 +135,12 @@
# clean up
XAUTHORITY=$AUTHFILE xauth remove :$SERVERNUM > $ERRORFILE 2>&1
-rm $AUTHFILE
+if [ -n "$XVFB_RUN_TMPDIR" ]; then
+ if ! rm -r "$XVFB_RUN_TMPDIR"; then
+ echo "$PROGNAME: error while cleaning up temporary directory" >&2
+ exit 5
+ fi
+fi
# return the executed command's exit status
exit $RETVAL
Modified: trunk/debian/local/xvfb-run.1
===================================================================
--- trunk/debian/local/xvfb-run.1 2004-06-03 16:34:14 UTC (rev 1505)
+++ trunk/debian/local/xvfb-run.1 2004-06-03 17:34:39 UTC (rev 1506)
@@ -15,7 +15,7 @@
.\" the Debian operating system, in /usr/share/common-licenses/GPL; if
.\" not, write to the Free Software Foundation, Inc., 59 Temple Place,
.\" Suite 330, Boston, MA 02111-1307 USA
-.TH xvfb\-run 1 "2003\-08\-05" "Debian Project"
+.TH xvfb\-run 1 "2004\-06\-03" "Debian Project"
.SH NAME
xvfb\-run \- run specified X client or command in a virtual X server environment
.SH SYNOPSIS
@@ -33,7 +33,8 @@
X server environment.
.PP
.B xvfb\-run
-sets up an X authority file, writes a cookie to it (see
+sets up an X authority file (or uses an existing user\-specified one),
+writes a cookie to it (see
.BR xauth (1x))
and then starts the
.B Xvfb
@@ -51,7 +52,8 @@
exits, its status is saved, the
.B Xvfb
server is killed (using the process ID stored earlier), the X authority
-cookie removed, and the authority file deleted.
+cookie removed, and the authority file deleted (if the user did not specify
+one to use).
.B xvfb\-run
then exits with the exit status of
.IR command.
@@ -79,9 +81,18 @@
.BI \-f\ file \fR,\fB\ \-\-auth\-file= file
Store X authentication data in
.IR file .
-By default, a temporary file created by the
+By default, a temporary directory called
+.IR xvfb\-run. PID
+(where PID is the process ID of
+.B xvfb\-run
+itself) is created in the directory specified by the environment variable
+.B TMPDIR
+(or
+.I /tmp
+if that variable is null or unset), and the
.BR tempfile (1)
-command is used, and given a suffix of \(oq.xvfb-run\(cq.
+command is used to create a file in that temporary directory called
+.IR Xauthority .
.TP
.B \-h\fR,\fB \-\-help
Display a usage message and exit.
@@ -133,23 +144,28 @@
seconds after launching
.B Xvfb
before attempting to start the specified command. Defaults to 3.
-'\" .SH ENVIRONMENT
-'\" None.
+.SH ENVIRONMENT
+.TP
+.B TMPDIR
+specifies the directory in which to place
+.BR xvfb\-run 's
+temporary directory for storage of the X authority file; only used if the
+\-f or \-\-auth\-file options are not specified.
'\" .SH INPUT FILES
'\" None.
.SH FILES
.PP
-A temporary file is created (and deleted) to store the X authority cookies
-used by the
+Unless the \-f or \-\-auth\-file options are specified, a temporary
+directory and file within it are created (and deleted) to store the X
+authority cookies used by the
.B Xvfb
server and client(s) run under it. See
.BR tempfile (1).
-Alternatively, the name of the file to be used for this purpose can be
-specified with the
-.B \-f
-or
-.B \-\-auth\-file
-options; see above.
+If \-f or \-\-auth\-file are used, then the specified X authority file is
+only written to, not created or deleted (though
+.B xauth
+creates an authority file itself if told to use use that does not already
+exist).
.PP
An error file with a user\-specified name is also created if the
.B \-e
Reply to: