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

readline fails to parse some forms of .editrc under editline (libedit) emulation on Mac OS X #57840

Closed
zvezdan mannequin opened this issue Dec 19, 2011 · 10 comments
Closed
Assignees
Labels
3.7 (EOL) end of life 3.8 only security fixes OS-mac type-bug An unexpected behavior, bug, or error

Comments

@zvezdan
Copy link
Mannequin

zvezdan mannequin commented Dec 19, 2011

BPO 13631
Nosy @ronaldoussoren, @ned-deily, @merwok, @bitdancer, @zvezdan, @berkerpeksag
PRs
  • bpo-13631: Fix the order of initialization for readline/editline. #6915
  • [3.7] bpo-13631: Fix the order of initialization for readline libedit on macOS. (GH-6915) #6928
  • Files
  • readline-2.7.patch: readline.c patch for python-2.7
  • readline-3.2.patch: readline.c patch for python-3.2
  • 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 = 'https://github.com/ronaldoussoren'
    closed_at = <Date 2018-05-17.07:33:38.025>
    created_at = <Date 2011-12-19.04:05:36.802>
    labels = ['OS-mac', '3.8', 'type-bug', '3.7']
    title = 'readline fails to parse some forms of .editrc under editline (libedit) emulation on Mac OS X'
    updated_at = <Date 2018-05-17.07:33:38.022>
    user = 'https://github.com/zvezdan'

    bugs.python.org fields:

    activity = <Date 2018-05-17.07:33:38.022>
    actor = 'ned.deily'
    assignee = 'ronaldoussoren'
    closed = True
    closed_date = <Date 2018-05-17.07:33:38.025>
    closer = 'ned.deily'
    components = ['macOS']
    creation = <Date 2011-12-19.04:05:36.802>
    creator = 'zvezdan'
    dependencies = []
    files = ['24043', '24044']
    hgrepos = []
    issue_num = 13631
    keywords = ['patch', 'needs review']
    message_count = 10.0
    messages = ['149813', '150945', '150957', '151133', '193093', '219561', '219735', '316885', '316894', '316895']
    nosy_count = 6.0
    nosy_names = ['ronaldoussoren', 'ned.deily', 'eric.araujo', 'r.david.murray', 'zvezdan', 'berker.peksag']
    pr_nums = ['6915', '6928']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue13631'
    versions = ['Python 3.7', 'Python 3.8']

    @zvezdan
    Copy link
    Mannequin Author

    zvezdan mannequin commented Dec 19, 2011

    Problem
    =======

    The changes in r87356 for py3k and r87358 for python-2.7 described in bpo-9907 have broken parsing of the initialization file .editrc under editline emulation of readline on Mac OS X.

    Background
    ==========

    Both readline and editline allow settings customized per program.
    For example, .inputrc file for readline::

    $if Python
        set editing-mode vi
    $endif
    

    will be applied only to Python processes.

    Similarly, .editrc file for editline::

    python:bind -v
    python:bind ^I rl_complete
    

    will be applied only to Python processes on Mac OS X.

    This works fine on python-2.6.

    It's broken on 2.7 and 3.2 and later because the change in bpo-9907 moved the rl_initialize() call towards the beginning of the setup function.

    Solution
    ========

    The rl_readline_name variable must be set to "python" **before** the call to rl_initialize(). Attached are patches for 2.7 and 3.2.

    @zvezdan zvezdan mannequin assigned ronaldoussoren Dec 19, 2011
    @zvezdan zvezdan mannequin added OS-mac type-bug An unexpected behavior, bug, or error labels Dec 19, 2011
    @merwok
    Copy link
    Member

    merwok commented Jan 9, 2012

    Thanks for the analysis and patch. Have you tested that your patch does not break the readline module when linking against GNU readline? If not, I can do it.

    @zvezdan
    Copy link
    Mannequin Author

    zvezdan mannequin commented Jan 9, 2012

    I did not test against a readline build.

    @merwok
    Copy link
    Member

    merwok commented Jan 12, 2012

    I applied your patch and built the readline module against libreadline and imported it successfully. (I did not try the special parsing feature, but I don’t think it’s needed.)

    @ronaldoussoren
    Copy link
    Contributor

    I can confirm the problem and that the patch fixes the issue.

    I'll try to commit a fix later this week.

    @ned-deily
    Copy link
    Member

    It appears that Apple's update to editline in OS X 10.9 Mavericks has also broken this patch; with refreshing, it still works with the system editline in 10.8. So, like the fix for bpo-18458, we need to make sure that the fix works with either version of a dynamically loaded libedit.

    Zvezdan, it would be good if you would be willing to sign the Python contributor agreement for your patch: https://www.python.org/psf/contrib/contrib-form/

    @zvezdan
    Copy link
    Mannequin Author

    zvezdan mannequin commented Jun 4, 2014

    Ned,

    I just signed the contributor agreement form.

    @berkerpeksag berkerpeksag added the 3.7 (EOL) end of life label Oct 5, 2016
    @ned-deily
    Copy link
    Member

    New changeset c2f082e by Ned Deily (Zvezdan Petkovic) in branch 'master':
    bpo-13631: Fix the order of initialization for readline libedit on macOS. (GH-6915)
    c2f082e

    @ned-deily
    Copy link
    Member

    New changeset d504108 by Ned Deily (Miss Islington (bot)) in branch '3.7':
    bpo-13631: Fix the order of initialization for readline libedit on macOS. (GH-6915) (GH-6928)
    d504108

    @ned-deily
    Copy link
    Member

    Thanks for the patch and PR, Zvezdan! Merged for 3.7.0 and 3.8.0.

    @ned-deily ned-deily added the 3.8 only security fixes label May 17, 2018
    @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
    3.7 (EOL) end of life 3.8 only security fixes OS-mac type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants