[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: patch audit - 099*.diff



On Mon, Jun 27, 2005 at 22:09:39 +0200, Julien Cristau wrote:
> 099d_Imake.rules_fix_RawCppFileTarget.diff -- lost
> 099i_pro_savage_ddr_set_use_bios_to_false.diff -- lost
> 099s_selinux_support.diff -- lost
> 099t_xkb_remove_hidden_attributes.diff -- lost
> 099u_mkdirhier_rewrite.diff -- lost
> 099v_fontserver_fix_SEGV.diff -- lost
> 099x_xdm_support_logfile_rotation.diff -- lost

rediffed patches attached for all of these.

The debian/rules patch-audit target fails because of fuzz/offsets in
078_xdm_log_sourcing_better.diff and
099g_xkb_symbols_polish_fix_keypad_separator.diff 
These two patches probably need minor changes.

Cheers,
Julien Cristau
$Id: 099d_Imake.rules_fix_RawCppFileTarget.diff 1703 2004-07-29 09:52:03Z branden $

Modify CppRawFileTarget() to transform trailing backslashes in the input
manpages so the backslash is followed by a blank, defeating the C
preprocessor's tendency to remove the following newline.

This patch by Thomas Dickey.

Present in XFree86 CVS.

--- xc/config/cf/Imake.rules	2004/06/01 00:16:53	3.137
+++ xc/config/cf/Imake.rules	2004/07/18 15:10:26	3.138
@@ -3348,7 +3348,7 @@
 dst::  src deplist							@@\
 	RemoveFile($@)							@@\
 	ClearmakeOSName \
-	$(RAWCPP) CppNoLineInfoOption defs <src | CppSedMagic >$@	@@\
+	sed -e 's/\\$$/\\ /' src | $(RAWCPP) CppNoLineInfoOption defs | CppSedMagic >$@	@@\
 									@@\
 clean::									@@\
 	RemoveFiles(dst)
$Id: 099i_pro_savage_ddr_set_use_bios_to_false.diff 1925 2004-10-08 07:52:44Z fabbione $

This patch contains a workaround for the UseBIOS default setting, to fix
refresh rates detection as described here:
https://bugzilla.ubuntu.com/show_bug.cgi?id=2111
http://www.probo.com/timr/savage40.html

The patch moves the OPTION_USEBIOS configuration after the chipset is probed
and it add the two specific cases where the UseBios should be set to "no",
without user interaction.
The user will still have the option to override X_DEFAULT via configuration
file, exactly as it is now.

This is a known problem for this version of the savage driver (1.1.27t) that is
already fixed in more recent versions of it, but a full backport is not an
option since the changes are quite big.

This patch by Fabio M. Di Nitto.

diff -Narud xc.orig/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c
--- xc.orig/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c	2005-06-28 14:04:48.869520828 +0200
+++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c	2005-06-28 14:06:34.062045862 +0200
@@ -934,12 +934,14 @@
     xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n",
         psav->hwcursor ? "HW" : "SW");
 
+/*
     from = X_DEFAULT;
     psav->UseBIOS = TRUE;
     if (xf86GetOptValBool(psav->Options, OPTION_USEBIOS, &psav->UseBIOS) )
 	from = X_CONFIG;
     xf86DrvMsg(pScrn->scrnIndex, from, "%ssing video BIOS to set modes\n",
         psav->UseBIOS ? "U" : "Not u" );
+*/
 
     psav->LCDClock = 0.0;
     if( xf86GetOptValFreq( psav->Options, OPTION_LCDCLOCK, OPTUNITS_MHZ, &psav->LCDClock ) )
@@ -1038,6 +1040,19 @@
 
     xfree(pEnt);
 
+    /* set OPTION_USEBIOS according to the chipset */
+ 
+    from = X_DEFAULT;
+    if (( psav->ChipId == PCI_CHIP_PROSAVAGE_DDR ) || ( psav->ChipId == PCI_CHIP_PROSAVAGE_DDRK )) {
+	psav->UseBIOS = FALSE;
+    } else {
+    	psav->UseBIOS = TRUE;
+    }
+    if (xf86GetOptValBool(psav->Options, OPTION_USEBIOS, &psav->UseBIOS) )
+	from = X_CONFIG;
+    xf86DrvMsg(pScrn->scrnIndex, from, "%ssing video BIOS to set modes\n",
+        psav->UseBIOS ? "U" : "Not u" );
+
     /* maybe throw in some more sanity checks here */
 
     xf86DrvMsg(pScrn->scrnIndex, from, "Engine: \"%s\"\n", pScrn->chipset);
$Id: 099s_selinux_support.diff 2174 2005-02-09 07:00:07Z branden $

Add support for SELinux.  Note that this patch only adds source-level
support, and does not actually enable it.

This patch by Manoj Srivastava.  As he notes in Debian #233551:

    As implemented, the patch merely provides a capability, which
    has to be explicitly turned on at compile time with -DHasSELinux=YES.
    If one does not compile with -DHasSELinux=YES, the patch is a no-op.
    Since none of the code is compiled in, there is no change in
    behaviour, nor is there any performance hit.

    If you do turn on the SELinux compatibility with -DHasSELinux,
    you would need libselinux at build time.  In other words, the
    mainline X build does not build depend on SELinux; the dependency is
    only invoked if you explicitly pass a parameter to imake.

    Even when SELinux compatibility is compiled in, on a non
    SELinux kernel it is dead code; there is no change in functionality,
    apart from a single check to see if SELinux is available at each
    login. The SELinux code paths are not exercised on non-SELinux
    kernels.

The more permanent way to enable SELinux support is to #define HasSELinux
YES in the relevant distribution-specific section of linux.cf.  If that is
done for Debian, the source package will need to add a build-dependency on
the libselinux1-dev package.

Not submitted upstream to XFree86 or X.Org.

--- xc/config/cf/Imake.tmpl.orig	2005-06-28 14:13:19.000000000 +0200
+++ xc/config/cf/Imake.tmpl	2005-06-28 14:27:16.633462999 +0200
@@ -2134,17 +2134,21 @@
  * EXTRA_INCLUDES contains project-specific includes set in project incfiles
  * INCLUDES contains client-specific includes set in Imakefile
  * LOCAL_LDFLAGS contains client-specific ld flags flags set in Imakefile
+ * SELINUX_INCLUDES contains SELinux-specific includes set in the appropriate .cf file
+ * SELINUX_LDFLAGS contains SELinux-specific ld flags set in the appropriate .cf file
+ * SELINUX_CFLAGS contains SELinux-specific compiler flags set in the .cf file
+ * SELINUX_LIBS contains SELinux-specific libraries to link with set in the .cf file
  */
-      ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(INSTALLED_INCLUDES) $(STD_INCLUDES)
+      ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(INSTALLED_INCLUDES) $(STD_INCLUDES) $(SELINUX_INCLUDES)
        ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(MODULE_DEFINES) $(DEFINES) $(EXTRA_DEFINES)
-           CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(THREADS_CFLAGS) $(MODULE_CFLAGS) $(ALLDEFINES)
+           CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(THREADS_CFLAGS) $(SELINUX_CFLAGS) $(MODULE_CFLAGS) $(ALLDEFINES)
         LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) $(DEPEND_DEFINES)
          LDPRELIB = LdPreLib $(INSTALLED_LIBS)
         LDPOSTLIB = LdPostLib
-        LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS)  $(EXTRA_LDOPTIONS) $(THREADS_LDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIBS)
+        LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS)  $(EXTRA_LDOPTIONS) $(THREADS_LDFLAGS) $(SELINUX_LDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIBS)
      CXXLDOPTIONS = $(CXXDEBUGFLAGS) $(CXXOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_CXXLDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIBS)
 
-           LDLIBS = $(LDPOSTLIBS) $(THREADS_LIBS) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
+           LDLIBS = $(LDPOSTLIBS) $(THREADS_LIBS) $(SELINUX_LIBS) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
 #if HasBrokenCCForLink
            CCLINK = LdCmd
 #else
--- xc/config/cf/linux.cf.orig	2005-06-28 14:20:53.047608617 +0200
+++ xc/config/cf/linux.cf	2005-06-28 14:27:16.642461316 +0200
@@ -1105,3 +1105,57 @@
 #ifndef XFree86ServerOSDefines
 # define XFree86ServerOSDefines
 #endif
