Issue 10464: netrc module not parsing passwords containing #s. (original) (raw)

Created on 2010-11-20 09:28 by the_isz, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue_10464_fix.diff xuanji,2010-11-25 15:12
Messages (8)
msg121598 - (view) Author: (the_isz) Date: 2010-11-20 09:28
The netrc module stops parsing passwords at # characters, which can be part of passwords. Tested with Python 2.7 and 3.1.
msg121623 - (view) Author: Xuanji Li (xuanji) * Date: 2010-11-20 12:37
Included test case for the reported bug. Test fails on my machine. Also split up test_case_1 (in order to put in the new test case cleanly)
msg121645 - (view) Author: Xuanji Li (xuanji) * Date: 2010-11-20 14:00
Sorry, patch had a mistake
msg121657 - (view) Author: Xuanji Li (xuanji) * Date: 2010-11-20 14:44
The issue seems to be that when shlex (the lexer that netrc uses) sees a '#' character it thinks that the rest of the line is a comment. I am not sure what the behavior of netrc should be - should it treat '#' as beginning a comment only if its the first non-whitespace character on a line? Should shlex be changed to reflect this?
msg122369 - (view) Author: Xuanji Li (xuanji) * Date: 2010-11-25 15:12
The patch attached (issue_10464_fix) moves handling of the '#' character from shlex to netrc, and makes netrc consider as comments lines whose first not-whitespace character is '#' instead of all text following '#' (which is what shlex does and which causes this bug). It also includes a test case.
msg122900 - (view) Author: Xuanji Li (xuanji) * Date: 2010-11-30 11:10
bumping...can someone review this? The reported bug seems valid enough.
msg122950 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2010-11-30 22:41
Patch looks good to me. Supplied test fails before and works after fix applied.
msg123048 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-12-02 03:17
Committed to py3k in r86925, 3.1 in r86926, and 2.7 in r86927. Thanks for the patch, Xuanji.
History
Date User Action Args
2022-04-11 14:57:09 admin set github: 54673
2010-12-02 03:17:16 r.david.murray set status: open -> closednosy: + r.david.murraymessages: + resolution: fixedstage: commit review -> resolved
2010-11-30 22:41:36 ned.deily set files: - issue_10231_testcase.diff
2010-11-30 22:41:24 ned.deily set nosy: + ned.deilymessages: + stage: patch review -> commit review
2010-11-30 11:10:27 xuanji set messages: +
2010-11-25 20:16:02 ned.deily set stage: patch reviewversions: + Python 3.2
2010-11-25 15:12:01 xuanji set files: + issue_10464_fix.diffmessages: +
2010-11-20 14:44:47 xuanji set messages: +
2010-11-20 14:00:01 xuanji set files: + issue_10231_testcase.diffmessages: +
2010-11-20 13:44:27 xuanji set files: - issue_10464_testcase.diff
2010-11-20 12:37:20 xuanji set files: + issue_10464_testcase.diffnosy: + xuanjimessages: + keywords: + patch
2010-11-20 09:28:37 the_isz create