[cfe-commits] r53640 - /cfe/trunk/utils/scan-build

Ted Kremenek kremenek at apple.com
Tue Jul 15 13:18:21 PDT 2008


Author: kremenek
Date: Tue Jul 15 15:18:21 2008
New Revision: 53640

URL: http://llvm.org/viewvc/llvm-project?rev=53640&view=rev
Log:
Per Sam Bishop's excellent suggestion, use "system" instead of backticks to invoke sub-commands used by scan-build.  This avoids meta-character translation issues caused by a shell subprocess.

Modified:
    cfe/trunk/utils/scan-build

Modified: cfe/trunk/utils/scan-build
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/scan-build?rev=53640&r1=53639&r2=53640&view=diff

==============================================================================
--- cfe/trunk/utils/scan-build (original)
+++ cfe/trunk/utils/scan-build Tue Jul 15 15:18:21 2008
@@ -269,7 +269,7 @@
   
   close (ROUT);
   close (RIN);
-  `mv "$fname.tmp" "$fname"`;
+  system("mv", "$fname.tmp", $fname);
 }
 
 ##----------------------------------------------------------------------------##
@@ -294,14 +294,14 @@
 
   if (defined($AlreadyScanned{$digest})) {
     # Redundant file.  Remove it.
-    `rm -f "$Dir/$FName"`;
+    system ("rm", "-f", "$Dir/$FName");
     return;
   }
   
   $AlreadyScanned{$digest} = 1;
   
   # At this point the report file is not world readable.  Make it happen.
-  `chmod 644 "$Dir/$FName"`;
+  system ("chmod", "644", "$Dir/$FName");
   
   # Scan the report file for tags.
   open(IN, "$Dir/$FName") or DieDiag("Cannot open '$Dir/$FName'\n");
@@ -344,7 +344,7 @@
   DieDiag("Cannot find 'sorttable.js'.\n")
     if (! -r "$RealBin/sorttable.js");  
 
-  `cp "$RealBin/sorttable.js" "$Dir"`;
+  system ("cp", "$RealBin/sorttable.js", "$Dir");
 
   DieDiag("Could not copy 'sorttable.js' to '$Dir'.\n")
     if (! -r "$Dir/sorttable.js");
@@ -373,10 +373,10 @@
 
   if (scalar(@files) == 0) {
     Diag("Removing directory '$Dir' because it contains no reports.\n");
-    `rm -fR "$Dir"`;
+    system ("rm", "-fR", $Dir);
     
     # Remove the base directory if it contains no files (don't use '-R').
-    `rm -f "$BaseDir"`;
+    system ("rm", "-f", $BaseDir);
     
     Diag("No bugs found.\n");
     return;
@@ -546,13 +546,13 @@
   
   print OUT "</table>\n</body></html>\n";  
   close(OUT);
-  
+
   CopyJS($Dir);
-  
-  # Make sure $Dir and $BaseDir is world readable/executable.
-  `chmod 755 "$Dir"`;
-  `chmod 755 "$BaseDir"`;
-  
+
+  # Make sure $Dir and $BaseDir are world readable/executable.
+  system("chmod", "755", $Dir);
+  system("chmod", "755", $BaseDir);
+
   my $Num = scalar(@Index);
   Diag("$Num bugs found.\n");
   if ($Num > 0 && -r "$Dir/index.html") {
@@ -827,7 +827,7 @@
 if ($ViewResults and -r "$HtmlDir/index.html") {
   # Only works on Mac OS X (for now).
   print "Viewing analysis results: '$HtmlDir/index.html'\n";
-  `open "$HtmlDir/index.html"`
+  system("open", "$HtmlDir/index.html");
 }
 
 exit $ExitStatus;





More information about the cfe-commits mailing list