[chora] Diffs aren't shown

Alexander Skwar lists.ASkwar at email-server.info
Fri Apr 18 13:34:52 PDT 2003


Jan Schneider wrote:

> Can you please repost the patch as a unified diff? It's hard to follow what
> and where exactly it changes the code.

Yep.


Alexander Skwar
-- 
# Basic IBM dingbats, some of which will never have a purpose clear
# to mankind
	2.4.0 linux/drivers/char/cp437.uni
-------------- next part --------------
? tmpdir.patch
? tmpdir.unified.patch
Index: diff.php
===================================================================
RCS file: /repository/chora/diff.php,v
retrieving revision 1.67
diff -u -r1.67 diff.php
--- diff.php	4 Mar 2003 19:37:57 -0000	1.67
+++ diff.php	18 Apr 2003 10:34:12 -0000
@@ -110,18 +110,18 @@
     } else {
         header('Content-Type: text/plain');
         echo implode("\n", CVSLib_Diff::get($CVS, $fl, $r1, $r2,
-             $type, $num, $ws));
+             $type, $num, $ws, $conf['tmpdir']));
     }
     break;
 
 case CVSLIB_DIFF_CONTEXT:
     header('Content-Type: text/plain');
-    echo implode("\n", CVSLib_Diff::get($CVS, $fl, $r1, $r2, $type, $num, $ws));
+    echo implode("\n", CVSLib_Diff::get($CVS, $fl, $r1, $r2, $type, $num, $ws, $conf['tmpdir']));
     break;
 
 case CVSLIB_DIFF_ED:
     header('Content-Type: text/plain');
-    echo implode("\n", CVSLib_Diff::get($CVS, $fl, $r1, $r2, $type, $num, $ws));
+    echo implode("\n", CVSLib_Diff::get($CVS, $fl, $r1, $r2, $type, $num, $ws, $conf['tmpdir']));
     break;
 
 case CVSLIB_DIFF_UNIFIED:
@@ -130,7 +130,7 @@
         /* Not Human-Readable format. */
         header('Content-Type: text/plain');
         echo implode("\n", CVSLib_Diff::get($CVS, $fl, $r1, $r2,
-                                            $type, $num, $ws));
+                                            $type, $num, $ws, $conf['tmpdir']));
     } else {
         /* Human-Readable diff. */
 
@@ -151,7 +151,7 @@
         /* Retrieve the tree of changes from CVSLib */
         $lns = CVSLib_Diff::humanReadable(
             CVSLib_Diff::get($CVS, $fl, $r1, $r2, CVSLIB_DIFF_UNIFIED,
-                $num, $ws));
+                $num, $ws, $conf['tmpdir']));
         /* TODO: check for errors here (CVSLib_Error returned) - avsm */
         /* Is the diff empty? */
         if (!sizeof($lns)) {
Index: lib/CVSLib/Diff.php
===================================================================
RCS file: /repository/chora/lib/CVSLib/Diff.php,v
retrieving revision 1.27
diff -u -r1.27 Diff.php
--- lib/CVSLib/Diff.php	25 Dec 2002 16:13:24 -0000	1.27
+++ lib/CVSLib/Diff.php	18 Apr 2003 10:34:12 -0000
@@ -26,10 +26,11 @@
      * @param type Constant which indicates the type of diff (e.g. unified)
      * @param num  Number of lines to be used in context and unified diff
      * @param ws   Show whitespace in the diff?
+     * @param tmp  Temporary directory used by rcsdiff. Optional; Defaults to /tmp
      *
      * @return false on failure, or a string containing the diff on success
      */
-    function get(&$CVS, &$file, $rev1, $rev2, $type = CVSLIB_DIFF_CONTEXT, $num = 3, $ws = true)
+    function get(&$CVS, &$file, $rev1, $rev2, $type = CVSLIB_DIFF_CONTEXT, $num = 3, $ws = true, $tmp = '/tmp')
     {
         /* Make sure that the file parameter is valid */
         if (!is_object($file) || $file->id() != CVSLIB_FILE) {
@@ -76,7 +77,14 @@
             $command .= ' < "' . __FILE__ . '"';
         }
 
+	$old_tmpdir = getenv('TMPDIR');
+	if ($tmp !== '' && $tmp !== null){
+	    putenv('TMPDIR=' . $tmp);
+	} else {
+	    putenv('TMPDIR=' . get_cfg_var('upload_tmp_dir'));
+	}
         exec($command, $diff, $retval);
+	putenv('TMPDIR=' . $old_tmpdir);
         return ($retval > 0) ? $diff : array();
     }
 


More information about the chora mailing list