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 looks for .netrc even on Windows where the convention is _netrc #88146

Open
jheiselman mannequin opened this issue Apr 29, 2021 · 4 comments
Open

netrc module looks for .netrc even on Windows where the convention is _netrc #88146

jheiselman mannequin opened this issue Apr 29, 2021 · 4 comments
Labels
3.13 bugs and security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@jheiselman
Copy link
Mannequin

jheiselman mannequin commented Apr 29, 2021

BPO 43980
Nosy @stevendaprano, @jheiselman
PRs
  • gh-88146: Set default netrc file name correctly on Windows #25732
  • 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 = None
    created_at = <Date 2021-04-29.20:02:55.304>
    labels = ['type-feature', 'library', '3.10', '3.11']
    title = 'netrc module looks for .netrc even on Windows where the convention is _netrc'
    updated_at = <Date 2021-04-29.21:42:22.735>
    user = 'https://github.com/jheiselman'

    bugs.python.org fields:

    activity = <Date 2021-04-29.21:42:22.735>
    actor = 'jheiselman'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2021-04-29.20:02:55.304>
    creator = 'jheiselman'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 43980
    keywords = ['patch']
    message_count = 4.0
    messages = ['392348', '392349', '392355', '392356']
    nosy_count = 2.0
    nosy_names = ['steven.daprano', 'jheiselman']
    pr_nums = ['25732']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue43980'
    versions = ['Python 3.10', 'Python 3.11']

    @jheiselman
    Copy link
    Mannequin Author

    jheiselman mannequin commented Apr 29, 2021

    The netrc library defaults to looking for the .netrc file in the user's home directory. On Windows, this file is conventionally named _netrc. While one could pass the correct path to the library, the conventionally correct path should be used on all supported platforms.

    @jheiselman jheiselman mannequin added type-bug An unexpected behavior, bug, or error 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes stdlib Python modules in the Lib dir labels Apr 29, 2021
    @jheiselman
    Copy link
    Mannequin Author

    jheiselman mannequin commented Apr 29, 2021

    Created a simple PR to correct this.

    @stevendaprano
    Copy link
    Member

    This is a behaviour change not a simple bug fix. 3.6 through 3.9 are all in feature-freeze, and we're days away from the same for 3.10.

    Not that I don't believe you about the _netrc convention on Windows, but do you have a link to a reliable source documenting that?

    @stevendaprano stevendaprano added type-feature A feature request or enhancement and removed 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes type-bug An unexpected behavior, bug, or error labels Apr 29, 2021
    @jheiselman
    Copy link
    Mannequin Author

    jheiselman mannequin commented Apr 29, 2021

    The netrc file has no formal standard, but the following supports the claim of its conventional naming.

    Excerpt from https://curl.se/docs/manpage.html#-n:
    "Makes curl scan the .netrc (_netrc on Windows) file in the user's home directory for login name and password."

    Excerpt from https://www.labkey.org/Documentation/wiki-page.view?name=netrc:
    "On a Mac, UNIX, or Linux system the netrc file should be named .netrc (dot netrc) and on Windows it should be named _netrc (underscore netrc)."

    And a 9+ year old stack overflow post indicating that the use of _netrc on Windows is quite well established and has been for some time. I know it's not authoritative, but it does establish the length of history for this.
    https://stackoverflow.com/questions/6031214/git-how-to-use-netrc-file-on-windows-to-save-user-and-password

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @iritkatriel iritkatriel removed the 3.11 only security fixes label Dec 6, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.13 bugs and security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants