Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 88334

Summary: x11-libs/xview-3.2p1.4-18c doesnt use UNIX98 ptys (uses BSD legacy ptys)
Product: Gentoo Linux Reporter: L.Stohlmann <lutz.stohlmann>
Component: [OLD] LibraryAssignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it <maintainer-needed>
Status: RESOLVED WONTFIX    
Severity: normal    
Priority: High    
Version: 2005.0   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 245409    
Bug Blocks:    
Attachments: SORRY!!!! THIS PATCH IS REVERSED (I EXCHANGED THE FILE ORDER ACCIDENTLY!!!) This patch makes xview use the GNU Libc functions getpt(),grantpt(),unlockpt() to open a pty
This patch makes xview use the GNU Libc functions getpt(),grantpt(),unlockpt() to open a pty

Description L.Stohlmann 2005-04-08 03:43:44 UTC
xview uses those BSD legacy ptys which are recommended to disable in the kernel. I am on 2.6.11-hardened-r1. It is a problem in the libxview library I think.

I created a patch which depends on _XOPEN_SOURCE being #defined - not sure about that being the right condition, but it must/should be defined for grantpt() according to the man page.

I used diff -Naur in /tmp/portage/xview-3.2-r3/work

Please check the patch and include it in the xview package if it is correct. Otherwise I would be happy if you could correct the #ifdef condition :)

Thanks.

Reproducible: Always
Steps to Reproduce:
1. Kernel configured with:
CONFIG_UNIX98_PTYS=y
# CONFIG_LEGACY_PTYS is not set
2. Running cmdtool or shelltool fails because no ptys are available
3. The patch below should use UNIX98 ptys instead if _XOPEN_SOURCE is #defined
Comment 1 L.Stohlmann 2005-04-08 03:46:56 UTC
Created attachment 55651 [details, diff]
SORRY!!!! THIS PATCH IS REVERSED (I EXCHANGED THE FILE ORDER ACCIDENTLY!!!)


This patch makes xview use the GNU Libc functions getpt(),grantpt(),unlockpt() to open a pty

Not sure whether _XOPEN_SOURCE is the right #define to decide on whether to use
UNIX98 ptys. 

Please see "man 3 grantpt" why I used _XOPEN_SOURCE in the #ifdef's.
Comment 2 L.Stohlmann 2005-04-08 04:01:48 UTC
Comment on attachment 55651 [details, diff]
SORRY!!!! THIS PATCH IS REVERSED (I EXCHANGED THE FILE ORDER ACCIDENTLY!!!)


This patch makes xview use the GNU Libc functions getpt(),grantpt(),unlockpt() to open a pty

DONT APPLY THIS - I WILL ATTACH THE CORRECT THREAD!!!!!

>--- xview-3.2p1.4-18c-unix98ptys/lib/libxview/ttysw/tty_init.c	2005-04-08 12:20:15.000000000 +0200
>+++ xview-3.2p1.4-18c/lib/libxview/ttysw/tty_init.c	2005-04-08 11:39:49.000000000 +0200
>@@ -27,10 +27,6 @@
> #include <pty.h>
> #endif
> 
>-#ifdef _XOPEN_SOURCE
>-#include <stdlib.h>
>-#endif
>-
> #include <xview_private/portable.h>	/* for XV* defines and termios */
> 
> #ifdef	XV_USE_SVR4_PTYS
>@@ -735,18 +731,6 @@
>     int		    tmpfd;
>     int		    pty = 0, tty = 0;
>     int             on = 1;
>-
>-#ifdef _XOPEN_SOURCE
>-    /* info: pty master, tty slave, Ttysw->tty_name is char[20] */
>-    if (((pty=getpt())<0)||(grantpt(pty)<0)||(unlockpt(pty)<0)) {
>-        (void) fprintf(stderr, XV_MSG("Error: getpt/grantpt/unlockpt failed\n"));
>-        return XV_ERROR; }
>-    if ((ptsname(pty)==NULL)||(strncpy(ttysw->tty_name,ptsname(pty),19)==NULL)) {
>-        (void) fprintf(stderr, XV_MSG("Error: ptsname/strncpy failed\n"));
>-	return XV_ERROR; } 
>-    if ((tty=open(ttysw->tty_name,O_RDWR))<0) {
>-        return XV_ERROR; }
>-#else
> #ifdef __CYGWIN__
>     openpty(&pty, &tty, ttysw->tty_name, NULL, NULL);
> #else
>@@ -965,7 +949,6 @@
>  
> #endif /* SVR4 */
> #endif /* cygwin */
>-#endif /* _XOPEN_SOURCE */
> 
>     if (ttysw_restoreparms(tty))
> 	(void) putenv(WE_TTYPARMS_E);
Comment 3 L.Stohlmann 2005-04-08 04:08:25 UTC
Created attachment 55655 [details, diff]
This patch makes xview use the GNU Libc functions getpt(),grantpt(),unlockpt() to open a pty

