mirror of https://github.com/ecmwf/eccodes.git
ECC-1350: grib_compare: Incorrect behaviour when first file argument is a directory
This commit is contained in:
parent
0983c36493
commit
1c6ff5d65e
|
@ -36,16 +36,32 @@ ${tools_dir}/grib_compare -r temp.$label.213 temp.$label.321
|
|||
|
||||
rm -f temp.$label.1 temp.$label.2 temp.$label.3 temp.$label.213 temp.$label.321
|
||||
|
||||
# ----------------------------------------
|
||||
# ----------------------------------------------
|
||||
# GRIB-797: test last argument being a directory
|
||||
# ----------------------------------------
|
||||
temp_dir=tempdir.grib_compare
|
||||
# ----------------------------------------------
|
||||
temp_dir=tempdir.$label
|
||||
rm -rf $temp_dir
|
||||
mkdir $temp_dir
|
||||
cp $infile $temp_dir
|
||||
${tools_dir}/grib_compare $infile $temp_dir
|
||||
rm -rf $temp_dir
|
||||
|
||||
# ----------------------------------------
|
||||
# ECC-1350: First arg is a directory
|
||||
# ----------------------------------------
|
||||
temp_dir=tempdir.$label
|
||||
temp_err=temp.$label.err
|
||||
rm -rf $temp_dir
|
||||
mkdir $temp_dir
|
||||
set +e
|
||||
${tools_dir}/grib_compare $temp_dir $temp_dir 2>$temp_err
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -eq 1 ]
|
||||
grep -q "ERROR:.*Is a directory" $temp_err
|
||||
rm -rf $temp_dir
|
||||
|
||||
|
||||
# ----------------------------------------
|
||||
# ECC-245: blacklist and 2nd order packing
|
||||
# ----------------------------------------
|
||||
|
|
|
@ -252,6 +252,9 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
context->blocklist = blocklist;
|
||||
}
|
||||
|
||||
/* Check 1st file is not a directory */
|
||||
exit_if_input_is_directory(tool_name, options->infile_extra->name);
|
||||
|
||||
if (grib_options_on("r")) {
|
||||
char* filename[1];
|
||||
filename[0] = options->infile_extra->name; /* First file */
|
||||
|
|
Loading…
Reference in New Issue