-
Notifications
You must be signed in to change notification settings - Fork 574
Better handling of symlink creation in Configure #13890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
From afresh1@openbsd.orgCreated by afresh1@openbsd.orgThis brings in improved symlinking of the build tree as as been used Perl Info
|
From afresh1@openbsd.org0001-Better-handling-of-symlink-creation.patchFrom 10e4b04f4d8ef6c60f55544a64b7e6e13fc38bbf Mon Sep 17 00:00:00 2001
From: Andrew Fresh <afresh1@openbsd.org>
Date: Sat, 31 May 2014 15:37:52 -0700
Subject: [PATCH] Better handling of symlink creation
OpenBSD heavily uses the mksymlinks define to build outside of the src
tree. This combines two commits from OpenBSD that improve the
robustness and speed of creating the symlinks.
From r1.24 by deraadt@:
> After the MANIFEST-based symbolic link creation loop, there is a check
> for a specific link to see if things worked out. Add a check for the very
> last file in the MANIFEST, as well, since we are trying to spot a very
> odd bug where symbolic links are not being created. Hopefully this will
> help us diagnose it.
http://www.openbsd.org/cgi-bin/cvsweb/src/gnu/usr.bin/perl/Configure#rev1.24
And from r1.25 by millert@:
> 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.
http://www.openbsd.org/cgi-bin/cvsweb/src/gnu/usr.bin/perl/Configure#rev1.25
---
Configure | 35 ++++++++++++++---------------------
1 file changed, 14 insertions(+), 21 deletions(-)
diff --git a/Configure b/Configure
index 5b3169b..93672cd 100755
--- a/Configure
+++ b/Configure
@@ -2795,38 +2795,31 @@ $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
exit 1
fi
+ if test ! -f x2p/walk.c; then
+ echo "Failed to create the symlinks (x2p/walk.c missing). Aborting." >&4
+ exit 1
+ fi
cd UU
;;
*) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
--
1.9.2
|
From @jkeenanOn Sat May 31 15:56:30 2014, afresh1@openbsd.org wrote:
This ticket would benefit from evaluation by our Configure experts and by anyone familiar with the various shell programs used in the patch. I have pushed it for smoking to: smoke-me/jkeenan/122002-configure-symlink |
The RT System itself - Status changed from 'new' to 'open' |
From @tonycozOn Sat May 31 15:56:30 2014, afresh1@openbsd.org wrote:
This looks sane to me, except that the file you're testing, x2p/walk.c is no longer part of the perl tree. Tony |
From @doughera88On Tue, Jun 03, 2014 at 05:19:37PM -0700, "Tony Cook via RT" wrote:
Unfortunately, it's "new" awk syntax (nawk) and not portable to 'old' awk. -- |
From @tonycozOn Tue, Jun 03, 2014 at 09:02:08PM -0400, Andy Dougherty wrote:
Thanks, I'll have to remember to test on Solaris, since it's so far Tony |
From @tonycozOn Sat May 31 15:56:30 2014, afresh1@openbsd.org wrote:
As Andy pointed out, this isn't portable. Would you like to submit an updated patch, or should I reject it? Tony |
From afresh1@openbsd.orgOn Tue, Jun 10, 2014 at 10:32:25PM -0700, Tony Cook via RT wrote:
I'm having trouble finding a copy of old awk. I have an in-progress Do we need to support spaces in the path to the perl source tree? If someone else wants to give it a shot, this is what I have so far. + awk "{ |
From @tonycozOn Tue Jun 10 22:40:21 2014, afresh1@openbsd.org wrote:
There's two problems, after testing on Solaris 11: a) it doesn't support ' for string quoting, and produced syntax errors until I converted each ' to '" b) system() isn't documented as a built-in - calling it doesn't produce an error, but it doesn't appear to execute its argument As an aside Configure defines a mkdir_p macro - does that mean mkdir -p isn't portable? Tony |
From @doughera88On Thu, Jun 12, 2014 at 12:07:42AM -0700, "Tony Cook via RT" wrote:
I don't know any easy source for it. (Debian distributes Anyway, I think the simplest thing to do is perhaps to use the awk associative arrays to Here's a version that should be about as fast as your original, but work #!/bin/sh
Yes, ideally, but my version above would need an extra set of quotes in the last
Back in 1994, yes. My recollection is that the systems that didn't In any case, since -Dmksymlinks is an opt-in item, I wouldn't worry about -- |
From @tonycozOn Thu Jun 12 08:29:26 2014, doughera wrote:
I've attached it as a patch against Configure. Tested on Solaris 11. Please test it elsewhere.
Unfortunately Configure fails well before the mksymlinks logic when the source Tony |
From @tonycoz0001-Better-handling-of-symlink-creation.patchFrom 2520356405baac1c040f3ca75098dc9da9a4961c Mon Sep 17 00:00:00 2001
From: Andrew Fresh <afresh1@openbsd.org>
Date: Sat, 31 May 2014 15:37:52 -0700
Subject: [PATCH] Better handling of symlink creation
OpenBSD heavily uses the mksymlinks define to build outside of the src
tree. This combines two commits from OpenBSD that improve the
robustness and speed of creating the symlinks.
From r1.24 by deraadt@:
> After the MANIFEST-based symbolic link creation loop, there is a check
> for a specific link to see if things worked out. Add a check for the very
> last file in the MANIFEST, as well, since we are trying to spot a very
> odd bug where symbolic links are not being created. Hopefully this will
> help us diagnose it.
http://www.openbsd.org/cgi-bin/cvsweb/src/gnu/usr.bin/perl/Configure#rev1.24
And from r1.25 by millert@:
> 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.
http://www.openbsd.org/cgi-bin/cvsweb/src/gnu/usr.bin/perl/Configure#rev1.25
Re-worked by Andy Armstrong to support the old awk used by systems
such as Solaris, see [perl #122002].
---
Configure | 45 ++++++++++++++++++++++++---------------------
1 file changed, 24 insertions(+), 21 deletions(-)
diff --git a/Configure b/Configure
index 4e6315d..cd69bcc 100755
--- a/Configure
+++ b/Configure
@@ -2798,38 +2798,41 @@ $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 '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
+ awk 'NF == 1 {
+ dir=".";
+ file=$1 "";
+ }
+ NF == 2 {
+ dir=$1 "";
+ file=$2 "";
+ }
+ {
+ print "# dir = ", dir, "file = ", file
+ mf[dir] = mf[dir]" "src"/"dir"/"file;
+ } END {
+ for (d in mf) {
+ if (d != ".") { print("mkdir -p "d) }
+ print("ln -sf "mf[d]" "d);
+ }
+ }' src="$src" > UU/mksymlinks.$$
+ sh UU/mksymlinks.$$
+ rm UU/mksymlinks.$$
# 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
exit 1
fi
+ if test ! -f win32/win32.c; then
+ echo "Failed to create the symlinks (win32/win32.c missing). Aborting." >&4
+ exit 1
+ fi
cd UU
;;
*) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
--
1.7.10.4
|
From andrew@afresh1.comOn Tue, Jun 24, 2014 at 08:14:25PM -0700, Tony Cook via RT wrote:
This seems to work for me, I think that generating the script is a great I would like to see proper whitespace but that is not up to me. I assume there is a way to do this in a single awk processes since there
-- Software doesn't do what you want it to do, it does what you tell it do. |
From @tonycozOn Tue Jun 24 20:14:25 2014, tonyc wrote:
Applied as 7191ba8. Tony |
@tonycoz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#122002 (status was 'resolved')
Searchable as RT122002$
The text was updated successfully, but these errors were encountered: