Skip to content

netrc module not parsing passwords containing #s. #54673

Closed

Description

@theisz
mannequin
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']

    Activity

    1. theisz commented on Nov 20, 2010

      theiszmannequin
      MannequinAuthor

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

      Tested with Python 2.7 and 3.1.

    2. IIIIllllIIIIllllIIIIllllIIIIllllIIIIll commented on Nov 20, 2010

      IIIIllllIIIIllllIIIIllllIIIIllllIIIIllmannequin
      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)

    3. IIIIllllIIIIllllIIIIllllIIIIllllIIIIll commented on Nov 20, 2010

      IIIIllllIIIIllllIIIIllllIIIIllllIIIIllmannequin
      Mannequin

      Sorry, patch had a mistake

    4. IIIIllllIIIIllllIIIIllllIIIIllllIIIIll commented on Nov 20, 2010

      IIIIllllIIIIllllIIIIllllIIIIllllIIIIllmannequin
      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?

    5. IIIIllllIIIIllllIIIIllllIIIIllllIIIIll commented on Nov 25, 2010

      IIIIllllIIIIllllIIIIllllIIIIllllIIIIllmannequin
      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.

    6. IIIIllllIIIIllllIIIIllllIIIIllllIIIIll commented on Nov 30, 2010

      IIIIllllIIIIllllIIIIllllIIIIllllIIIIllmannequin
      Mannequin

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

    7. ned-deily commented on Nov 30, 2010

      @ned-deily
      Member

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

    8. bitdancer commented on Dec 2, 2010

      @bitdancer
      Member

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

      Thanks for the patch, Xuanji.

    9. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      extension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions