Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: relative path generation in mkmakemod.sh



Hi everyone,

I started looking at zsh again after a long pause.  I'm really sorry for
my long silence, I was too busy doing other things.  I do welcome Zefram
as a new maintainer.  I'll turn ftp.cs.elte.hu into a mirror site when
the new master ftp site is ready.  Alternatively I can probably arrange
that Zefram can directly upload to ftp.cs.elte.hu.  I'll try to get back
on track and continue contributing to zsh as best as I can.  First here
is a patch for the zefram4 version to fix the relative path generation in
mkmakemod.sh, which can fail if the pwd command gives a pathname with
symlinks.  The modified version tries to find the shortest relative path,
and avoids using the pwd shell builtin if an external version of pwd can
be found.  An external pwd usually returns symlink-free path.

Zoli

*** Src/mkmakemod.sh.orig	Sun Apr 26 17:09:03 1998
--- Src/mkmakemod.sh	Tue Apr 28 02:47:23 1998
***************
*** 67,72 ****
--- 67,87 ----
      s,\(.\)/$,\1,
  '
  
+ sed_getrel='
+     s,\([^/]\)$,\1/,
+     N
+     s,\([^/]\)$,\1/,
+     s,^\(.*/\)\(.*\n\)\1\(.*\),\2\3,
+     h
+     s,^.*\n,,
+     s,[^/][^/]*,..,g
+     s,\.\.$,../,
+     G
+     s,\n\(.*\)\n.*$,\1,
+     s,\(.\)/$,\1,
+     s,^$,.,
+ '
+ 
  # decide which stages to process
  first_stage=true
  second_stage=true
***************
*** 303,312 ****
  
      trap "rm -f $the_subdir/${the_makefile}" 1 2 15
  
      # config.status requires the pathname for the .in file to be relative
      # to the top of the source tree.  As we have it in the build tree, it
      # is necessary to construct an appropriate pathname.
!     top_builddir=`(cd $top_srcdir; pwd) | sed 's,[^/][^/]*,..,g;s,^/,,'``pwd`
  
      CONFIG_FILES=$the_subdir/${the_makefile}:$top_builddir/$the_subdir/${the_makefile}.in CONFIG_HEADERS= ./config.status
  
--- 318,338 ----
  
      trap "rm -f $the_subdir/${the_makefile}" 1 2 15
  
+     pwdcmd=pwd
+     IFS="${IFS=	 }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+     for ac_dir in $PATH; do
+ 	test -z "$ac_dir" && ac_dir=.
+ 	if test -f $ac_dir/$pwdcmd; then
+ 	    pwdcmd="$ac_dir/$pwdcmd"
+ 	    break
+ 	fi
+     done
+     IFS="$ac_save_ifs"
+ 
      # config.status requires the pathname for the .in file to be relative
      # to the top of the source tree.  As we have it in the build tree, it
      # is necessary to construct an appropriate pathname.
!     top_builddir=`($pwdcmd; cd $top_srcdir; $pwdcmd) | sed "$sed_getrel"`
  
      CONFIG_FILES=$the_subdir/${the_makefile}:$top_builddir/$the_subdir/${the_makefile}.in CONFIG_HEADERS= ./config.status
  



Messages sorted by: Reverse Date, Date, Thread, Author