From 4614526551b8fe9ac885e727ad1f3f51aa460708 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Mon, 9 Jan 2012 16:15:23 +0000 Subject: More efficient method of building the symlink tree that makes better use of awk. Slightly faster and works around an apparent namei or buffer cache related bug on arm. Requested and OK deraadt@ --- gnu/usr.bin/perl/Configure | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) (limited to 'gnu/usr.bin/perl') diff --git a/gnu/usr.bin/perl/Configure b/gnu/usr.bin/perl/Configure index 653b259d65a..b96a95df810 100644 --- a/gnu/usr.bin/perl/Configure +++ b/gnu/usr.bin/perl/Configure @@ -2724,33 +2724,22 @@ $define|true|[yY]*) *) case "$lns:$issymlink" in *"ln"*" -s:"*"test -"?) echo "Creating the symbolic links..." >&4 - echo "(First creating the subdirectories...)" >&4 cd .. - awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do - read directory - test -z "$directory" && break - mkdir -p $directory - done + awk -v src="$src" '{ + dir=$1; + if (!sub(/\/[^\/]*$/, "", dir)) { dir = "." } + mf[dir] = mf[dir]" "src"/"$1; + } END { + for (d in mf) { + if (d != ".") { system("mkdir -p "d) } + system("ln -sf "mf[d]" "d); + } + }' $src/MANIFEST # Sanity check 1. if test ! -d t/base; then echo "Failed to create the subdirectories. Aborting." >&4 exit 1 fi - echo "(Then creating the symlinks...)" >&4 - awk '{print $1}' $src/MANIFEST | while true; do - read filename - test -z "$filename" && break - if test -f $filename; then - if $issymlink $filename; then - rm -f $filename - fi - fi - if test -f $filename; then - echo "$filename already exists, not symlinking." - else - ln -s $src/$filename $filename - fi - done # Sanity check 2. if test ! -f t/base/lex.t; then echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4 -- cgit v1.2.3