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 module Crashs on OpenBSD/amd64 #47895

Closed
henryprecheur mannequin opened this issue Aug 22, 2008 · 6 comments
Closed

readline module Crashs on OpenBSD/amd64 #47895

henryprecheur mannequin opened this issue Aug 22, 2008 · 6 comments
Assignees
Labels
easy release-blocker stdlib Python modules in the Lib dir type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@henryprecheur
Copy link
Mannequin

henryprecheur mannequin commented Aug 22, 2008

BPO 3645
Nosy @gpshead
Files
  • patch.configure.in: patch to apply on r65970
  • 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/gpshead'
    closed_at = <Date 2008-09-06.21:56:41.885>
    created_at = <Date 2008-08-22.05:41:07.662>
    labels = ['easy', 'library', 'type-crash', 'release-blocker']
    title = 'readline module Crashs on OpenBSD/amd64'
    updated_at = <Date 2008-09-06.21:56:41.883>
    user = 'https://bugs.python.org/henryprecheur'

    bugs.python.org fields:

    activity = <Date 2008-09-06.21:56:41.883>
    actor = 'gregory.p.smith'
    assignee = 'gregory.p.smith'
    closed = True
    closed_date = <Date 2008-09-06.21:56:41.885>
    closer = 'gregory.p.smith'
    components = ['Library (Lib)']
    creation = <Date 2008-08-22.05:41:07.662>
    creator = 'henry.precheur'
    dependencies = []
    files = ['11206']
    hgrepos = []
    issue_num = 3645
    keywords = ['patch', '64bit', 'easy']
    message_count = 6.0
    messages = ['71723', '71724', '72375', '72465', '72538', '72710']
    nosy_count = 3.0
    nosy_names = ['gregory.p.smith', 'henry.precheur', 'rpetrov']
    pr_nums = []
    priority = 'release blocker'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue3645'
    versions = ['Python 2.6', 'Python 2.5', 'Python 3.0']

    @henryprecheur
    Copy link
    Mannequin Author

    henryprecheur mannequin commented Aug 22, 2008

    $ python2.5                                                            
                     
    Python 2.5.2 (r252:60911, Jun 16 2008, 15:20:47)                       
                     
    [GCC 3.3.5 (propolice)] on openbsd4                                    
                     
    Type "help", "copyright", "credits" or "license" for more information. 
                     
    >>> def complete(text, state):                                         
                     
    ...     print 'complete %r %d' % (text, state)                         
                     
    ...     if text == 'i' and state == 0:                                 
                     
    ...         return 'import'                                            
                     
    ...     else:                                                          
                     
    ...         return None                                                
                     
    ...                                                                    
                     
    >>> import readline; readline.parse_and_bind("tab: complete")
    >>> readline.set_completer(complete)                                   
                                         
    >>> i<TAB> # <TAB> is press the tab key                                
                     
    complete 'i' 0                                                         
                     
    complete 'i' 1                                                         
                     
    Segmentation fault (core dumped)                                       
                     
                                                                           
                     
    The problem is that Python is using a function present in libreadline  
                     
    but not declared in readline/readline.h: completion_matches. Instead of
                     
    using rl_completion_matches.                                           
                     
                                                                           
                     
    Therefor the return type of completion_matches was an int which is     
                     
    32bits on amd64 but the function was supposed to returns a pointer which
                    
    is 64 bits. So when the pointer had a "high" value, it was truncated.  
                     
                                                                           
                     
    The problem is fixed by adding libcurses to AC_CHECK_LIB when checking
    for functions in libreadline since libreadline depends on curses. This
    makes Python use the correct functions declared on readline.h with a   
                           
    correct return type.

    Patch is attached.

    (Others versions of Python should also be affected)

    @henryprecheur henryprecheur mannequin added stdlib Python modules in the Lib dir type-crash A hard crash of the interpreter, possibly with a core dump labels Aug 22, 2008
    @henryprecheur
    Copy link
    Mannequin Author

    henryprecheur mannequin commented Aug 22, 2008

    Looks like this patch should also be applied to python 2.6 & 3.

    I did not tested but the patch is trivial enough to be applied without
    too much fear of breaking something ;)

    @gpshead
    Copy link
    Member

    gpshead commented Sep 3, 2008

    committed to trunk (2.6) in r66179. This should be back ported to
    release25-maint and automagically merged into py3k.

    can someone with OpenBSD confirm that this has indeed fixed the problem?
    if so i'll do the 25 backport and mark it as closed instead of pending.

    @gpshead gpshead added the easy label Sep 3, 2008
    @gpshead gpshead self-assigned this Sep 3, 2008
    @henryprecheur
    Copy link
    Mannequin Author

    henryprecheur mannequin commented Sep 4, 2008

    I just compiled the latest version of trunk. The problem seems to be
    fixed. And according to config.log & nm, readline.so is linked with the
    right function.

    @rpetrov
    Copy link
    Mannequin

    rpetrov mannequin commented Sep 4, 2008

    may bpo-1204 is more general

    @gpshead
    Copy link
    Member

    gpshead commented Sep 6, 2008

    true, bpo-1204 is more general. i'll leave this in but it can be
    removed once the better general fix is in with 1204. i won't backport
    this one.

    @gpshead gpshead closed this as completed Sep 6, 2008
    @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
    easy release-blocker stdlib Python modules in the Lib dir type-crash A hard crash of the interpreter, possibly with a core dump
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants