Hi!

On Thu, 2012-07-12 at 19:22:42 +0200, Bernhard R. Link wrote:
> Package: dpkg-dev
> Version: 1.16.4.3
> Severity: normal
> Tags: patch
> 
> Some error messages (especially about wrong command line
> options) output the usage information as part of the
> error message but outputs those to stdout, making it
> impossible to keep expected information and error messages
> seperate.

Thanks, although I've solved this locally in a different way, see
below.

> From: "Bernhard R. Link" <brl...@debian.org>
> Date: Thu, 12 Jul 2012 18:24:47 +0200
> Subject: [PATCH] scripts: do not output usage part of error message to stdout
> 
> Add an optional argument to usage() functions to determine
> an file descriptor to output to. This way --help output still
> can go to stdout where it belongs to while the usage part of
> error messages does not garble the stdout.

I've just switched usageerr() to use a default string pointing to the
--help command, which does not clutter the output any longer, avoids
this problem entirely, and stops calling usage() from the main
namespace at the same time.

> diff --git a/scripts/dpkg-maintscript-helper.sh 
> b/scripts/dpkg-maintscript-helper.sh
> index 48793b8..7cef27d 100755
> --- a/scripts/dpkg-maintscript-helper.sh
> +++ b/scripts/dpkg-maintscript-helper.sh
> @@ -250,7 +250,7 @@ END
>  }
>  
>  badusage() {
> -     usage
> +     usage >&2
>       exit 1
>  }

I've switched this to print meaningful error messages instead, per
caller.

> diff --git a/scripts/dpkg-scansources.pl b/scripts/dpkg-scansources.pl
> index 67050e6..f5f22b8 100755
> --- a/scripts/dpkg-scansources.pl
> +++ b/scripts/dpkg-scansources.pl
> @@ -63,7 +63,7 @@ my $Extra_override_file = undef;
>  
>  my @Option_spec = (
>      'debug!'         => \$Debug,
> -    'help|?'         => \&usage,
> +    'help|?'         => sub { usage(); exit 0; },
>      'no-sort|n'              => \$No_sort,
>      'source-override|s=s' => \$Src_override,
>      'extra-override|e=s' => \$Extra_override_file,

I've split this into a distinct patch, and removed the exit call from
usage().

thanks,
guillem


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to