]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r125495 and r126224 from trunk:
authorColm MacCarthaigh <colm@apache.org>
Mon, 23 Jan 2006 19:02:26 +0000 (19:02 +0000)
committerColm MacCarthaigh <colm@apache.org>
Mon, 23 Jan 2006 19:02:26 +0000 (19:02 +0000)
* support/check_forensic: Fix temp file usage

Submitted By: Javier Fernandez-Sanguino Pen~a
Reviewed By: Thom May

* support/check_forensic: Fix script on platforms that do not have either
  mktemp or tempfile (such as Solaris).

Also tested on Darwin & FreeBSD.

Submitted by: jerenkrantz

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.0.x@371622 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
support/check_forensic

diff --git a/CHANGES b/CHANGES
index 0705a2dace88be4c9b764440da1617e9ce4066a0..d63e387b459c89064a1a38bed5eed52b142941d5 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.0.56
 
+  *) support/check_forensic: Fix temp file usage
+     [Javier Fernandez-Sanguino Pen~a <jfs computer.org>]
+
   *) Chunk filter: Fix chunk filter to create correct chunks in the case that
      a flush bucket is surrounded by data buckets. [Ruediger Pluem]
 
diff --git a/STATUS b/STATUS
index 8f7a4e1deeac4d2a8161c31eb6273ecd60b75ba4..e80a92e4b9fc54a120a4d4b6769db90f11b99153 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -128,19 +128,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
           nd: I'm going to reverse the default
           jerenkrantz, striker: I'm confused as to the status of this backport.
 
-    *) support/check_forensic: Fix tempfile usage
-       svn rev 125495, 126224
-       jerenkrantz says: r126224 fixes brokenness with r125495 on Solaris.
-       +1: thommay, jerenkrantz, trawick
-       trawick: "which" isn't portable; I've suggested a work-around on dev@
-         (not standing in way of backport)
-       jorton said: NetBSD's which isn't sufficient either.
-       jerenkrantz: Since it's not in the critical path (and depends on
-                    mod_log_forensic), I think it's still worth it to backport
-                    it as-is.  For the one or two platforms that don't like 
-                    which, they can write their own version of the script.
-       (jorton agrees)
-
     *) Win32: Move call to mpm_service_install to the rewrite_args hook
        from the post_config hook.
          http://svn.apache.org/viewcvs?view=rev&rev=154319
index a3b530917bd9530c5fbede1eebed54c48117148d..3c8123fcbb734cdabe712614d8fc474f8b32a00d 100755 (executable)
@@ -7,9 +7,45 @@
 
 F=$1
 
-cut -f 1 -d '|' $F  > /tmp/fc-all.$$
-grep + < /tmp/fc-all.$$ | cut -c2- | sort > /tmp/fc-in.$$
-grep -- - < /tmp/fc-all.$$ | cut -c2- | sort > /tmp/fc-out.$$
+temp_create_method=file
+if test -f `which mktemp`; then
+  temp_create_method=mktemp
+elif test -f `which tempfile`; then
+  temp_create_method=tempfile
+fi
+
+create_temp()
+{
+  prefix=$1
+  case "$temp_create_method" in
+    file)
+      name="/tmp/$1.$$"
+      ;;
+    mktemp)
+      name=`mktemp -t $1.XXXXXX`
+      ;;
+    tempfile)
+      name=`tempfile --prefix=$1`
+      ;;
+    *)
+      echo "$0: Cannot create temporary file"
+      exit 1
+      ;;
+  esac
+}
+
+create_temp fcall
+all=$name
+create_temp fcin
+in=$name
+create_temp fcout
+out=$name
+trap "rm -f -- \"$all\" \"$in\" \"$out\";" 0 1 2 3 13 15
+
+cut -f 1 -d '|' $F  > $all
+grep + < $all | cut -c2- | sort > $in
+grep -- - < $all | cut -c2- | sort > $out
+
 # use -i instead of -I for GNU xargs
-join -v 1 /tmp/fc-in.$$ /tmp/fc-out.$$ | xargs -I xx egrep "^\\+xx" $F
-rm /tmp/fc-all.$$ /tmp/fc-in.$$ /tmp/fc-out.$$
+join -v 1 $in $out | xargs -I xx egrep "^\\+xx" $F
+exit 0