[PATCH] Prevent wordexp from modyfying terminal parameters

Jeff Johnston jjohnstn@redhat.com
Tue Aug 3 18:44:00 GMT 2010


On 07/30/2010 08:35 PM, Moulding, Daniel - 0663 - MITLL wrote:
>> Dan, can you provide a sample test scenario?
>>
>> -- Jeff J.
>>
>
> I apologize for taking so long to get back to you with this. It turned out
> to be not-so-trivial to demonstrate this with a simplified case. Today I
> finally had some free time to take another crack at distilling this down to
> a simpler case (see the attachment).
>
> It turns out that there are some quirks involved here, that I must admit I
> don't fully understand. First, the terminal parameters must be initially set
> from a C++ object's global constructor (?). Second, this has to be done from
> a DLL (???). I'm not sure what this means and I'm open to the possibility
> that I'm doing something that I shouldn't be (such as calling tcsetattr from
> a global constructor).
>
> I couldn't successfully reproduce this with just C or without using a DLL.
> In my specific case, it would be possible for me to work around the issue by
> not calling tcsetattr from the global constructor, but I'd like someone
> else's opinion as to whether this simplified example should work.
>
> In any case, redirecting (or closing) stdin before execing Bash in wordexp
> resolves wordexp's unexpected "terminal attributes reset" side-effect.
>
> -- Dan
>

Hi Dan,

I suggest either open a bug or post something to the maintainers of 
tcsetattr and/or bash to see if there is any insight into what is 
happening and whether you are allowed to do what you are doing.  I 
assume you are using Cygwin since you mention DLL.

I would prefer not to put a fix into newlib until the problem is known a 
little better, especially in light of the fact you already have your own 
work-around of not calling tcsetattr from the global constructor and 
no-one else seems to be running into this problem.

-- Jeff J.



More information about the Newlib mailing list