Re: [code] [textadept] Curses `os.spawn` Shell String Parsing

From: Mitchell <>
Date: Mon, 17 Dec 2018 13:54:20 -0500 (EST)

Hi Chad,

On Thu, 13 Dec 2018, Mitchell wrote:

> Hi Chad,
> On Wed, 12 Dec 2018, Chad Voegele wrote:
>> Hi Mitchell,
>> I use `sed` with `filter_through` for search and replace and have been
>> having trouble when trying to replace single quotes with double
>> quotes, i.e. `filter_through('sed "s/\'/\\"/g"')`. I narrowed the
>> issue to an implementation difference where the curses version uses
>> custom logic to parse the shell string. Lines 807-817 in the patched
>> `loslib.c` seem to have trouble with the escaped double quote.
>> Since I'm guessing you would not like to have a `glib` dependency in
>> the curses version, one option to fix this could be to use the POSIX
>> function `wordexp` provided by `libc`. Please see the patch below for
>> details. Would you be willing to consider adopting this patch or
>> something similar?
>> [snip]
> This looks good to me. I'll apply something similar when I have some time.
> Thanks!

After looking into `wordexp` support on Mac and the BSDs, I discovered that the function is frowned upon for its poor security. Instead, I committed a fix that handles escaped double-quote characters[1], so your "sed" case is handled properly. Let me know if there are still bugs.



You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Mon 17 Dec 2018 - 13:54:20 EST

This archive was generated by hypermail 2.2.0 : Tue 18 Dec 2018 - 06:31:14 EST