[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: speed up gnulib-tool a bit
From: |
Eric Blake |
Subject: |
Re: speed up gnulib-tool a bit |
Date: |
Mon, 25 Sep 2006 21:19:41 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Bruno Haible <bruno <at> clisp.org> writes:
>
> > To be safe, I think you
> > need to `exec <$file', or, restoring stdin, something like this:
> > exec 5<&1 <$file
> > while read r
> > do
> > $whatever
> > done
> > exec <&5 5<&-
>
> Astonishing. I never saw this kind of low-level shell programming.
> Applied; see attached patch.
>
...
> "$tmp"/added-files
> ! { # Rearrange file descriptors. Needed because "while ... done < ..."
> ! # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
> ! exec 5<&1 < "$tmp"/added-files
> ! while read g f; do
> ! func_add_or_update
> ! done
> ! exec 1<&5 5<&-
Wait a minute. You are reassigning and restoring stdout for the duration of
the func_add_or_update, not stdin, thus leaving stdin open on a temp file. As
a result, platforms like cygwin where a directory cannot be deleted while a
file is still open within that directory are now ALWAYS producing a warning
along these lines:
$ gnulib-tool --update
...
Don't forget to
- add "gnu/Makefile" to AC_CONFIG_FILES in ./configure.ac,
- mention "gnu" in SUBDIRS in Makefile.am,
- mention "-I ltdl/m4" in ACLOCAL_AMFLAGS in Makefile.am,
- invoke M4_EARLY in ./configure.ac, right after AC_PROG_CC,
- invoke M4_INIT in ./configure.ac.
rm: cannot remove directory `/tmp/gljj4484': Directory not empty
$
I'm applying this as the obvious fix.
2006-09-25 Eric Blake <address@hidden>
* gnulib-tool (func_import, func_create_testdir): Fix typos in
2006-09-18 patch.
Index: gnulib-tool
===================================================================
RCS file: /sources/gnulib/gnulib/gnulib-tool,v
retrieving revision 1.172
diff -u -r1.172 gnulib-tool
--- gnulib-tool 22 Sep 2006 15:43:18 -0000 1.172
+++ gnulib-tool 25 Sep 2006 21:17:17 -0000
@@ -1691,11 +1691,11 @@
| sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files"
> "$tmp"/added-files
{ # Rearrange file descriptors. Needed because "while ... done < ..."
# constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
- exec 5<&1 < "$tmp"/added-files
+ exec 5<&0 < "$tmp"/added-files
while read g f; do
func_add_or_update
done
- exec 1<&5 5<&-
+ exec <&5 5<&-
}
# Then the files that are in new-files and in old-files:
already_present=true
@@ -1704,11 +1704,11 @@
| sed -e "s,^.*\$,&$delimiter&," -e "$sed_rewrite_new_files" > "$tmp"/kept-
files
{ # Rearrange file descriptors. Needed because "while ... done < ..."
# constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
- exec 5<&1 < "$tmp"/kept-files
+ exec 5<&0 < "$tmp"/kept-files
while read g f; do
func_add_or_update
done
- exec 1<&5 5<&-
+ exec <&5 5<&-
}
# Command-line invocation printed in a comment in generated gnulib-cache.m4.
@@ -2099,7 +2099,7 @@
> "$tmp"/files
{ # Rearrange file descriptors. Needed because "while ... done < ..."
# constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
- exec 5<&1 < "$tmp"/files
+ exec 5<&0 < "$tmp"/files
while read g f; do
func_lookup_file "$f"
if test -n "$lookedup_tmp"; then
@@ -2113,7 +2113,7 @@
fi
fi
done
- exec 1<&5 5<&-
+ exec <&5 5<&-
}
# Create $sourcebase/Makefile.am.
Re: speed up gnulib-tool a bit, Bruno Haible, 2006/09/18