From d35f7bd37cc10e40ae539969e237212def7be566 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Tue, 17 May 2022 11:11:23 +0200 Subject: [PATCH] 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. --- NEWS | 5 ++++- bin/common_finput.cc | 2 ++ tests/core/ltlfilt.test | 16 +++++++++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index a9804623f..204ae4a3b 100644 --- a/NEWS +++ b/NEWS @@ -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 kripke_graph (issue #505). - Bug fixed: + Bugs fixed: - 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) Bugs fixed: diff --git a/bin/common_finput.cc b/bin/common_finput.cc index 559a5f312..6f09601e0 100644 --- a/bin/common_finput.cc +++ b/bin/common_finput.cc @@ -305,6 +305,8 @@ job_processor::process_stream(std::istream& is, int job_processor::process_file(const char* filename) { + col_to_read = 0; + // Special case for stdin. if (filename[0] == '-' && filename[1] == 0) return process_stream(std::cin, filename); diff --git a/tests/core/ltlfilt.test b/tests/core/ltlfilt.test index 501ae94b2..43d50ce06 100755 --- a/tests/core/ltlfilt.test +++ b/tests/core/ltlfilt.test @@ -1,6 +1,6 @@ #! /bin/sh # -*- 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). # # 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` run 1 ltlfilt -f "$f2" --implied-by "$f1" 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 <