Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix FATAL, ERROR, MATCH and NOMATCH to use
The variables $@ and $* differ subtly in how they are expanded. - $* expands to a single value with all the arguments of the program or function joined with spaces, or by the first character of the $IFS variable, to be precise. Usually $* is used in messages where the individual arguments and their count is irrelevant. - $@ is just like $*, _except_ when in double-quoted string "$@". This form expands to multiple values, properly quoted, so that one set of arguments can be passed safely and correctly into another function. The aforementioned macros, FATAL, ERROR, MATCH and NOMATCH all used $@ where $* was expected, and thus only really worked with a single value. For most cases this was okay but the little used FATAL and ERROR macros can plausibly take a message like: FATAL "cannot allocate instance" Due to the way arguments were passed inside, that would not work as the parsing routines looking for FATAL and ERROR in spread would only take the first word into account: "cannot", which usually strips the user of vital error detail. The case of MATCH and NOMATCH is more subtle, as usually a single pattern is provided. In general, $* should be used in those cases as $@ does not really do anything different in the error case (the message is the same) but the code is somewhat on the edge of correctness so I chose to adjust them as well. Signed-off-by: Zygmunt Krynicki <[email protected]>
- Loading branch information