public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: Follow Unix ./executable convention.
@ 2008-05-02 14:54 scox
  0 siblings, 0 replies; only message in thread
From: scox @ 2008-05-02 14:54 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  bd4079f3265adffbd81e8fc1a8d2dd0314cd27b1 (commit)
      from  8d06b9bb3c74976b8913336c5392867f06846e9c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit bd4079f3265adffbd81e8fc1a8d2dd0314cd27b1
Author: Stan Cox <scox@redhat.com>
Date:   Fri May 2 10:52:16 2008 -0400

    Follow Unix ./executable convention.
    
    * SysRoot.java (findExe): Follow Unix ./executable convention.
    * TestSysRoot.java (testExePath): New

-----------------------------------------------------------------------

Summary of changes:
 frysk-core/frysk/sysroot/ChangeLog        |    5 +++++
 frysk-core/frysk/sysroot/SysRoot.java     |   11 +++++++----
 frysk-core/frysk/sysroot/TestSysRoot.java |   24 ++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 4 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/sysroot/ChangeLog b/frysk-core/frysk/sysroot/ChangeLog
index 3309028..fa0a22b 100644
--- a/frysk-core/frysk/sysroot/ChangeLog
+++ b/frysk-core/frysk/sysroot/ChangeLog
@@ -1,3 +1,8 @@
+2008-05-02  Stan Cox  <scox@redhat.com>
+
+	* SysRoot.java (findExe): Follow Unix ./executable convention.
+	* TestSysRoot.java (testExePath): New.
+
 2008-04-30  Stan Cox  <scox@redhat.com>
 
 	* SysRoot.java (findExe): Consider relative paths.
diff --git a/frysk-core/frysk/sysroot/SysRoot.java b/frysk-core/frysk/sysroot/SysRoot.java
index 7bbbdd3..38c355a 100644
--- a/frysk-core/frysk/sysroot/SysRoot.java
+++ b/frysk-core/frysk/sysroot/SysRoot.java
@@ -120,7 +120,7 @@ public class SysRoot {
             return exeFile;
         }
 
-        if (arg0.startsWith("/")) {
+        if (arg0.startsWith(File.separator)) {
             return exeFile;
         }
 
@@ -129,13 +129,16 @@ public class SysRoot {
             return exeFile;
         }
         
-        if (sysRoot.getPath().compareTo("/") == 0) { 
-            if (! exeFile.isAbsolute() && exeFile.exists()) {
-        	// given "./executable" with sysroot "/"
+	// Given "./executable" with sysroot "/"
+        if (sysRoot.getPath().compareTo(File.separator) == 0) { 
+            if (! exeFile.isAbsolute() 
+        	    && exeFile.getPath().indexOf(File.separator) != -1
+        	    && exeFile.exists()) {
         	return exeFile;
             }
         }
 
+        // Otherwise search in $PATH
         for (int i = 0; i < path.length; i++) {
             File file = new File(new File(sysRoot.getPath(), path[i]), arg0);
             if (file.exists()) {
diff --git a/frysk-core/frysk/sysroot/TestSysRoot.java b/frysk-core/frysk/sysroot/TestSysRoot.java
index a989aa0..208f4a9 100644
--- a/frysk-core/frysk/sysroot/TestSysRoot.java
+++ b/frysk-core/frysk/sysroot/TestSysRoot.java
@@ -42,6 +42,7 @@ package frysk.sysroot;
 import java.io.File;
 
 import frysk.config.Prefix;
+import frysk.testbed.TearDownExpect;
 import frysk.testbed.TestLib;
 
 public class TestSysRoot extends TestLib {
@@ -124,4 +125,27 @@ public class TestSysRoot extends TestLib {
 	assertEquals("getSourcePathViaSysRoot relative", 0, 
 		testPath.getSysRootedFile().compareTo(correctPath));
     }
+    
+    public void testExePath() {
+	String sysRootPath = Prefix.pkgLibFile(".").getParent()
+	+ "/test-sysroot/usr/bin";
+	
+        File fexe = Prefix.binFile("fexe");
+        TearDownExpect e = new TearDownExpect(new String[] {
+                "/bin/bash",
+                "-c",
+                "PATH=" + sysRootPath + " ; cd " + Prefix.pkgLibFile(".") + " ; "
+                + fexe.getAbsolutePath() + " ./funit-quicksort"
+            });
+        e.expect(Prefix.pkgLibFile(".").getParent() + "/funit-quicksort");
+
+        e = new TearDownExpect(new String[] {
+                "/bin/bash",
+                "-c",
+                "PATH=" + sysRootPath + " ; cd " + Prefix.pkgLibFile(".") + " ; "
+                + fexe.getAbsolutePath() + " funit-quicksort"
+            });
+        e.expect(sysRootPath + "/funit-quicksort");
+    }
+
 }


hooks/post-receive
--
frysk system monitor/debugger


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-05-02 14:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-02 14:54 [SCM] master: Follow Unix ./executable convention scox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).