Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netrc module not parsing passwords containing #s. #54673

Closed
theisz mannequin opened this issue Nov 20, 2010 · 8 comments
Closed

netrc module not parsing passwords containing #s. #54673

theisz mannequin opened this issue Nov 20, 2010 · 8 comments
Labels
extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error

Comments

@theisz
Copy link
Mannequin

theisz mannequin commented Nov 20, 2010

BPO 10464
Nosy @ned-deily, @bitdancer, @IIIIllllIIIIllllIIIIllllIIIIllllIIIIll
Files
  • issue_10464_fix.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2010-12-02.03:17:16.490>
    created_at = <Date 2010-11-20.09:28:37.451>
    labels = ['extension-modules', 'type-bug']
    title = 'netrc module not parsing passwords containing #s.'
    updated_at = <Date 2010-12-02.03:17:16.488>
    user = 'https://bugs.python.org/theisz'

    bugs.python.org fields:

    activity = <Date 2010-12-02.03:17:16.488>
    actor = 'r.david.murray'
    assignee = 'none'
    closed = True
    closed_date = <Date 2010-12-02.03:17:16.490>
    closer = 'r.david.murray'
    components = ['Extension Modules']
    creation = <Date 2010-11-20.09:28:37.451>
    creator = 'the_isz'
    dependencies = []
    files = ['19818']
    hgrepos = []
    issue_num = 10464
    keywords = ['patch']
    message_count = 8.0
    messages = ['121598', '121623', '121645', '121657', '122369', '122900', '122950', '123048']
    nosy_count = 4.0
    nosy_names = ['ned.deily', 'r.david.murray', 'xuanji', 'the_isz']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue10464'
    versions = ['Python 3.1', 'Python 2.7', 'Python 3.2']

    @theisz
    Copy link
    Mannequin Author

    theisz mannequin commented Nov 20, 2010

    The netrc module stops parsing passwords at # characters, which can be part of
    passwords.

    Tested with Python 2.7 and 3.1.

    @theisz theisz mannequin added extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error labels Nov 20, 2010
    @IIIIllllIIIIllllIIIIllllIIIIllllIIIIll
    Copy link
    Mannequin

    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)

    @IIIIllllIIIIllllIIIIllllIIIIllllIIIIll
    Copy link
    Mannequin

    Sorry, patch had a mistake

    @IIIIllllIIIIllllIIIIllllIIIIllllIIIIll
    Copy link
    Mannequin

    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?

    @IIIIllllIIIIllllIIIIllllIIIIllllIIIIll
    Copy link
    Mannequin

    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.

    @IIIIllllIIIIllllIIIIllllIIIIllllIIIIll
    Copy link
    Mannequin

    bumping...can someone review this? The reported bug seems valid enough.

    @ned-deily
    Copy link
    Member

    Patch looks good to me. Supplied test fails before and works after fix applied.

    @bitdancer
    Copy link
    Member

    Committed to py3k in r86925, 3.1 in r86926, and 2.7 in r86927.

    Thanks for the patch, Xuanji.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants