bug-readline
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-readline] segmentation fault in rl_parse_and_bind(char*)


From: Chet Ramey
Subject: Re: [Bug-readline] segmentation fault in rl_parse_and_bind(char*)
Date: Fri, 17 Oct 2014 14:57:36 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

On 10/17/14, 1:54 PM, Jo Van Bulck wrote:
> Hi all,
> 
> When trying to parse a string as if it has been read from the inputrc
> file, using the 'rl_parse_and_bind(char *line)' function, I get a
> segmentation fault when passing any non-empy string. I run Archlinux
> with readline version 'readline 6.3.006-1'.

It depends on the behavior of your compiler.  rl_parse_and_bind wants to
modify the string it's passed by temporarily putting in NULs and later
restoring the original characters as part of tokenizing the line, similar
to strtok/strsep.  If your compiler puts string constants into read-only
memory pages, you'll get a seg fault if you pass such a string constant to
rl_parse_and_bind.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]