NetBSD-Bugs archive

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

Re: lib/52517: TTY settings modified and not restored on exit.



The following reply was made to PR lib/52517; it has been noted by GNATS.

From: Jay West <jhdub23%gmail.com@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: lib-bug-people%netbsd.org@localhost, gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost
Subject: Re: lib/52517: TTY settings modified and not restored on exit.
Date: Tue, 5 Sep 2017 09:47:42 -0700

 --001a113dbbea72c120055873fce9
 Content-Type: text/plain; charset="UTF-8"
 
 I couldn't find a way to update the bug report directly, so I'm replying by
 email.  Please let me know if there is a better way.
 
 The before/after tty settings differences only appear if your original
 settings are different from libedit's defaults.  It turns out that the
 differences do not show up with xterm (in my environment).  The changes are
 very noticeable when running an emacs shell.  I've modified the test to
 highlight the issue regardless of default shell tty settings.
 
 Jay
 
 /*---------------------------------------
 * Simple program: tty_test.c
 *---------------------------------------*/
 #include "editline/readline.h"
 
 int main(int argc, char* argv[]) {
   rl_initialize();
   return 0;
 }
 
 /*---------------------------------------
 * Compile
 *---------------------------------------*/
 % gcc -o tty_test -Ilibedit_install/include tty_test.c
 libedit_install/lib/libedit.a -lncurses
 
 /*----------------------------------------
 * Modified test:
 *----------------------------------------*/
 % stty -icanon # Force tty settings to be different from libedit default.
 % stty -a > orig.txt
 % tty_test
 % stty -a > after.txt
 % diff orig.txt after.txt  # Differences exist
 
 
 On Fri, Sep 1, 2017 at 12:40 AM, Christos Zoulas <christos%zoulas.com@localhost>
 wrote:
 
 > The following reply was made to PR lib/52517; it has been noted by GNATS.
 >
 > From: christos%zoulas.com@localhost (Christos Zoulas)
 > To: gnats-bugs%NetBSD.org@localhost, lib-bug-people%netbsd.org@localhost,
 >         gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost
 > Cc:
 > Subject: Re: lib/52517: TTY settings modified and not restored on exit.
 > Date: Fri, 1 Sep 2017 03:35:12 -0400
 >
 >  On Aug 31,  9:50pm, jhdub23%gmail.com@localhost (jhdub23%gmail.com@localhost) wrote:
 >  -- Subject: lib/52517: TTY settings modified and not restored on exit.
 >
 >  | >Number:         52517
 >  | >Category:       lib
 >  | >Synopsis:       TTY settings modified and not restored on exit.
 >  | >Confidential:   no
 >  | >Severity:       non-critical
 >  | >Priority:       medium
 >  | >Responsible:    lib-bug-people
 >  | >State:          open
 >  | >Class:          sw-bug
 >  | >Submitter-Id:   net
 >  | >Arrival-Date:   Thu Aug 31 21:50:00 +0000 2017
 >  | >Originator:     Jay West
 >  | >Release:        libedit (NetBSD-current)
 >  | >Organization:
 >  | Self
 >  | >Environment:
 >  | Linux [deleted] 2.6.32-696.6.3.el6.x86_64 #1 SMP Wed Jul 12 14:17:22
 > UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
 >  | >Description:
 >  | libedit modifies TTY settings when used, and does not have a mechanism
 > to fully save and restore TTY settings.  This causes problems when libedit
 > is used as a GNU readline replacement.
 >  |
 >  | Specifically, after running python+GnuReadline, TTY settings are
 > untouched after python exits.  However, python+libedit has noticeable TTY
 > changes after python exits.
 >  |
 >  | This will be true for any application linked against libedit instead of
 > GnuReadline.
 >  | >How-To-Repeat:
 >  | % stty -a > orig.txt
 >  | % python # Run python compiled with libedit, and immediately exit (or
 > any application using libedit).
 >  | % stty -a > after.txt
 >  | % diff orig.txt after.txt  # Differences exist
 >  |
 >
 >
 >  Can you provide a small program that calls readline and reproduces this?
 >
 >  christos
 >
 >
 
 --001a113dbbea72c120055873fce9
 Content-Type: text/html; charset="UTF-8"
 Content-Transfer-Encoding: quoted-printable
 
 <div dir=3D"ltr">I couldn&#39;t find a way to update the bug report directl=
 y, so I&#39;m replying by email.=C2=A0 Please let me know if there is a bet=
 ter way.<div><br></div><div>The before/after tty settings differences only =
 appear if your original settings are different from libedit&#39;s defaults.=
 =C2=A0 It turns out that the differences do not show up with xterm (in my e=
 nvironment).=C2=A0 The changes are very noticeable when running an emacs sh=
 ell.=C2=A0 I&#39;ve modified the test to highlight the issue regardless of =
 default shell tty settings.</div><div><br></div><div>Jay</div><div><div><br=
 ></div><div>/*----------------------------<wbr>-----------<br></div><div>* =
 Simple program: tty_test.c</div><div>*-----------------------------<wbr>---=
 -------*/</div><div><div>#include &quot;editline/readline.h&quot;</div><div=
 ><br></div><div>int main(int argc, char* argv[]) {</div><div>=C2=A0 rl_init=
 ialize();</div><div>=C2=A0 return 0;</div><div>}</div></div><div><br></div>=
 <div><div>/*----------------------------<wbr>-----------<br></div><div>* Co=
 mpile</div><div>*-----------------------------<wbr>----------*/</div></div>=
 <div>% gcc -o tty_test -Ilibedit_install/include tty_test.c libedit_install=
 /lib/libedit.a -lncurses<br></div><div><br></div><div>/*-------------------=
 ---------<wbr>------------<br></div><div>* Modified test:=C2=A0</div><div>*=
 -----------------------------<wbr>-----------*/<br></div><div>% stty -icano=
 n # Force tty settings to be different from libedit default.</div><div>% st=
 ty -a &gt; orig.txt</div><div>% tty_test</div><div>% stty -a &gt; after.txt=
 </div><div>%=C2=A0<span style=3D"font-size:12.8px">diff orig.txt after.txt=
 =C2=A0 # Differences exist</span></div><div><span style=3D"font-size:12.8px=
 "><br></span></div></div></div><div class=3D"gmail_extra"><br><div class=3D=
 "gmail_quote">On Fri, Sep 1, 2017 at 12:40 AM, Christos Zoulas <span dir=3D=
 "ltr">&lt;<a href=3D"mailto:christos%zoulas.com@localhost"; target=3D"_blank">christos=
 @zoulas.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" styl=
 e=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The fol=
 lowing reply was made to PR lib/52517; it has been noted by GNATS.<br>
 <br>
 From: <a href=3D"mailto:christos%zoulas.com@localhost";>christos%zoulas.com@localhost</a> (Chris=
 tos Zoulas)<br>
 To: gnats-bugs%NetBSD.org@localhost, <a href=3D"mailto:lib-bug-people%netbsd.org@localhost";>lib=
 -bug-people%netbsd.org@localhost</a>,<br>
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <a href=3D"mailto:gnats-admin%netbsd.org@localhost";>gnats=
 -admin%netbsd.org@localhost</a>, <a href=3D"mailto:netbsd-bugs%netbsd.org@localhost";>netbsd-bug=
 s%netbsd.org@localhost</a><br>
 Cc:<br>
 Subject: Re: lib/52517: TTY settings modified and not restored on exit.<br>
 Date: Fri, 1 Sep 2017 03:35:12 -0400<br>
 <br>
 =C2=A0On Aug 31,=C2=A0 9:50pm, <a href=3D"mailto:jhdub23%gmail.com@localhost";>jhdub23=
 @gmail.com</a> (<a href=3D"mailto:jhdub23%gmail.com@localhost";>jhdub23%gmail.com@localhost</a>)=
  wrote:<br>
 =C2=A0-- Subject: lib/52517: TTY settings modified and not restored on exit=
 .<br>
 <br>
 =C2=A0| &gt;Number:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A052517<br>
 =C2=A0| &gt;Category:=C2=A0 =C2=A0 =C2=A0 =C2=A0lib<br>
 <span class=3D"">=C2=A0| &gt;Synopsis:=C2=A0 =C2=A0 =C2=A0 =C2=A0TTY settin=
 gs modified and not restored on exit.<br>
 </span>=C2=A0| &gt;Confidential:=C2=A0 =C2=A0no<br>
 =C2=A0| &gt;Severity:=C2=A0 =C2=A0 =C2=A0 =C2=A0non-critical<br>
 =C2=A0| &gt;Priority:=C2=A0 =C2=A0 =C2=A0 =C2=A0medium<br>
 =C2=A0| &gt;Responsible:=C2=A0 =C2=A0 lib-bug-people<br>
 =C2=A0| &gt;State:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 open<br>
 =C2=A0| &gt;Class:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sw-bug<br>
 =C2=A0| &gt;Submitter-Id:=C2=A0 =C2=A0net<br>
 <span class=3D"">=C2=A0| &gt;Arrival-Date:=C2=A0 =C2=A0Thu Aug 31 21:50:00 =
 +0000 2017<br>
 </span>=C2=A0| &gt;Originator:=C2=A0 =C2=A0 =C2=A0Jay West<br>
 =C2=A0| &gt;Release:=C2=A0 =C2=A0 =C2=A0 =C2=A0 libedit (NetBSD-current)<br=
 >
 =C2=A0| &gt;Organization:<br>
 =C2=A0| Self<br>
 =C2=A0| &gt;Environment:<br>
 =C2=A0| Linux [deleted] 2.6.32-696.6.3.el6.x86_64 #1 SMP Wed Jul 12 14:17:2=
 2 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux<br>
 =C2=A0| &gt;Description:<br>
 =C2=A0| libedit modifies TTY settings when used, and does not have a mechan=
 ism to fully save and restore TTY settings.=C2=A0 This causes problems when=
  libedit is used as a GNU readline replacement.<br>
 =C2=A0|<br>
 =C2=A0| Specifically, after running python+GnuReadline, TTY settings are un=
 touched after python exits.=C2=A0 However, python+libedit has noticeable TT=
 Y changes after python exits.<br>
 =C2=A0|<br>
 =C2=A0| This will be true for any application linked against libedit instea=
 d of GnuReadline.<br>
 =C2=A0| &gt;How-To-Repeat:<br>
 =C2=A0| % stty -a &gt; orig.txt<br>
 =C2=A0| % python # Run python compiled with libedit, and immediately exit (=
 or any application using libedit).<br>
 =C2=A0| % stty -a &gt; after.txt<br>
 =C2=A0| % diff orig.txt after.txt=C2=A0 # Differences exist<br>
 =C2=A0|<br>
 <br>
 <br>
 =C2=A0Can you provide a small program that calls readline and reproduces th=
 is?<br>
 <span class=3D"HOEnZb"><font color=3D"#888888"><br>
 =C2=A0christos<br>
 <br>
 </font></span></blockquote></div><br></div>
 
 --001a113dbbea72c120055873fce9--
 



Home | Main Index | Thread Index | Old Index