Comments (3)
Hmmm...
What made the problem go away was to set the prompt to a single unchanging string, and pass the string:
result = readline(prompt);
It seems that references to prompt are kept around internally after readline() returns. If an attempt is made to clean up the prompt or regenerate the prompt, chaos follows. I suspect somewhere inside the prompt needs to be strdup'ed.
from editline.
In the original code there's no way to free stuff, so it's made to use a static string, or only change the contents of prompt
between calls to readline()
.
Note: this is a very small an limited library. If you need anything more advanced I suggest looking at libedit (or readline) instead).
from editline.
Alas in this case I'm only making changes to the contents of prompt in between calls to readline(), but it's not working in this case.
If I hack the code to not free prompt (ie leak), the problem disappears.
Ideally if editline needs to keep prompt past the readline() call, it should strdup it (and then free). Alternatively, store the prompt length only if that is all that's needed.
At this stage we support libedit, but this is not available where we want to run. Readline is not an option because of GPL.
from editline.
Related Issues (20)
- Pressing Ctrl+C when searching sends SIGINT after next command HOT 1
- Support for Latin-1? HOT 1
- Cannot find sgstat.h or modes.h. HOT 2
- Request for UTF-8 support HOT 16
- read() returns greater than 1 with some C standard library implementations (i.e. newlib) HOT 13
- Example Step 2 needs header file <stdio.h> HOT 1
- Inclusion in a debian repository HOT 4
- Run with mpi HOT 4
- Address sanitizer reports error HOT 12
- How to call function 'el_bind_key' HOT 3
- The process that uses editline does not respect CTRL+Z HOT 1
- Request for \1 and \2 (RL_PROMPT_START_IGNORE, RL_PROMPT_END_IGNORE) support HOT 1
- ctrl-v for verbatim input
- Need to press CTRL+Z twice to have process (that consumes editline) to go in the background HOT 1
- rl_point is always zero HOT 3
- fileman.c example. Error free(): double free detected in tcache 2 HOT 1
- Can you state in the source it's licensed under Apache-2.0? HOT 3
- Does not compile cleanly HOT 6
- Prompt not displayed on non-interactive sessions, inconsistent with GNU readline HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from editline.