Sorry for the other patch which was reversed. This is the right one.

This patch makes xview use the GNU Libc functions getpt(),grantpt(),unlockpt()
to open a pty in /dev/pts, making legacy/BSD ptys obsolete for xview (at least
that is what I hope ;)

cwd: /tmp/portage/xview-3.2-r3/work
commandline: diff -Naur xview-3.2p1.4-18c/lib/libxview/ttysw/tty_init.c
xview-3.2p1.4-18c-unix98ptys/lib/libxview/ttysw/tty_init.c

Please check whether usage of #ifdef -XOPEN_SOURCE is correct for deciding
whether to use that part of code. It is mentioned in man 3 grantpt and
therefore I used it.

Thanks.
Comment 4 L.Stohlmann 2005-04-08 04:11:41 UTC
Comment on attachment 55651 [details, diff]
SORRY!!!! THIS PATCH IS REVERSED (I EXCHANGED THE FILE ORDER ACCIDENTLY!!!)


This patch makes xview use the GNU Libc functions getpt(),grantpt(),unlockpt() to open a pty

REVERSED PATCH DELETED (AS FAR AS I COULD DO...)
Comment 5 Samuli Suominen (RETIRED) gentoo-dev 2008-05-15 08:53:18 UTC
I'm not the correct person to review your patch sorry.. but.. Upstream site has newer tarball (from 2005) available, and Debian has fixed this bug in their own package (but it's not a separate patch, more of an combined set of fixes).

Either we apply this. Or switch to Debian patchset. Or remove it.
Comment 6 Hans de Graaff gentoo-dev Security 2008-05-17 11:38:17 UTC
Stuff that depends on xview:

app-editors/jove:X
games-fps/imaze:!Xaw3d
media-sound/workman
sci-chemistry/nmrpipe

Of these it looks like imaze also has an Xaw3d interface so it would not really be affected would we remove xview. I fondly remember workman from the early '90s, but there are plenty of CD players around these days. I can't really comments on nmrpipe.

Having said all this I'm not sure what I would vote. :-/
Comment 7 Samuli Suominen (RETIRED) gentoo-dev 2008-12-01 06:29:09 UTC
(In reply to comment #6)
> Stuff that depends on xview:
> media-sound/workman

Workman has been deleted from tree.
Comment 8 Peter Volkov (RETIRED) gentoo-dev 2008-12-02 18:14:45 UTC
BTW, one possible solution is to move this package (well, it's updated version) into sunrise. But then somebody of users should step in and maintain it there...
Comment 9 Samuli Suominen (RETIRED) gentoo-dev 2008-12-02 20:24:17 UTC
# Samuli Suominen <drac@gentoo.org> (02 Dec 2008)
# Masked by treecleaners for bugs 88334, 244190, 245408 and 245409.
# Removed in ~60 days.
x11-libs/xview
sci-chemistry/nmrpipe
Comment 10 Samuli Suominen (RETIRED) gentoo-dev 2008-12-02 20:26:21 UTC
(In reply to comment #6)
> Stuff that depends on xview:
> 
> app-editors/jove:X
> games-fps/imaze:!Xaw3d

USE="X" been removed from jove and imaze is using Xaw3d now.

> sci-chemistry/nmrpipe

Unfortunately this went into the mask with xview.

(In reply to comment #8)
> BTW, one possible solution is to move this package (well, it's updated version)
> into sunrise. But then somebody of users should step in and maintain it
> there...

Good idea.
Comment 11 Samuli Suominen (RETIRED) gentoo-dev 2008-12-06 06:35:17 UTC
Adding sci so they can possibly fix or bump nmrview, which seems propietary U.S. goverment foo to me.
Comment 12 Samuli Suominen (RETIRED) gentoo-dev 2008-12-06 06:39:39 UTC
(In reply to comment #11)
> Adding sci so they can possibly fix or bump nmrview, which seems propietary
> U.S. goverment foo to me.
> 

nmrpipe, sorry.
Comment 13 Donnie Berkholz (RETIRED) gentoo-dev 2008-12-07 08:18:11 UTC
(In reply to comment #11)
> Adding sci so they can possibly fix or bump nmrview, which seems propietary
> U.S. goverment foo to me.

It's ironic how something can be public domain yet so annoying to obtain, isn't it?
Comment 14 Justin Lecher (RETIRED) gentoo-dev 2008-12-10 14:57:45 UTC
(In reply to comment #8)
> BTW, one possible solution is to move this package (well, it's updated version)
> into sunrise. But then somebody of users should step in and maintain it
> there...
> 

I would take this over as I use it regularly. Try to get a fixed version including all patches at the weekend.
Comment 15 Samuli Suominen (RETIRED) gentoo-dev 2008-12-21 09:09:25 UTC
Removed from tree.

(In reply to comment #14)
> I would take this over as I use it regularly. Try to get a fixed version
> including all patches at the weekend.

Please use Sunrise overlay.