OSSP CVS Repository

ossp - Check-in [6019]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 6019
Date: 2008-Dec-23 20:12:05 (local)
2008-Dec-23 19:12:05 (UTC)
User:rse
Branch:
Comment: Fix "mkln -s /foo /foo/bar" (achieving a "bar -> ." symlink)
Tickets:
Inspections:
Files:
ossp-pkg/shtool/ChangeLog      1.242 -> 1.243     3 inserted, 0 deleted
ossp-pkg/shtool/sh.mkln      1.25 -> 1.26     9 inserted, 4 deleted

ossp-pkg/shtool/ChangeLog 1.242 -> 1.243

--- ChangeLog    2008/09/21 15:01:15     1.242
+++ ChangeLog    2008/12/23 19:12:05     1.243
@@ -11,6 +11,9 @@
 
  Changes between 2.0.8 and 2.0.9 (18-Jul-2008 to xx-XXX-2008):
 
+   *) Fix "mkln -s /foo /foo/bar" (achieving a "bar -> ." symlink)
+      [Ralf S. Engelschall]
+
    *) Provide SHTOOL_ROTATE_LOGFILE environment variable
       to "shtool rotate" prolog/epilog commands.
       [Bill Campbell <bill@celestial.com>]


ossp-pkg/shtool/sh.mkln 1.25 -> 1.26

--- sh.mkln      2008/06/06 12:15:11     1.25
+++ sh.mkln      2008/12/23 19:12:05     1.26
@@ -114,14 +114,14 @@
         dstdir=""
     else
         while [ ".$srcdir" != . ] && [ ".$dstdir" != . ]; do
-            presrc=`echo $srcdir | sed -e 's;^\([^/]*\)/.*;\1;'`
-            predst=`echo $dstdir | sed -e 's;^\([^/]*\)/.*;\1;'`
+            presrc=`echo $srcdir | sed -e 's;^\([^/][^/]*\)/.*;\1;'`
+            predst=`echo $dstdir | sed -e 's;^\([^/][^/]*\)/.*;\1;'`
             if [ ".$presrc" != ".$predst" ]; then
                 break
             fi
             prefix="$prefix$presrc/"
-            srcdir=`echo $srcdir | sed -e 's;^[^/]*/*;;'`
-            dstdir=`echo $dstdir | sed -e 's;^[^/]*/*;;'`
+            srcdir=`echo $srcdir | sed -e 's;^[^/][^/]*/*;;'`
+            dstdir=`echo $dstdir | sed -e 's;^[^/][^/]*/*;;'`
         done
     fi
 
@@ -165,6 +165,11 @@
         fi
     fi
 
+    #   special case (usually on "mkln -s /foo /foo/bar", etc)
+    if [ ".$srcpre$srcdir$srcbase" = . ]; then
+        srcdir="."
+    fi
+
     #   now finalize source and destination directory paths
     srcdir=`echo $srcdir | sed -e 's;\([^/]\)$;\1/;'`
     dstdir=`echo $dstdir | sed -e 's;\([^/]\)$;\1/;'`

CVSTrac 2.0.1