You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Garrett Rooney <ro...@electricjellyfish.net> on 2002/03/14 01:54:47 UTC

apr/apu-config and paths with symlinks

So while putting together a FreeBSD port for apr and apr-util, for use
with my port of Subversion, I ran into a slight problem with the
apr-config and apu-config scripts.

The scripts use a `cd $foo && pwd` construct to resolve relative paths
when figuring out if they're being called from an installed location
or within their build location.  This falls apart on systems where the
installed location is in a directory that is actually a symlink off to
someplace else (ie, /usr/local is really a symlink to /bigdisk or
something like that).

The fix (which was suggested by Greg Stein), is simple.  Just resolve
the $bindir path in the same way before doing the comparison.  Here
are patches to both apr-config and apu-config that should  correct the 
problem.

-garrett

Index: apr-config.in
===================================================================
RCS file: /home/cvspublic/apr/apr-config.in,v
retrieving revision 1.13
diff -u -r1.13 apr-config.in
--- apr-config.in	13 Mar 2002 20:39:08 -0000	1.13
+++ apr-config.in	14 Mar 2002 00:44:38 -0000
@@ -114,7 +114,8 @@
 
 thisdir="`dirname $0`"
 thisdir="`cd $thisdir && pwd`"
-if test "$bindir" = "$thisdir"; then
+tmpbindir="`cd $bindir && pwd`"
+if test "$tmpbindir" = "$thisdir"; then
   location=installed
 elif test "$APR_SOURCE_DIR" = "$thisdir"; then
   location=source


Index: apu-config.in
===================================================================
RCS file: /home/cvspublic/apr-util/apu-config.in,v
retrieving revision 1.7
diff -u -r1.7 apu-config.in
--- apu-config.in	13 Mar 2002 20:40:46 -0000	1.7
+++ apu-config.in	14 Mar 2002 00:45:06 -0000
@@ -100,7 +100,8 @@
 
 thisdir="`dirname $0`"
 thisdir="`cd $thisdir && pwd`"
-if test "$bindir" = "$thisdir"; then
+tmpbindir="`cd $bindir && pwd`"
+if test "$tmpbindir" = "$thisdir"; then
   location=installed
 elif test "$APR_SOURCE_DIR" = "$thisdir"; then
   location=source

-- 
garrett rooney                     Unix was not designed to stop you from 
rooneg@electricjellyfish.net       doing stupid things, because that would  
http://electricjellyfish.net/      stop you from doing clever things.

Re: apr/apu-config and paths with symlinks

Posted by Greg Stein <gs...@lyra.org>.
Applied. Thanks!

On Wed, Mar 13, 2002 at 07:54:47PM -0500, Garrett Rooney wrote:
> So while putting together a FreeBSD port for apr and apr-util, for use
> with my port of Subversion, I ran into a slight problem with the
> apr-config and apu-config scripts.
> 
> The scripts use a `cd $foo && pwd` construct to resolve relative paths
> when figuring out if they're being called from an installed location
> or within their build location.  This falls apart on systems where the
> installed location is in a directory that is actually a symlink off to
> someplace else (ie, /usr/local is really a symlink to /bigdisk or
> something like that).
> 
> The fix (which was suggested by Greg Stein), is simple.  Just resolve
> the $bindir path in the same way before doing the comparison.  Here
> are patches to both apr-config and apu-config that should  correct the 
> problem.
> 
> -garrett
> 
> Index: apr-config.in
> ===================================================================
> RCS file: /home/cvspublic/apr/apr-config.in,v
> retrieving revision 1.13
> diff -u -r1.13 apr-config.in
> --- apr-config.in	13 Mar 2002 20:39:08 -0000	1.13
> +++ apr-config.in	14 Mar 2002 00:44:38 -0000
> @@ -114,7 +114,8 @@
>  
>  thisdir="`dirname $0`"
>  thisdir="`cd $thisdir && pwd`"
> -if test "$bindir" = "$thisdir"; then
> +tmpbindir="`cd $bindir && pwd`"
> +if test "$tmpbindir" = "$thisdir"; then
>    location=installed
>  elif test "$APR_SOURCE_DIR" = "$thisdir"; then
>    location=source
> 
> 
> Index: apu-config.in
> ===================================================================
> RCS file: /home/cvspublic/apr-util/apu-config.in,v
> retrieving revision 1.7
> diff -u -r1.7 apu-config.in
> --- apu-config.in	13 Mar 2002 20:40:46 -0000	1.7
> +++ apu-config.in	14 Mar 2002 00:45:06 -0000
> @@ -100,7 +100,8 @@
>  
>  thisdir="`dirname $0`"
>  thisdir="`cd $thisdir && pwd`"
> -if test "$bindir" = "$thisdir"; then
> +tmpbindir="`cd $bindir && pwd`"
> +if test "$tmpbindir" = "$thisdir"; then
>    location=installed
>  elif test "$APR_SOURCE_DIR" = "$thisdir"; then
>    location=source
> 
> -- 
> garrett rooney                     Unix was not designed to stop you from 
> rooneg@electricjellyfish.net       doing stupid things, because that would  
> http://electricjellyfish.net/      stop you from doing clever things.

-- 
Greg Stein, http://www.lyra.org/