Issue 8620: wrong truncation of last line in cmd.Cmd (original) (raw)

Created on 2010-05-05 11:35 by omatt, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
cmd-noeol-test.patch r.david.murray,2010-07-31 03:46
cmd-noeol-test.fix.patch catherine,2010-08-01 00:40
cmd-noeol-test.fix.patch catherine,2010-08-01 01:59
Messages (12)
msg105012 - (view) Author: Mattelaer (omatt) Date: 2010-05-05 11:35
When using the Cmd module on a file. it happens that the last line is truncated from the last caracther. The problem is simply that it can happen that the last line doesn't finish by '\n' charcacter. In consequence the line which is suppose to suppress the '\n' suppress another character. Cheers, Olivier
msg105235 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-05-07 21:48
Setting version to 3.2, since this change would not be backward compatible and 2.7 is already in beta.
msg112184 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-07-31 19:26
Here is a unit test that demonstrates the problem (against py3k trunk). I'm not convinced that fixing this would be backward incompatible.
msg112239 - (view) Author: Catherine Devlin (catherine) Date: 2010-08-01 00:40
Patch created live during PyOhio 2010 "Teach Me Python Bugfixing" session!
msg112241 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-08-01 00:50
Test runs okay on posix (linux2). Does the fix need to work with '\r\n' too? Aside: Your patch has trailing spaces, you can spot them with good editor settings.
msg112242 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-08-01 00:51
Sorry, RDM is the actual culprit ;)
msg112255 - (view) Author: Catherine Devlin (catherine) Date: 2010-08-01 01:59
same patch, stripped of trailing spaces
msg112263 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-08-01 04:16
Éric: thanks for spotting the whitespace before I got smacked by the commit hook. As for \r\n, our thought was that would be a feature (universal newline support), but upon reflection the current fix could actually break working code if by some weird chance someone is feeding \r terminated files to Cmd, while using \r\n should not break anything, since a \r\n terminated file would currently not work (since the \r would be left on the lines). So I've changed the fix to strip '\r\n' in the commit (py3k r83380, 2.7 r83381, 2.5 r83382, 3.1 r83383).
msg112313 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-08-01 11:35
Universal newline mode helps when reading from stdin, but what I had in mind was actually in cmd.exe putting CRLF. Re-reading the original report, I see this is not a concern, since the bug is about cmd used with a file only, not interactively, so my remark was moot.
msg112314 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-08-01 11:37
If “l” sorts after “a”, you’ve misplaced Catherine in ACKS. Funny how often this happens :) (Cheers for the Teach Me session by the way Catherine!)
msg112408 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-08-01 23:58
Thanks, Éric. Fixed.
msg112425 - (view) Author: Mattelaer (omatt) Date: 2010-08-02 07:20
Thanks a lot for the fix. On 02-août-10, at 01:58, R. David Murray wrote: > > R. David Murray <rdmurray@bitdance.com> added the comment: > > Thanks, Éric. Fixed. > > ---------- > > _______________________________________ > Python tracker <report@bugs.python.org> > <http://bugs.python.org/issue8620> > _______________________________________
History
Date User Action Args
2022-04-11 14:57:00 admin set github: 52866
2010-08-02 07:20:40 omatt set messages: +
2010-08-01 23:58:53 r.david.murray set messages: +
2010-08-01 11:37:33 eric.araujo set messages: +
2010-08-01 11:35:15 eric.araujo set messages: +
2010-08-01 04:16:34 r.david.murray set status: open -> closedversions: + Python 2.6, Python 3.1, Python 2.7messages: + assignee: r.david.murrayresolution: fixedstage: needs patch -> commit review
2010-08-01 01:59:42 catherine set files: + cmd-noeol-test.fix.patchmessages: +
2010-08-01 00:51:25 eric.araujo set messages: +
2010-08-01 00:50:29 eric.araujo set messages: +
2010-08-01 00:40:32 catherine set files: + cmd-noeol-test.fix.patchnosy: + catherinemessages: +
2010-07-31 19:26:20 r.david.murray set messages: +
2010-07-31 19:25:58 r.david.murray set messages: -
2010-07-31 03:46:51 r.david.murray set files: + cmd-noeol-test.patch
2010-07-31 03:45:34 r.david.murray set files: - cmd-noeol-test.patch
2010-07-31 03:44:59 r.david.murray set files: + cmd-noeol-test.patchnosy: + r.david.murraymessages: + keywords: + patchstage: needs patch
2010-05-07 21:48:10 eric.araujo set title: wrong truncation of line in Cmd.cmd -> wrong truncation of last line in cmd.Cmdnosy: + eric.araujomessages: + versions: + Python 3.2, - Python 2.6components: + Library (Lib), - None
2010-05-05 11:35:54 omatt create