List:Commits« Previous MessageNext Message »
From:msvensson Date:October 31 2006 6:02pm
Subject:bk commit into 4.1 tree (msvensson:1.2613)
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of msvensson. When msvensson does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-10-31 19:02:33+01:00, msvensson@shellback.(none) +2 -0
  Improve the reading of .pid files from var/run
   - Only read *.pid
   - Only allow it to contain a number 

  mysql-test/lib/mtr_io.pl@stripped, 2006-10-31 19:02:31+01:00, msvensson@shellback.(none) +5 -7
    Check that the value read from pidfile is a valid number consisting only of digits

  mysql-test/lib/mtr_process.pl@stripped, 2006-10-31 19:02:31+01:00, msvensson@shellback.(none) +25 -15
    Only process .pid files in var/run dir and print a warning if other files are found there. 

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	msvensson
# Host:	shellback.(none)
# Root:	/home/msvensson/mysql/mysql-4.1-maint

--- 1.5/mysql-test/lib/mtr_io.pl	2006-10-31 19:02:38 +01:00
+++ 1.6/mysql-test/lib/mtr_io.pl	2006-10-31 19:02:38 +01:00
@@ -37,18 +37,16 @@
     open(FILE, '<', $pid_file_path)
       or mtr_error("can't open file \"$pid_file_path\": $!");
 
+    # Read pid number from file
     my $pid= <FILE>;
-
-    chomp($pid) if defined $pid;
-
     close FILE;
 
-    return $pid if defined $pid && $pid ne '';
+    return $pid if $pid=~ /^(\d+)/;
 
-    mtr_debug("Pid file '$pid_file_path' is empty. " .
-              "Sleeping $timeout second(s)...");
+    mtr_debug("Pid file '$pid_file_path' does not yet contain pid number.\n" .
+              "Sleeping $timeout second(s) more...");
 
-    sleep(1);
+    sleep($timeout);
   }
 
   mtr_error("Pid file '$pid_file_path' is corrupted. " .

--- 1.25/mysql-test/lib/mtr_process.pl	2006-10-31 19:02:38 +01:00
+++ 1.26/mysql-test/lib/mtr_process.pl	2006-10-31 19:02:38 +01:00
@@ -438,25 +438,35 @@
 
     while ( my $elem= readdir(RUNDIR) )
     {
-      my $pidfile= "$rundir/$elem";
-
-      if ( -f $pidfile )
+      # Only read pid from files that end with .pid
+      if ( $elem =~ /.*[.]pid$/)
       {
-        mtr_debug("Processing PID file: '$pidfile'...");
 
-        my $pid= mtr_get_pid_from_file($pidfile);
+	my $pidfile= "$rundir/$elem";
+
+	if ( -f $pidfile )
+	{
+	  mtr_debug("Processing PID file: '$pidfile'...");
 
-        mtr_debug("Got pid: $pid from file '$pidfile'");
+	  my $pid= mtr_get_pid_from_file($pidfile);
 
-        if ( $::glob_cygwin_perl or kill(0, $pid) )
-        {
-          mtr_debug("There is process with pid $pid -- scheduling for kill.");
-          push(@pids, $pid);            # We know (cygwin guess) it exists
-        }
-        else
-        {
-          mtr_debug("There is no process with pid $pid -- skipping.");
-        }
+	  mtr_debug("Got pid: $pid from file '$pidfile'");
+
+	  if ( $::glob_cygwin_perl or kill(0, $pid) )
+	  {
+	    mtr_debug("There is process with pid $pid -- scheduling for kill.");
+	    push(@pids, $pid);            # We know (cygwin guess) it exists
+	  }
+	  else
+	  {
+	    mtr_debug("There is no process with pid $pid -- skipping.");
+	  }
+	}
+      }
+      else
+      {
+	mtr_warning("Found non pid file $elem in $rundir");
+	next;
       }
     }
     closedir(RUNDIR);
Thread
bk commit into 4.1 tree (msvensson:1.2613)msvensson31 Oct