diff options
author | Manoj Srivastava <srivasta@debian.org> | 2020-05-22 02:35:58 -0700 |
---|---|---|
committer | Manoj Srivastava <srivasta@debian.org> | 2020-05-22 02:35:58 -0700 |
commit | 06898965a118773d86ed2ef80304c0ce08fd83f8 (patch) | |
tree | 4781f7213292c5af2ae6d23a9991fb55b5e995e3 /ucf | |
parent | f0717935b92fbfa95c5caaaf4cda2d0d117062cb (diff) |
bug(quote) Fix a quoting bug that triggered on dashdebian/3.0042archive/debian/3.0042
So this is something, one I didn't know about:
In bash and dash,
var=$(something)
works as expected even if that ``something`` contains spaces, like in
var=$(date '+%F %T')
Things are however different in dash if you're within a function and
want to limit the scope, i.e.
local var=$(date '+%F %T')
Quite frankly, I haven't checked which shell implementation does not
follow the specification, if any, or if this is just another bashism.
Quoting fixes this
Signed-off-by: Manoj Srivastava <srivasta@debian.org>
Diffstat (limited to 'ucf')
-rwxr-xr-x | ucf | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -82,8 +82,8 @@ run_diff() local new_file="$4" # Note: get_file_metadata not in quotes to ignore "\n" characters - local old_file_label=$(get_file_metadata "$old_file") - local new_file_label=$(get_file_metadata "$new_file") + local old_file_label="$(get_file_metadata "$old_file")" + local new_file_label="$(get_file_metadata "$new_file")" [ -e "$old_file" ] || old_file=/dev/null [ -e "$new_file" ] || new_file=/dev/null |