You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2006/01/23 20:02:31 UTC

svn commit: r371622 - in /httpd/httpd/branches/2.0.x: CHANGES STATUS support/check_forensic

Author: colm
Date: Mon Jan 23 11:02:26 2006
New Revision: 371622

URL: http://svn.apache.org/viewcvs?rev=371622&view=rev
Log:
Merge r125495 and r126224 from trunk:

* 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

Modified:
    httpd/httpd/branches/2.0.x/CHANGES
    httpd/httpd/branches/2.0.x/STATUS
    httpd/httpd/branches/2.0.x/support/check_forensic

Modified: httpd/httpd/branches/2.0.x/CHANGES
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.0.x/CHANGES?rev=371622&r1=371621&r2=371622&view=diff
==============================================================================
--- httpd/httpd/branches/2.0.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.0.x/CHANGES [utf-8] Mon Jan 23 11:02:26 2006
@@ -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]
 

Modified: httpd/httpd/branches/2.0.x/STATUS
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.0.x/STATUS?rev=371622&r1=371621&r2=371622&view=diff
==============================================================================
--- httpd/httpd/branches/2.0.x/STATUS (original)
+++ httpd/httpd/branches/2.0.x/STATUS Mon Jan 23 11:02:26 2006
@@ -128,19 +128,6 @@
           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

Modified: httpd/httpd/branches/2.0.x/support/check_forensic
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.0.x/support/check_forensic?rev=371622&r1=371621&r2=371622&view=diff
==============================================================================
--- httpd/httpd/branches/2.0.x/support/check_forensic (original)
+++ httpd/httpd/branches/2.0.x/support/check_forensic Mon Jan 23 11:02:26 2006
@@ -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