bin: reset column specification between files

* bin/common_finput.cc (job_processor::process_file): Reset
col_to_read.
* tests/core/ltlfilt.test: Test it.
* NEWS: Mention the bug.
This commit is contained in:
Alexandre Duret-Lutz 2022-05-17 11:11:23 +02:00
parent d697f57a97
commit d35f7bd37c
3 changed files with 21 additions and 2 deletions

5
NEWS
View file

@ -87,10 +87,13 @@ New in spot 2.10.5.dev (not yet released)
print_hoa() will now use state numbers matching those of the print_hoa() will now use state numbers matching those of the
kripke_graph (issue #505). kripke_graph (issue #505).
Bug fixed: Bugs fixed:
- Fix compilation error on MacOS X. - Fix compilation error on MacOS X.
- Using -Ffile/N to read column N of a CSV file would not reset the
/N specification for the next file.
New in spot 2.10.5 (2022-05-03) New in spot 2.10.5 (2022-05-03)
Bugs fixed: Bugs fixed:

View file

@ -305,6 +305,8 @@ job_processor::process_stream(std::istream& is,
int int
job_processor::process_file(const char* filename) job_processor::process_file(const char* filename)
{ {
col_to_read = 0;
// Special case for stdin. // Special case for stdin.
if (filename[0] == '-' && filename[1] == 0) if (filename[0] == '-' && filename[1] == 0)
return process_stream(std::cin, filename); return process_stream(std::cin, filename);

View file

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2013-2020 Laboratoire de Recherche et Développement de # Copyright (C) 2013-2020, 2022 Laboratoire de Recherche et Développement de
# l'Epita (LRDE). # l'Epita (LRDE).
# #
# This file is part of Spot, a model checking library. # This file is part of Spot, a model checking library.
@ -562,3 +562,17 @@ f1=`genltl --pps-arbiter-standard=2`
f2=`genltl --pps-arbiter-strict=2` f2=`genltl --pps-arbiter-strict=2`
run 1 ltlfilt -f "$f2" --implied-by "$f1" run 1 ltlfilt -f "$f2" --implied-by "$f1"
run 0 ltlfilt -f "$f1" --implied-by "$f2" run 0 ltlfilt -f "$f1" --implied-by "$f2"
# Reading two different columns of the same file
echo a,b > file
run 0 ltlfilt -Ffile/1 -Ffile/2 --stats=%f >out
cat >expected <<EOF
a
b
EOF
diff expected out
# We used to have a bug where a column specification on one file
# would stick to the rest of the file unless overridden.
run 2 ltlfilt -Ffile/1 -Ffile
: