Skip to content

Commit

Permalink
Set ORS to empty string instead of NUL in license check script
Browse files Browse the repository at this point in the history
This fixes multiple warnings in bash 4.4:
scripts/check_file_license_apache.sh: line 22: warning: command substitution: ignored null byte in input
and is also more correct since we dont want to inject 0-Bytes into the string
  • Loading branch information
svenklemm authored and RobAtticus committed Dec 4, 2018
1 parent 5e0d1cf commit ecd1465
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions scripts/check_file_license_apache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ FIRST_COMMENT=

if [[ "${FLAG}" == '-c' ]]; then
LICENSE_FILE=${SCRIPTPATH}/c_license_header.h
LICENSE_STRING=`awk 'BEGIN {ORS="\0"}{if($1 == "*/") {print; exit;}} {print}' ${LICENSE_FILE}`
FIRST_COMMENT=`awk 'BEGIN {ORS="\0"}{if($1 == "*/") {print; exit;}} {print}' ${FILE}`
LICENSE_STRING=`awk 'BEGIN {ORS=""}{if($1 == "*/") {print; exit;}} {print}' ${LICENSE_FILE}`
FIRST_COMMENT=`awk 'BEGIN {ORS=""}{if($1 == "*/") {print; exit;}} {print}' ${FILE}`
elif [[ "${FLAG}" == '-s' ]]; then
LICENSE_FILE=${SCRIPTPATH}/sql_license.sql
LICENSE_STRING=`awk 'BEGIN {ORS="\0"}{if($1 == "") {print; exit;}} {print}' ${SCRIPTPATH}/sql_license.sql`
FIRST_COMMENT=`awk 'BEGIN {ORS="\0"}{if($1 == "") {print; exit;}} {print}' ${FILE}`
LICENSE_STRING=`awk 'BEGIN {ORS=""}{if($1 == "") {print; exit;}} {print}' ${SCRIPTPATH}/sql_license.sql`
FIRST_COMMENT=`awk 'BEGIN {ORS=""}{if($1 == "") {print; exit;}} {print}' ${FILE}`
elif [[ "${FLAG}" == '-t' ]]; then
LICENSE_FILE=${SCRIPTPATH}/test_license.sql
LICENSE_STRING=`awk 'BEGIN {ORS="\0"}{if($1 == "") {print; exit;}} {print}' ${SCRIPTPATH}/test_license.sql`
FIRST_COMMENT=`awk 'BEGIN {ORS="\0"}{if($1 == "") {print; exit;}} {print}' ${FILE}`
LICENSE_STRING=`awk 'BEGIN {ORS=""}{if($1 == "") {print; exit;}} {print}' ${SCRIPTPATH}/test_license.sql`
FIRST_COMMENT=`awk 'BEGIN {ORS=""}{if($1 == "") {print; exit;}} {print}' ${FILE}`
else
echo "Unkown flag" ${1}
exit 1;
Expand Down

0 comments on commit ecd1465

Please sign in to comment.