diff options
author | Jan Uhlig <[email protected]> | 2017-10-17 16:24:27 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2017-10-17 16:24:27 +0200 |
commit | f92e215ed3e88b027bbdf4bfb7260aa0305d917f (patch) | |
tree | 33f8f122664a25bc0e356aab7d3c1760388e277b /priv/templates/extended_bin | |
parent | c0e3e93a01da2d8659bb87e80b695cc24ccd40c2 (diff) | |
download | relx-f92e215ed3e88b027bbdf4bfb7260aa0305d917f.tar.gz relx-f92e215ed3e88b027bbdf4bfb7260aa0305d917f.tar.bz2 relx-f92e215ed3e88b027bbdf4bfb7260aa0305d917f.zip |
more sophisticated args_file checks
- distinction between non-existing and existing but non-readable args_file
- fixed circularity check to include the base vm.args file
Diffstat (limited to 'priv/templates/extended_bin')
-rwxr-xr-x | priv/templates/extended_bin | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/priv/templates/extended_bin b/priv/templates/extended_bin index 3822205..1834619 100755 --- a/priv/templates/extended_bin +++ b/priv/templates/extended_bin @@ -306,27 +306,31 @@ set +e TMP_NAME_ARG=$(awk 'function check_name(file) { if (system("test -f "file)) { - print "File \""file"\" not found" - exit 1 + print file" not found" + exit 3 + } + if (system("test -r "file)) { + print file" not readable" + exit 3 } while ((getline line<file)>0) { if (line~/^-args_file +/) { gsub(/^-args_file +| *$/, "", line) if (!(line~/^\//)) { - print "Relative path \""line"\" encountered in "file - exit 1 + print "relative path "line" encountered in "file + exit 4 } if (line in files) { - print "Circular reference to \""line"\" encountered in "file - exit 1 + print "circular reference to "line" encountered in "file + exit 5 } files[line]=line check_name(line) } else if (line~/^-s?name +/) { if (name!="") { - print "\""line"\" found in "file" but specified before as \""name"\"" - exit 1 + print "\""line"\" parameter found in "file" but already specified as \""name"\"" + exit 2 } name=line } @@ -339,20 +343,23 @@ BEGIN { } { + files[FILENAME]=FILENAME check_name(FILENAME) if (name=="") { - print "Need to have exactly one of either -name or -sname parameters but none found" + print "need to have exactly one of either -name or -sname parameters but none found" exit 1 } print name exit 0 }' "$VMARGS_PATH") -case $? in +TMP_NAME_ARG_RC=$? +case $TMP_NAME_ARG_RC in 0) NAME_ARG="$TMP_NAME_ARG";; *) echo "$TMP_NAME_ARG" - exit 1;; + exit $TMP_NAME_ARG_RC;; esac unset TMP_NAME_ARG +unset TMP_NAME_ARG_RC set -e # Perform replacement of variables in ${NAME_ARG} |