On 23 February 2016 at 23:15, Vincent Belaïche <vincent.belai...@gmail.com> wrote: > > OK, I got it. The problem is in function filter_files. Unfortunately > when we made the changes to solve the missing \openout in log problem, > we did not make any tests with not any new xref files after the first > run. When this happens (ie variable xref_files_new empty) the function > filter_files crashes and exits the script. I have not really understood > the details why, but the attached patch fixes that. > > It would be good to understand exactly what is happening with the bug > because there are similar pieces of coding for instance in > > if test -n "$COMSPEC$ComSpec" \ > && MSYSTEM=$OSTYPE uname | $EGREP -iv 'cygwin|msys' >/dev/null; then > > which was also changed at the same time.
Thanks for sending the patch, can you send a ChangeLog entry as well and I'll install it? The conditionals with "if" should be OK. I think I've seen a bug like this before. The function has only one line: test -n "$xref_files_new" && echo "$xref_files_new" | # Filter existing files matching the criterion. # while read file; do $1 "$file" done | sort | # Some files are opened several times, e.g., listings.sty's *.vrb. uniq This would not normally cause an exit with set -e. From (bash)The Set Builtin: `-e' Exit immediately if a pipeline (*note Pipelines::), which may consist of a single simple command (*note Simple Commands::), a subshell command enclosed in parentheses (*note Command Grouping::), or one of the commands executed as part of a command list enclosed by braces (*note Command Grouping::) returns a non-zero status. The shell does not exit if the command that fails is part of the command list immediately following a `while' or `until' keyword, part of the test in an `if' statement, part of any command executed in a `&&' or `||' list except the command following the final `&&' or `||', any command in a pipeline but the last, or if the command's return status is being inverted with `!'. A trap on `ERR', if set, is executed before the shell exits. However, it's hidden inside a function, so the exception for && and || doesn't apply, apparently. Any use of && for a conditional is suspect.