+
+/*
+ *     SELinux support
+ */
+#ifndef HasSELinux
+# define HasSELinux NO
+#endif
+
+#ifndef SELinuxDefines
+# if HasSELinux
+#  define SELinuxDefines -DHAVE_SELINUX
+# else
+#  define SELinuxDefines /**/
+# endif
+#endif
+
+#ifndef SELinuxIncludeFlags
+# if HasSELinux
+#   define SELinuxIncludeFlags -I/usr/include/selinux
+# else
+#   define SELinuxIncludeFlags /**/
+# endif
+#endif
+
+#ifndef SELinuxCompileFlags
+# define SELinuxCompileFlags /**/
+#endif
+
+#ifndef SELinuxLoadFlags
+# define SELinuxLoadFlags SELinuxCompileFlags
+#endif
+
+#ifndef SELinuxLibraries
+# if HasSELinux
+#  define SELinuxLibraries -lselinux
+# else
+#  define SELinuxLibraries /**/
+# endif
+#endif
+
+#if HasSELinux
+# ifndef SELINUX_LDFLAGS
+   SELINUX_LDFLAGS = SELinuxLoadFlags
+# endif
+# ifndef SELINUX_INCLUDES
+   SELINUX_INCLUDES = SELinuxIncludeFlags
+# endif
+# ifndef SELINUX_CFLAGS
+   SELINUX_CFLAGS = SELinuxCompileFlags SELinuxDefines
+# endif
+# ifndef SELINUX_LIBS
+   SELINUX_LIBS = SELinuxLibraries
+# endif
+#endif
--- xc/programs/xdm/session.c.orig	2005-06-28 14:23:11.323199434 +0200
+++ xc/programs/xdm/session.c	2005-06-28 14:27:16.652459446 +0200
@@ -61,6 +61,11 @@
 # include <krb5/krb5.h>
 #endif
 
+#ifdef HAVE_SELINUX
+#include <selinux/selinux.h>
+#include <selinux/get_context_list.h>
+#endif /* HAVE_SELINUX */
+
 #ifndef GREET_USER_STATIC
 # include <dlfcn.h>
 # ifndef RTLD_NOW
@@ -242,6 +247,34 @@
     SessionExit (d, RESERVER_DISPLAY, TRUE);
 }
 
+#ifdef HAVE_SELINUX
+/* This should be run just before we exec the user session. */
+static int
+xdm_selinux_setup (const char *login)
+{
+    security_context_t scontext;
+    /* If SELinux is not enabled, then we don't do anything. */
+    if ( ! is_selinux_enabled ())
+	return TRUE;
+
+    if (get_default_context((char*) login,0, &scontext) < 0) {
+	LogError ("SELinux: unable to obtain default security context for %s\n",
+		  login);
+	return FALSE;
+    }
+
+    if (setexeccon (scontext) != 0) {
+	freecon (scontext);
+	 LogError ("SELinux: unable to set executable context %s\n",
+		   (char *)scontext);
+	return FALSE;
+  }
+
+    freecon (scontext);
+    return TRUE;
+}
+#endif /* HAVE_SELINUX */
+
 /*
  * We need our own error handlers because we can't be sure what exit code Xlib
  * will use, and our Xlib does exit(1) which matches REMANAGE_DISPLAY, which
@@ -726,6 +759,17 @@
 #endif /* K5AUTH */
 	bzero(passwd, strlen(passwd));
 	SetUserAuthorization (d, verify);
