Hi Jamie--

Thanks for the proposed patch.  I'm not sure how to test it directly,
but it seems a bit overzealous to me -- it's trying to read from stdin
even when a logging argument was passed to it.

I suspect this only passes the test suite because the log level is set
to DEBUG in the test suite; otherwise i'd expect a hang.

I think we need a more finely-tuned patch to get this to work.

        --dkg

On 11/25/2014 04:33 PM, Jameson Graef Rollins wrote:
> If a lot message is not intended for output, it can close the input
> pipe prematurely, which can trigger a sigpipe error.  Instead, always
> redirect input somewhere, so that the input pipe is not prematuring
> closed.  This should help fix the SIGPIPE error that we're seeing in
> 
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=635711
> ---
>  src/share/common | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/src/share/common b/src/share/common
> index 1a228b0..ae67697 100755
> --- a/src/share/common
> +++ b/src/share/common
> @@ -36,6 +36,7 @@ log() {
>      local priority
>      local level
>      local output
> +    local finalout
>      local alllevels
>      local found=
>  
> @@ -50,6 +51,7 @@ log() {
>  
>      # just go ahead and return if the log level is silent
>      if [ "$LOG_LEVEL" = 'SILENT' ] ; then
> +     cat >/dev/null
>       return
>      fi
>  
> @@ -76,13 +78,18 @@ log() {
>           output=true
>       fi
>       if [ "$priority" = "$level" -a "$output" = 'true' ] ; then
> -         if [ "$1" ] ; then
> -             echo "$@"
> -         else
> -             cat
> -         fi | sed 's/^/'"${LOG_PREFIX}"'/' >&2
> +         finalout=true
>       fi
>      done
> +    if [ "$finalout" = 'true' ] ; then
> +     if [ "$1" ] ; then
> +         echo "$@"
> +     else
> +         cat
> +     fi | sed 's/^/'"${LOG_PREFIX}"'/' >&2
> +    else
> +     cat >/dev/null
> +    fi
>  }
>  
>  # run command as monkeysphere user
> 

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to