| 1 |
#!/bin/sh -vx |
| 2 |
# $Id: cnfnull.test 68093 2023-08-27 23:29:25Z takuji $ |
| 3 |
# Copyright 2020 Karl Berry <[email protected]> |
| 4 |
# You may freely use, modify and/or distribute this file. |
| 5 |
# |
| 6 |
# Test nul (zero) bytes in texmf.cnf. |
| 7 |
|
| 8 |
BinDir=${BinDir:-.} |
| 9 |
ExeExt=${ExeExt:-} |
| 10 |
_kpsewhich=$BinDir/kpsewhich$ExeExt |
| 11 |
|
| 12 |
cnf_dir=cnfnull |
| 13 |
cnf_file=$cnf_dir/texmf.cnf |
| 14 |
|
| 15 |
# Create the texmf.cnf dynamically so we don't have to check in a file |
| 16 |
# containing nul bytes. |
| 17 |
rm -rf $cnf_dir |
| 18 |
mkdir $cnf_dir |
| 19 |
test -d $cnf_dir || exit 1 |
| 20 |
printf 'x\0=1\n\0' >$cnf_file || exit 2 |
| 21 |
|
| 22 |
val=`$_kpsewhich "--cnf-line=TEXMFCNF=$cnf_dir" --var-value=x` |
| 23 |
if [ "$ExeExt" = ".exe" ]; then val=`echo $val | sed -e 's/\\r//'`; fi |
| 24 |
test x"$val" = x1 || exit 3 |
| 25 |
|
| 26 |
# Before we dropped nul bytes in 2020, kpse gave a warning: |
| 27 |
# warning: cnfnull/texmf.cnf:1: (kpathsea) No cnf value on line: x. |
| 28 |
# and did not assign anything (since the string ended with the x). |