+#ifdef HAVE_SELINUX
+	/*
+	 * For Security Enhanced Linux:
+	 * set the default security context for this user.
+	 */
+	if ( ! xdm_selinux_setup (name)) {
+	    LogError ("failed to set security context\n");
+	    exit (UNMANAGE_DISPLAY);
+	    return (0);
+	}
+#endif /* HAVE_SELINUX */
 	home = getEnv (verify->userEnviron, "HOME");
 	if (home)
 	    if (chdir (home) == -1) {
$Id: 099t_xkb_remove_hidden_attributes.diff 2150 2005-01-23 22:11:50Z barbier $

The basic variant of 'us' layout was not displayed by kxkb because its
'hidden' attribute was wrongly set.

Not submitted upstream to XFree86 or X.Org.

diff -ruN xc/programs/xkbcomp/symbols/pc/us.orig xc/programs/xkbcomp/symbols/pc/us
--- xc/programs/xkbcomp/symbols/pc/us.orig	2005-06-28 14:37:40.401354349 +0200
+++ xc/programs/xkbcomp/symbols/pc/us	2005-06-28 14:37:57.977129572 +0200
@@ -3,7 +3,7 @@
 // $XFree86: xc/programs/xkbcomp/symbols/pc/us,v 1.6 2003/10/31 14:32:05 pascal Exp $
 
 default
-partial hidden alphanumeric_keys modifier_keys 
+partial alphanumeric_keys modifier_keys 
 xkb_symbols "basic" {
 
     name[Group1]= "US/ASCII";
$Id: 099u_mkdirhier_rewrite.diff 2171 2005-02-08 07:13:50Z branden $

Reimplement mkdirhier; see Debian #141347 and #232357 for some reasons why.

This shell script and manpage by Branden Robinson.

Not submitted upstream to XFree86 or X.Org.

diff -urN xc/config/util~/mkdirhier.man xc/config/util/mkdirhier.man
--- xc/config/util~/mkdirhier.man	2005-06-28 14:49:49.525017174 +0200
+++ xc/config/util/mkdirhier.man	2005-06-28 14:52:01.369990517 +0200
@@ -1,42 +1,111 @@
-.\" $Xorg: mkdirhier.man,v 1.4 2001/02/09 02:03:17 xorgcvs Exp $
-.\" Copyright (c) 1993, 1994, 1998 The Open Group
-.\" 
-.\" Permission to use, copy, modify, distribute, and sell this software and its
-.\" documentation for any purpose is hereby granted without fee, provided that
-.\" the above copyright notice appear in all copies and that both that
-.\" copyright notice and this permission notice appear in supporting
-.\" documentation.
-.\" 
-.\" The above copyright notice and this permission notice shall be included in
-.\" all copies or substantial portions of the Software.
-.\" 
-.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL 
-.\" THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
-.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 
-.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
-.\" SOFTWARE.
-.\" 
-.\" Except as contained in this notice, the name of The Open Group shall not 
-.\" be used in advertising or otherwise to promote the sale, use or other 
-.\" dealing in this Software without prior written authorization from The 
-.\" Open Group.
+.\" Copyright 2005 Branden Robinson.
 .\"
-.\" $XFree86: xc/config/util/mkdirhier.man,v 1.2 2001/01/27 18:19:55 dawes Exp $
+.\" Permission is hereby granted, free of charge, to any person obtaining a
+.\" copy of this software and associated documentation files (the "Software"),
+.\" to deal in the Software without restriction, including without limitation
+.\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
+.\" and/or sell copies of the Software, and to permit persons to whom the
+.\" Software is furnished to do so, subject to the following condition:
 .\"
-.TH MKDIRHIER 1 __xorgversion__
+.\"     The above copyright notice and this permission notice shall be
+.\"     included in all copies or substantial portions of the Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+.\" SOFTWARE IN THE PUBLIC INTEREST, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR
+.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+.\" DEALINGS IN THE SOFTWARE.
+.TH mkdirhier __mansuffix__ __xorgversion__
 .SH NAME
-mkdirhier \- makes a directory hierarchy
+mkdirhier \- create a directory hierarchy
 .SH SYNOPSIS
 .B mkdirhier
-directory ...
+.I directory
+\&...
 .SH DESCRIPTION
-The
-.I mkdirhier
-command creates the specified directories. Unlike
-.I mkdir
-if any of the parent directories of the specified directory
-do not exist, it creates them as well.
+.B mkdirhier
+creates the specified directories.
+Unlike some versions of
+.BR mkdir ,
+if any of the parent directories of the specified directory do not exist,
+.B mkdirhier
+creates them as well.
+.PP
+.B mkdirhier
+is a wrapper for
+.BR mkdir ;
+systems with
+.BR mkdir (__osmansuffix__)
+implementations conformant with the Single Unix Specification may simply
+use
+.B mkdir \-p
+instead \(em this includes all systems using the GNU Core Utilities'
+version of
+.BR mkdir .
+.SH DIAGNOSTICS
+If
+.B mkdirhier
+is not supplied with any arguments, a usage message is printed.
+.PP
+.B mkdirhier
+prefixes its diagnostic messages with the name under which it was invoked,
+followed by a colon (\(oq:\(cq) so that its messages can be distingushed
+from others.
+.TP
+.B could not create directory \(dq\fIdirectory\fP\(dq
+indicates that there was a failure while creating
+.IR directory .
+This message will likely be preceded by a diagnostic message from
+.BR mkdir .
+.SH "EXIT STATUS"
+.TP
+.B 64
+.B mkdirhier
+was not given any directory names to create.
+.PP
+.B mkdirhier
+otherwise exits with the exit status of the last
+.B mkdir
+command that failed.
+.SH BUGS
+.B mkdirhier
+does not create all the requested directories as an atomic operation;
+therefore, it is is susceptible to race conditions.
+For example, if
+.B mkdirhier
+is directed to create a hierarchy
+.I a/b/c/d
+and any of
+.IR a/ ,
+.IR b/ ,
+or
+.I c/
+do not yet exist, any of the newly-created directories can be removed
+and/or replaced by a symbolic link to another location in the window of
+time after
+.B mkdirhier
+creates a directory and the directory immediately below it.
+This means that failures can be provoked (since
+.B mkdir
+will fail to create a directory in a directory that does not already
+exist),
+or directories may be created in unexpected locations.
+The same limitation holds for multiple directory arguments to
+.BR mkdirhier ;
+given two arguments
+.I a/b/c/d
+and
+.IR a/b/c/f ,
+it is possible for the directory hierarchy
+.I a/b/c
+to be disrupted in the time between the processing of the two arguments.
+To avoid these problems, use
+.B mkdir \-p
+instead, or do not use
+.B mkdirhier
+to create directories in parts of the filesystem where untrusted users can
+manipulate them.
 .SH "SEE ALSO"
-mkdir(1)
+.BR mkdir (__osmansuffix__)
diff -urN xc/config/util~/mkdirhier.sh xc/config/util/mkdirhier.sh
--- xc/config/util~/mkdirhier.sh	2005-02-08 01:58:07.000000000 -0500
+++ xc/config/util/mkdirhier.sh	2005-02-08 02:12:37.000000000 -0500
@@ -1,67 +1,94 @@
 #!/bin/sh
-# $Xorg: mkdirhier.sh,v 1.3 2000/08/17 19:41:53 cpqbld Exp $
-# Courtesy of Paul Eggert
 
-newline='
-'
-IFS=$newline
-
-case ${1--} in
--*) echo >&2 "mkdirhier: usage: mkdirhier directory ..."; exit 1
-esac
-
-status=
-
-for directory
-do
-	case $directory in
-	'')
-		echo >&2 "mkdirhier: empty directory name"
-		status=1
-		continue;;
-	*"$newline"*)
-		echo >&2 "mkdirhier: directory name contains a newline: \`\`$directory''"
-		status=1
-		continue;;
-	///*) prefix=/;; # See Posix 2.3 "path".
-	//*) prefix=//;;
-	/*) prefix=/;;
-	-*) prefix=./;;
-	*) prefix=
-	esac
-
-	IFS=/
-	set x $directory
-	case $2 in
-	    */*)	# IFS parsing is broken
-		IFS=' '
-		set x `echo $directory | tr / ' '`
-		;;
-	esac
-	IFS=$newline
-	shift
-
-	for filename
-	do
-		path=$prefix$filename
-		prefix=$path/
-		shift
-
-		test -d "$path" || {
-			paths=$path
-			for filename
-			do
-				if [ -n "$filename" -a "$filename" != "." ]; then
-					path=$path/$filename
-					paths=$paths$newline$path
-				fi
-			done
-
-			mkdir $paths || status=$?
-
-			break
-		}
-	done
-  done
+# Copyright 2005 Branden Robinson.
 
-exit $status
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following condition:
+#
+#     The above copyright notice and this permission notice shall be
+#     included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# SOFTWARE IN THE PUBLIC INTEREST, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR
+# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+# I rewrote Paul Eggert's script in POSIX shell because it was a little
+# odd, and did not confine itself to puritantical pre-POSIX conventions.
+# For example, in one place it used:
+#   case ${1--} in
+#   -*)
+# to test for $1 being null, presumably due to fears that test -n and -z
+# will not be available.  Yet later in the script, test -n was used.
+#
+# This seemed quite silly.  I decided to rewrite it since I am arrgoant
+# enough to think I know what I'm doing in POSIX shell.
+#
+# If someone needs a pre-POSIX version of mkdirhier, they'll probably need to
+# turn to someone else, as I have no idea where such a thing is specified.
+
+set -e
+
+PROGNAME=${0##*/}
+STATUS=0
+
+usage() {
+    cat <<EOF
+usage: $PROGNAME DIRECTORY ...
+Create each directory DIRECTORY, also creating intermediate directories in the
+specified hierarchy as necessary.
+
+Note: Use "mkdir -p" instead of "$PROGNAME" if the system supports it.
+EOF
+}
+
+makedir () {
+    FUNC_STATUS=0
+    # Does the desired directory already exist?
+    if ! [ -d "$1" ]; then
+        # Is a directory hierarchy specified (i.e., are any slashes in the
+        # argument)?
+        PARENT=${1%/*}
+        if [ -n "$PARENT" ] && [ "$PARENT" != "$1" ]; then
+            # Yes; does the desired directory's immediate parent exist?
+            if ! [ -d "$PARENT" ]; then
+                # No; push it onto the stack.  If that fails, return
+                # immediately, as we know later calls will also fail.  E.g., if
+                # we are asked to create /usr/bin/foo/bar/baz/quux and
+                # /usr/bin/foo fails, we don't have to even try anything deeper
+                # in the hierarchy.
+                if ! makedir "$PARENT"; then
+                    return $FUNC_STATUS
+                fi
+            fi
+        fi
+        mkdir "$1" || FUNC_STATUS=$?
+    fi
+    return $FUNC_STATUS
+}
+
+if [ -z "$1" ]; then
+    usage >&2
+    exit 64
+fi
+
+while [ -n "$1" ]; do
+    ARG="$1"
+    makedir "$ARG" || \
+    {
+        STATUS=$?
+        echo "$PROGNAME: could not create directory \"$ARG\"" >&2
+    }
+    shift
+done
+
+exit $STATUS
+
+# vim:set ai et sts=4 sw=4 tw=80:
$Id: 099v_fontserver_fix_SEGV.diff 2243 2005-05-06 03:12:21Z branden $

Fix a SEGV in fs_read_list_info() to correctly handle a reply type of
FS_Error from fsListFontsWithXInfoReply().  This mirrors a similar check in
fs_read_open_font(), fs_read_query_info(), fs_read_extent_info(),
fs_read_glyphs(), and fs_read_list(), so why it was missing from this
function was a mystery.

This patch by Guillem Jover.  See Debian #294320.

Not submitted to XFree86 or X.Org yet.

--- xc/lib/font/fc/fserve.c~	2005-02-09 03:27:04.000000000 -0500
+++ xc/lib/font/fc/fserve.c	2005-05-05 21:39:45.000000000 -0500
@@ -2360,7 +2360,7 @@
     _fs_free_props (&binfo->info);
 
     rep = (fsListFontsWithXInfoReply *) fs_get_reply (conn, &ret);
-    if (rep == 0)
+    if (!rep || rep->type == FS_Error)
     {
 	if (ret == FSIO_BLOCK)
 	    return StillWorking;
$Id: 099x_xdm_support_logfile_rotation.diff 2240 2005-04-10 19:12:41Z branden $

Implement new ReopenLogFile() and ReopenLogFileNotify() functions to
facilitate log rotation.  ReopenLogFileNotify() is a signal handler for
SIGUSR2.  See Debian #303688.

Move the definition of the WRITES() macro from error.c to dm_error.h so
that dm.c can use it as well.

This patch by Branden Robinson.

Not submitted upstream to XFree86 or X.Org.

diff -urN xc/programs/xdm~/dm.c xc/programs/xdm/dm.c
--- xc/programs/xdm~/dm.c	2005-04-08 23:56:37.758486000 -0500
+++ xc/programs/xdm/dm.c	2005-04-08 23:57:01.167468815 -0500
@@ -78,8 +78,10 @@
 extern FILE    *fdopen();
 #endif
 
-static SIGVAL	StopAll (int n), RescanNotify (int n);
+static SIGVAL	StopAll (int n), RescanNotify (int n),
+		ReopenLogFileNotify (int n);
 static void	RescanServers (void);
+static void	ReopenLogFile (void);
 static void	RestartDisplay (struct display *d, int forceReserver);
 static void	ScanServers (void);
 static void	SetAccessFileTime (void);
@@ -88,6 +90,7 @@
 static void	TerminateProcess (int pid, int signal);
 
 volatile int	Rescan;
+volatile int	Reopen;
 static long	ServersModTime, ConfigModTime, AccessFileModTime;
 
 int nofork_session = 0;
@@ -199,6 +202,7 @@
     AddOtherEntropy();
 #endif
     (void) Signal (SIGHUP, RescanNotify);
+    (void) Signal (SIGUSR2, ReopenLogFileNotify);
 #ifndef UNRELIABLE_SIGNALS
     (void) Signal (SIGCHLD, ChildNotify);
 #endif
@@ -209,6 +213,11 @@
 #endif
 	   AnyDisplaysLeft ())
     {
+	if (Reopen)
+	{
+	    ReopenLogFile ();
+	    Reopen = 0;
+	}
 	if (Rescan)
 	{
 	    RescanServers ();
@@ -233,6 +242,7 @@
     int olderrno = errno;
 
     Debug ("caught SIGHUP\n");
+    Reopen = 1;
     Rescan = 1;
 #ifdef SIGNALS_RESET_WHEN_CAUGHT
     (void) Signal (SIGHUP, RescanNotify);
@@ -240,6 +250,26 @@
     errno = olderrno;
 }
 
+/*
+ * Handle a SIGUSR2: set variable that will instruct the main loop to
+ * reopen the log file.
+ */
+static void
+ReopenLogFileNotify (int n)
+{
+#ifdef SIGNALS_RESET_WHEN_CAUGHT
+    int olderrno = errno;
+#endif
+
+    /* Debug() is not safe inside a signal handler. */
+    WRITES(STDERR_FILENO, "ReopenLogFileNotify handling SIGUSR2\n");
+    Reopen = 1;
+#ifdef SIGNALS_RESET_WHEN_CAUGHT
+    (void) Signal (SIGUSR2, ReopenLogFileNotify);
+    errno = olderrno;
+#endif
+}
+
 static void
 ScanServers (void)
 {
@@ -307,6 +337,14 @@
 }
 
 static void
+ReopenLogFile (void)
+{
+    Debug ("closing standard error file descriptor %d\n", STDERR_FILENO);
+    close (STDERR_FILENO);
+    InitErrorLog ();
+}
+
+static void
 SetConfigFileTime (void)
 {
     struct stat	statb;
diff -urN xc/programs/xdm~/dm_error.h xc/programs/xdm/dm_error.h
--- xc/programs/xdm~/dm_error.h	2005-04-08 23:06:12.000000000 -0500
+++ xc/programs/xdm/dm_error.h	2005-04-08 23:58:20.156409226 -0500
@@ -44,6 +44,8 @@
 # define GCC_PRINTFLIKE(fmt,var) /*nothing*/
 #endif
 
+#define WRITES(fd, buf) write(fd, buf, strlen(buf))
+
 extern void Debug        (char * fmt, ...) GCC_PRINTFLIKE(1,2);
 extern void InitErrorLog (void);
 extern void LogError     (char * fmt, ...) GCC_PRINTFLIKE(1,2);
diff -urN xc/programs/xdm~/error.c xc/programs/xdm/error.c
--- xc/programs/xdm~/error.c	2005-04-08 23:06:12.000000000 -0500
+++ xc/programs/xdm/error.c	2005-04-08 23:58:20.153409228 -0500
@@ -49,8 +49,6 @@
 #include "dm.h"
 #include "dm_error.h"
 
-#define WRITES(fd, buf) write(fd, buf, strlen(buf))
-
 void
 LogInfo(char * fmt, ...)
 {
diff -urN xc/programs/xdm~/xdm.man xc/programs/xdm/xdm.man
--- xc/programs/xdm~/xdm.man	2005-04-08 23:56:37.774486000 -0500
+++ xc/programs/xdm/xdm.man	2005-04-08 23:57:01.170468812 -0500
@@ -1348,6 +1348,37 @@
 multiple window systems on the same hardware, you'll probably be more
 interested in
 .I xinit.
+.SH "ASYNCHRONOUS EVENTS"
+.B xdm
+uses
+.B SIGALRM
+and
+.B SIGUSR1
+for its own inter-process communication purposes, managing the relationship
+between the parent
+.B xdm
+process and its children.
+Sending these signals to any
+.B xdm
+process may result in unexpected behavior.
+.TP
+.B SIGHUP
+causes
+.B xdm
+to rescan its configuration files and reopen its log file.
+.TP
+.B SIGTERM
+causes
+.B xdm
+to terminate its children and shut down.
+.TP
+.B SIGUSR2
+causes
+.B xdm
+to reopen its log file.
+This is useful if log rotation is desired, but
+.B SIGHUP
+is too disruptive.
 .SH FILES
 .TP 20
 .I __projectroot__/lib/X11/xdm/xdm-config

Reply to: