Subject: Re: Trailing / in pathnames passed to build.sh
To: Bang Jun-Young <junyoung@mogua.com>
From: James Chacon <jmc@NetBSD.org>
List: tech-toolchain
Date: 08/16/2004 13:58:02
On Tue, Aug 17, 2004 at 03:46:23AM +0900, Bang Jun-Young wrote:
> Hi,
>
> Currently, build.sh doesn't remove trailing / in pathnames given to it.
> That caused unnecessary rebuild of tools today when I misspecified
> "/u0/netbsd-2-0/tools" as "/u0/netbsd-2-0/tools/".
>
> (cd /u0/netbsd-2-0/src/tools && /u0/netbsd-2-0/tools//bin/nbmake dependall)
> *** WARNING: TOOLDIR has moved?
> *** PREVIOUSTOOLDIR '/u0/netbsd-2-0/tools'
> *** != TOOLDIR '/u0/netbsd-2-0/tools/'
> *** Cleaning mis-matched tools
> rm -f PREVIOUSTOOLDIR
> (... start building tools ...)
>
> The following patch removes trailing /.
>
> --- build.sh 6 Feb 2004 23:19:30 -0000 1.127
> +++ build.sh 16 Aug 2004 18:40:20 -0000
> @@ -324,6 +324,7 @@
>
> resolvepath()
> {
> + OPTARG=`echo ${OPTARG} | sed -e 's/\/$//'`
> case "${OPTARG}" in
> /*)
> ;;
>
> Any comments?
Looks good to me. (though I'll note s:/$:: works as well and avoids an escape
which tends to turn most sed expressions into line noise.)
James