diff --git a/NEWS b/NEWS index 3595c6f1a..b240401dc 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,10 @@ New in spot 2.7.2.dev (not yet released) - Nothing yet. + Bugs fixed: + + - When processing CSV files with MSDOS-style \r\n line endings, + --stats would output the \r as part of the %> sequence instead + of ignoring it. New in spot 2.7.2 (2019-03-17) diff --git a/bin/common_finput.cc b/bin/common_finput.cc index 79900f386..f19e64a6b 100644 --- a/bin/common_finput.cc +++ b/bin/common_finput.cc @@ -154,6 +154,11 @@ job_processor::process_stream(std::istream& is, } else // We are reading column COL_TO_READ in a CSV file. { + // Some people save CSV files with MSDOS encoding, and + // we don't want to include the \r in any %> output. + if (*line.rbegin() == '\r') + line.pop_back(); + // If the line we have read contains an odd number // of double-quotes, then it is an incomplete CSV line // that should be completed by the next lines. diff --git a/tests/core/ltl2tgba2.test b/tests/core/ltl2tgba2.test index 36135587b..11b022023 100755 --- a/tests/core/ltl2tgba2.test +++ b/tests/core/ltl2tgba2.test @@ -1,6 +1,6 @@ #!/bin/sh # -*- coding: utf-8 -*- -# Copyright (C) 2009-2018 Laboratoire de Recherche et Développement de +# Copyright (C) 2009-2019 Laboratoire de Recherche et Développement de # l'Epita (LRDE). # Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6), # département Systèmes Répartis Coopératifs (SRC), Université Pierre @@ -374,8 +374,11 @@ G(F(a & Xa) & F(a & X!a)), 2,4, 2,4, 4,8, 4,8 G(!p0 & F(p1 & XG!p1)), 1,0, 1,0, 1,0, 1,0 EOF +# Call perl in the middle of all this to make sure +# \r is removed fom %>. Issue #380. ltl2tgba -Fformulas/1 --stats='%f, %s,%t' | ltl2tgba -D -F-/1 --stats='%f,%>, %s,%t' | + perl -pi -e 's/$/\r/' | ltl2tgba -B -F-/1 --stats='%f,%>, %s,%t' | ltl2tgba -BD -F-/1 --stats='%f,%>, %s,%t' > output