Swap out (again) jstrencode for jstrdecode
This happened because when focusing on a bug for several days that had to do with decoding code points (which so happens to be encoding but in JSON it should be converted to unicode even when decoding) I lost sight of the fact that jstrencode is meant to be **JSON** encoder. In the process of this I have uncovered a number of other bugs but that's with jstrencode and the website uses jstrdecode so this should not delay the contest at all.
This commit is contained in:
1 parent
83829cc746
commit
38ecf1f280
12 files changed
+167
-167
No files matched your search
+16
-16
@@ -146,21 +146,21 @@ if [[ -z $VERGE ]]; then
|
||||
exit 5
|
||||
fi
|
||||
#
|
||||
JSTRENCODE=$(type -P jstrencode)
|
||||
export JSTRENCODE
|
||||
if [[ -z $JSTRENCODE ]]; then
|
||||
echo "$0: FATAL: jstrencode is not installed or not in \$PATH" 1>&2
|
||||
echo "$0: notice: to install jstrencode:" 1>&2
|
||||
JSTRDECODE=$(type -P jstrdecode)
|
||||
export JSTRDECODE
|
||||
if [[ -z $JSTRDECODE ]]; then
|
||||
echo "$0: FATAL: jstrdecode is not installed or not in \$PATH" 1>&2
|
||||
echo "$0: notice: to install jstrdecode:" 1>&2
|
||||
echo "$0: notice: run: git clone https://github.com/ioccc-src/mkiocccentry.git" 1>&2
|
||||
echo "$0: notice: then: cd mkiocccentry && make clobber all" 1>&2
|
||||
echo "$0: notice: then: cd jparse && sudo make install clobber" 1>&2
|
||||
exit 5
|
||||
fi
|
||||
export MIN_JSTRENCODE_VERSION="2.0.0"
|
||||
JSTRENCODE_VERSION=$("$JSTRENCODE" -V | head -1 | awk '{print $3;}')
|
||||
if ! "$VERGE" "$JSTRENCODE_VERSION" "$MIN_JSTRENCODE_VERSION"; then
|
||||
echo "$0: FATAL: jstrencode version: $JSTRENCODE_VERSION < minimum version: $MIN_JSTRENCODE_VERSION" 1>&2
|
||||
echo "$0: notice: consider updating jstrencode from mkiocccentry repo" 1>&2
|
||||
export MIN_JSTRDECODE_VERSION="2.0.2"
|
||||
JSTRDECODE_VERSION=$("$JSTRDECODE" -V | head -1 | awk '{print $3;}')
|
||||
if ! "$VERGE" "$JSTRDECODE_VERSION" "$MIN_JSTRDECODE_VERSION"; then
|
||||
echo "$0: FATAL: jstrdecode version: $JSTRDECODE_VERSION < minimum version: $MIN_JSTRDECODE_VERSION" 1>&2
|
||||
echo "$0: notice: consider updating jstrdecode from mkiocccentry repo" 1>&2
|
||||
echo "$0: notice: run: git clone https://github.com/ioccc-src/mkiocccentry.git" 1>&2
|
||||
echo "$0: notice: then: cd mkiocccentry && make clobber all" 1>&2
|
||||
echo "$0: notice: then: cd jparse && sudo make install clobber" 1>&2
|
||||
@@ -378,13 +378,13 @@ function output_abstract
|
||||
#
|
||||
PATTERN='$..abstract'
|
||||
if [[ $V_FLAG -ge 5 ]]; then
|
||||
echo "$0: debug[5]: about to run: $JVAL_WRAPPER -b -q -- $ENTRY_JSON_PATH '$PATTERN' | $JSTRENCODE -N -" 1>&2
|
||||
echo "$0: debug[5]: about to run: $JVAL_WRAPPER -b -q -- $ENTRY_JSON_PATH '$PATTERN' | $JSTRDECODE -N -" 1>&2
|
||||
fi
|
||||
export ABSTRACT
|
||||
ABSTRACT=$("$JVAL_WRAPPER" -b -q "$ENTRY_JSON_PATH" "$PATTERN" | "$JSTRENCODE" -N -)
|
||||
ABSTRACT=$("$JVAL_WRAPPER" -b -q "$ENTRY_JSON_PATH" "$PATTERN" | "$JSTRDECODE" -N -)
|
||||
status_codes=("${PIPESTATUS[@]}")
|
||||
if [[ ${status_codes[*]} =~ [1-9] || -z $ABSTRACT ]]; then
|
||||
echo "$0: ERROR: in output_abstract: $JVAL_WRAPPER -b -q -- $ENTRY_JSON_PATH '$PATTERN' | $JSTRENCODE -N - failed," \
|
||||
echo "$0: ERROR: in output_abstract: $JVAL_WRAPPER -b -q -- $ENTRY_JSON_PATH '$PATTERN' | $JSTRDECODE -N - failed," \
|
||||
"error codes: ${status_codes[*]}" 1>&2
|
||||
return 5
|
||||
fi
|
||||
@@ -660,9 +660,9 @@ if [[ $V_FLAG -ge 3 ]]; then
|
||||
echo "$0: debug[3]: GIT_TOOL=$GIT_TOOL" 1>&2
|
||||
echo "$0: debug[3]: TOPDIR=$TOPDIR" 1>&2
|
||||
echo "$0: debug[3]: VERGE=$VERGE" 1>&2
|
||||
echo "$0: debug[3]: JSTRENCODE=$JSTRENCODE" 1>&2
|
||||
echo "$0: debug[3]: MIN_JSTRENCODE_VERSION=$MIN_JSTRENCODE_VERSION" 1>&2
|
||||
echo "$0: debug[3]: JSTRENCODE_VERSION=$JSTRENCODE_VERSION" 1>&2
|
||||
echo "$0: debug[3]: JSTRDECODE=$JSTRDECODE" 1>&2
|
||||
echo "$0: debug[3]: MIN_JSTRDECODE_VERSION=$MIN_JSTRDECODE_VERSION" 1>&2
|
||||
echo "$0: debug[3]: JSTRDECODE_VERSION=$JSTRDECODE_VERSION" 1>&2
|
||||
echo "$0: debug[3]: NOOP=$NOOP" 1>&2
|
||||
echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2
|
||||
echo "$0: debug[3]: EXIT_CODE=$EXIT_CODE" 1>&2
|
||||
|
||||
Reference in new issue
Block a user