Make log redirection saner
My main motivation was to remove the "sync", which can stall for
minutes on a busy machine (FS#23378). I also cleaned up the redirection. Signed-off-by: Jan Steffens <jan.steffens@gmail.com> --- scripts/makepkg.sh.in | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 5742c49..0b3891e 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -794,15 +794,14 @@ run_function() { # ensure overridden package variables survive tee with split packages logpipe=$(mktemp -u "$startdir/logpipe.XXXXXXXX") mkfifo "$logpipe" - exec 3>&1 - tee "$BUILDLOG" < "$logpipe" & - exec 1>"$logpipe" 2>"$logpipe" + tee "$BUILDLOG" < "$logpipe" & teepid=$! + restoretrap=$(trap -p ERR) trap 'error_function $pkgfunc' ERR - $pkgfunc 2>&1 + $pkgfunc &>"$logpipe" eval $restoretrap - sync - exec 1>&3 2>&3 3>&- + + wait $teepid rm "$logpipe" else restoretrap=$(trap -p ERR) -- 1.7.4.1 |
Make log redirection saner
On Thu, Mar 24, 2011 at 7:30 AM, Jan Steffens <jan.steffens@gmail.com> wrote:
> My main motivation was to remove the "sync", which can stall for > minutes on a busy machine (FS#23378). I also cleaned up the redirection. > > Signed-off-by: Jan Steffens <jan.steffens@gmail.com> Fine with the patch, but can I ask how rigorous the testing is this has gone through? I'd want to be relatively certain we don't regress here since this will land on maint. -Dan > --- > *scripts/makepkg.sh.in | * 11 +++++------ > *1 files changed, 5 insertions(+), 6 deletions(-) > > diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in > index 5742c49..0b3891e 100644 > --- a/scripts/makepkg.sh.in > +++ b/scripts/makepkg.sh.in > @@ -794,15 +794,14 @@ run_function() { > * * * * * * * *# ensure overridden package variables survive tee with split packages > * * * * * * * *logpipe=$(mktemp -u "$startdir/logpipe.XXXXXXXX") > * * * * * * * *mkfifo "$logpipe" > - * * * * * * * exec 3>&1 > - * * * * * * * tee "$BUILDLOG" < "$logpipe" & > - * * * * * * * exec 1>"$logpipe" 2>"$logpipe" > + * * * * * * * tee "$BUILDLOG" < "$logpipe" & teepid=$! > + > * * * * * * * *restoretrap=$(trap -p ERR) > * * * * * * * *trap 'error_function $pkgfunc' ERR > - * * * * * * * $pkgfunc 2>&1 > + * * * * * * * $pkgfunc &>"$logpipe" > * * * * * * * *eval $restoretrap > - * * * * * * * sync > - * * * * * * * exec 1>&3 2>&3 3>&- > + > + * * * * * * * wait $teepid > * * * * * * * *rm "$logpipe" > * * * *else > * * * * * * * *restoretrap=$(trap -p ERR) > -- > 1.7.4.1 > > > |
Make log redirection saner
On 25/03/11 05:07, Dan McGee wrote:
On Thu, Mar 24, 2011 at 7:30 AM, Jan Steffens<jan.steffens@gmail.com> wrote: My main motivation was to remove the "sync", which can stall for minutes on a busy machine (FS#23378). I also cleaned up the redirection. Signed-off-by: Jan Steffens<jan.steffens@gmail.com> Fine with the patch, but can I ask how rigorous the testing is this has gone through? I'd want to be relatively certain we don't regress here since this will land on maint. I have tested this against all situations I can remember that the original logpipe stuff was supposed to have fixed. Unless I am missing something, this is good to go with the minor change I show below. Version with that change is on my working-maint branch. --- scripts/makepkg.sh.in | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 5742c49..0b3891e 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -794,15 +794,14 @@ run_function() { # ensure overridden package variables survive tee with split packages logpipe=$(mktemp -u "$startdir/logpipe.XXXXXXXX") mkfifo "$logpipe" - exec 3>&1 - tee "$BUILDLOG"< "$logpipe"& - exec 1>"$logpipe" 2>"$logpipe" + tee "$BUILDLOG"< "$logpipe"& teepid=$! put these on separate lines and make teepid local. tee "$BUILDLOG" < "$logpipe" & local teepid=$! restoretrap=$(trap -p ERR) trap 'error_function $pkgfunc' ERR - $pkgfunc 2>&1 + $pkgfunc&>"$logpipe" eval $restoretrap - sync - exec 1>&3 2>&3 3>&- + + wait $teepid rm "$logpipe" else restoretrap=$(trap -p ERR) -- 1.7.4.1 |
Make log redirection saner
On Thu, Mar 24, 2011 at 8:07 PM, Dan McGee <dpmcgee@gmail.com> wrote:
> Fine with the patch, but can I ask how rigorous the testing is this > has gone through? I'd want to be relatively certain we don't regress > here since this will land on maint. > > -Dan I did some simple tests using a minimal PKGBUILD. makepkg -L still creates logs as before, and parameters can be correctly overwritten by package functions. |
| All times are GMT. The time now is 09:46 PM. |
VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.