Commit e340e61f authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz

bin: fix handling of \r\n with %>

Fix issue #380.

* bin/common_finput.cc: Erase a trailing \r.
* tests/core/ltl2tgba2.test: Test it.
* NEWS: Mention the fix.
parent 1d0db880
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)
......
......@@ -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.
......
#!/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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment