Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Feb 2011 21:47:04 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r218351 - stable/8/tools/regression/bin/sh/builtins
Message-ID:  <201102052147.p15Ll4md042235@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Sat Feb  5 21:47:04 2011
New Revision: 218351
URL: http://svn.freebsd.org/changeset/base/218351

Log:
  MFC r216019: sh: Make the test for cd/pwd with long pathnames more useful:
  * Use $(getconf PATH_MAX /) to make sure we actually exercise the hard part
  * Delete our test area even if the test fails

Modified:
  stable/8/tools/regression/bin/sh/builtins/cd2.0
Directory Properties:
  stable/8/tools/regression/bin/sh/   (props changed)

Modified: stable/8/tools/regression/bin/sh/builtins/cd2.0
==============================================================================
--- stable/8/tools/regression/bin/sh/builtins/cd2.0	Sat Feb  5 21:43:37 2011	(r218350)
+++ stable/8/tools/regression/bin/sh/builtins/cd2.0	Sat Feb  5 21:47:04 2011	(r218351)
@@ -1,15 +1,16 @@
 # $FreeBSD$
 set -e
 
+L=$(getconf PATH_MAX / 2>/dev/null) || L=4096
+[ "$L" -lt 100000 ] 2>/dev/null || L=4096
+L=$((L+100))
 T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX)
+trap 'rm -rf ${T}' 0
 cd $T
 D=$T
-for i in 0 1 2 3 4 5 6 7 8 9; do
-	for j in 0 1 2 3 4 5 6 7 8 9; do
-		mkdir veryverylongdirectoryname
-		cd veryverylongdirectoryname
-		D=$D/veryverylongdirectoryname
-	done
+while [ ${#D} -lt $L ]; do
+	mkdir veryverylongdirectoryname
+	cd veryverylongdirectoryname
+	D=$D/veryverylongdirectoryname
 done
 [ $(pwd | wc -c) -eq $((${#D} + 1)) ] # +\n
-rm -rf ${T}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102052147.p15Ll4md042235>