Martin Eberhard Schauer wrote:
> It should be considered whether the intended intentation is a must.
>
> #. Type: text
> #. Description
> #. The "-" is used to indicate indentation. Leading spaces may not work.
> #: ../grub-pc.templates.in:6001
> #| msgid "${DEVICE} (${SIZE} MB, ${MODEL})"
> msgid "- ${DEVICE} (${SIZE} MB, ${PATH})"
> msgstr "- ${DEVICE} (${SIZE} MB, ${PATH})"
>
> There are no error messages without the minus sign.

This bug can be reproduced by running the following command:
  $ whiptail --msgbox '- ${DEVICE} (${SIZE} Mo, ${PATH})' 7 35
  - ${DEVICE} (${SIZE} Mo, ${PATH}): unknown option

See whiptail(1):
  NOTES
     whiptail interprets arguments starting with a dash "-" as being
arguments.  To avoid this, and start some text in, for example, a
menubox item, with a dash, whiptail honours the getopt convention of
accepting the special argument "--" which means that all following
arguments with dashes are to be treated verbatim and not parsed as
options.

IMHO this bugreport should be reassigned to debconf, frontends should
take care of their peculiarities.  Here is a patch against
/usr/share/perl5/Debconf/FrontEnd/Dialog.pm to show how this problem
could get fixed.

I did not carefully check, but grub-pc seems to use this string to
substitute text, so it may not be affected by this bug.

Denis
--- /usr/share/perl5/Debconf/FrontEnd/Dialog.pm.orig
+++ /usr/share/perl5/Debconf/FrontEnd/Dialog.pm
@@ -119,10 +119,13 @@
 	my @lines = split(/\n/, $text);
 	my $num;
 	my @args=('--msgbox', join("\n", @lines));
+	if ($this->program eq 'whiptail' && $text =~ m/^-/s) {
+		@args=('--msgbox', '--', join("\n", @lines));
+	}
 	if ($lines - 4 - $this->borderheight <= $#lines) {
 		$num=$lines - 4 - $this->borderheight;
 		if ($this->program eq 'whiptail') {
-			push @args, '--scrolltext';
+			unshift @args, '--scrolltext';
 		}
 		else {
 			my $fh=Debconf::TmpFile::open();

Reply via email to