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:
Cody Boone Ferguson committed 2024-11-14 13:00:19 -08:00
1 parent 83829cc746
commit 38ecf1f280
12 files changed
+167 -167

No files matched your search

+14 -14
View File
@@ -113,21 +113,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
@@ -441,9 +441,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]: DOCROOT_SLASH=$DOCROOT_SLASH" 1>&2
echo "$0: debug[3]: TAGLINE=$TAGLINE" 1>&2
echo "$0: debug[3]: MD2HTML_SH=$MD2HTML_SH" 1>&2
@@ -593,7 +593,7 @@ find "$AUTHOR_DIR" -mindepth 1 -maxdepth 1 -type f -name '*.json' -print |
# obtain the author full name
#
PATTERN='$..full_name'
FULL_NAME=$("$JVAL_WRAPPER" -b -q "$AUTHOR_HANDLE_JSON" "$PATTERN" | "$JSTRENCODE" -N -)
FULL_NAME=$("$JVAL_WRAPPER" -b -q "$AUTHOR_HANDLE_JSON" "$PATTERN" | "$JSTRDECODE" -N -)
status_codes=("${PIPESTATUS[@]}")
if [[ ${status_codes[*]} =~ [1-9] || -z $FULL_NAME ]]; then
echo "$0: ERROR: cannot full name from: $AUTHOR_HANDLE" 1>&2