[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
error message of ${A:?} and ${A?} should be different
From: |
gergely |
Subject: |
error message of ${A:?} and ${A?} should be different |
Date: |
Tue, 02 Oct 2007 00:32:06 +0200 |
Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -g -O2
uname output: Linux machine 2.6.21-1-686 #1 SMP Sat May 26 16:14:59 UTC 2007
i686 GNU/Linux
Machine Type: i686-pc-linux-gnu
Bash Version: 3.2
Patch Level: 0
Release Status: release
Description:
risko@bubble:/tmp/x/bash-3.2$ echo ${A?}
bash: A: parameter null or not set
risko@bubble:/tmp/x/bash-3.2$ echo ${A:?}
bash: A: parameter null or not set
risko@bubble:/tmp/x/bash-3.2$ A=
risko@bubble:/tmp/x/bash-3.2$ echo ${A:?}
bash: A: parameter null or not set
risko@bubble:/tmp/x/bash-3.2$ echo ${A?}
<no error message>
I don't like the first error message. It should say something like
"bash: A: parameter not set", because I have omitted the colon.
Repeat-By:
See description.
Fix:
--- subst.c.orig 2007-10-02 00:28:55.000000000 +0200
+++ subst.c 2007-10-02 00:30:55.000000000 +0200
@@ -267,7 +267,7 @@
static WORD_DESC *parameter_brace_expand_word __P((char *, int, int));
static WORD_DESC *parameter_brace_expand_indir __P((char *, int, int, int *,
int *));
static WORD_DESC *parameter_brace_expand_rhs __P((char *, char *, int, int,
int *, int *));
-static void parameter_brace_expand_error __P((char *, char *));
+static void parameter_brace_expand_error __P((char *, char *, int));
static int valid_length_expression __P((char *));
static intmax_t parameter_brace_expand_length __P((char *));
@@ -5050,8 +5050,9 @@
used as the error message to print, otherwise a standard message is
printed. */
static void
-parameter_brace_expand_error (name, value)
+parameter_brace_expand_error (name, value, check_nullness)
char *name, *value;
+ int check_nullness;
{
WORD_LIST *l;
char *temp;
@@ -5065,7 +5066,12 @@
dispose_words (l);
}
else
- report_error (_("%s: parameter null or not set"), name);
+ {
+ if (check_nullness)
+ report_error (_("%s: parameter null or not set"), name);
+ else
+ report_error (_("%s: parameter not set"), name);
+ }
/* Free the data we have allocated during this expansion, since we
are about to longjmp out. */
@@ -6259,7 +6265,7 @@
}
else if (c == '?')
{
- parameter_brace_expand_error (name, value);
+ parameter_brace_expand_error (name, value, check_nullness);
return (interactive_shell ? &expand_wdesc_error :
&expand_wdesc_fatal);
}
else if (c != '+')
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- error message of ${A:?} and ${A?} should be different,
gergely <=