Sun 13 Apr 2014 05:51:39 AM UTC, comment #5:
Just to communicate where the real problem lies as reported by pkgsrc users (Mr Clausen and Mr Zingelman), the following snippet is not supported by certain shells, namely pdksh and older bash (prior to 2.04) and older ksh.
# "Citation undefined" is for LaTeX, "Undefined citation" for btxmac.tex.
# The no .aux && \bibdata test is also for btxmac, in case it was the
# first run of a bibtex-using document. Otherwise, it's possible that
# bibtex would never be run.
if test -r "$in_noext.aux" \
&& test -r "$in_noext.log" \
&& ((grep 'Warning:.Citation.undefined' "$in_noext.log" \
|| grep '.*Undefined citation' "$in_noext.log" \
|| grep 'No file .*\.bbl\.' "$in_noext.log") \
|| (grep 'No \.aux file' "$in_noext.log" \
&& grep '^\\bibdata' "$in_noext.aux")) \
>&6 2>&1; \
then
for f in `generated_files_get "$in_noext" bibaux_file_p`; do
run $bibtex "$f"
done
fi
=============
the '((grep...))' is the cause...
If I quote, for a simple example, the bash manpage:
((expression))
The expression is evaluated according to the rules
described below under ARITHMETIC EVALUATION. If the
value of the expression is non-zero, the return status
is 0; otherwise the return status is 1. This is
exactly equivalent to let "expression".
for example on netbsd, the following happens when runnig the snippet(called here as bug48075.sh):
> -bash-4.2$ ksh bug48075.sh
> bug48075.sh[5]: syntax error: `if' unmatched
> bug48075.sh[18]:
> -bash-4.2$ pdksh bug48075.sh
> bug48075.sh[5]: syntax error: `if' unmatched
> -bash-4.2$ sh bug48075.sh
> -bash-4.2$ bash bug48075.sh
> -bash-4.2$
One solution is to insert a space as follows:
@@ -1103,7 +1103,7 @@
# bibtex would never be run.
if test -r "$in_noext.aux" \
&& test -r "$in_noext.log" \
- && ((grep 'Warning:.Citation.undefined' "$in_noext.log" \
+ && ( (grep 'Warning:.Citation.undefined' "$in_noext.log" \
|| grep '.*Undefined citation' "$in_noext.log" \
|| grep 'No file .*\.bbl\.' "$in_noext.log") \
|| (grep 'No \.aux file' "$in_noext.log" \
In the end, this could/should be fixed in a portable fashion here in the upstream source in order to allow older (more strict) shells.
Cordially,
|