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

Bug#617236: olwm&olvwm: DISPLAY environment variable corrupted

Package: olwm
Version: 3.2p1.4-25.1
Severity: grave
Tags: patch
Justification: renders package unusable


OK, I know that xview, olwm, olvwm are DEAD... but

I was very happy to see that they now compile on amd64.
(I had earlier lamely tried compiling them myself on this architecture
without much success, nor putting much effort, either.)

However, I loved olvwm and xview, and ALL current GUI developers
should read the Open Look Style Guide, as it clearly explains how a window
manager and GUI system should behave. Lessons that have NOT been learnt.

Even though I loved olvwm, I will probably not use it again much,
or for long, as we have all become dependent on more modern windowing
systems. But perhaps in a spate of some sort of mid-life crisis
I will nostalgically go back to it, and find efficiency and happiness.


olwm and olvwm corrupt the environment variable DISPLAY.
If it is set to ":0" as by default on my system,
the window manager resets it to ".0", breaking everything.
If it is set to ":0.0", then everything goes fine.

The problem is in olwm/environ.c and olvwm-4.1/environ.c
My rusty programming experience (that dates from the period when xview
was developed, and before) sees nothing wrong, except:

< 	(void)sprintf(value,"%.*s.%d",len,display,screen);
> 	(void)sprintf(value,"%*s.%d",len,display,screen);

I do not understand what "%.*s" means, and I believe that this is a typo.
Removing the "." produces working olwm and olvwm.

Thanks again for getting this to compile under amd64
(the problem was probably in a dependency that was fixed).
Please fix the package before anyone else notices.

Thank you.


-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.37 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages olwm depends on:
ii  libc6                       2.11.2-13    Embedded GNU C Library: Shared lib
ii  libx11-6                    2:1.4.1-5    X11 client-side library
ii  libxext6                    2:1.2.0-2    X11 miscellaneous extension librar
ii  xviewg                      3.2p1.4-25.1 XView shared libraries

olwm recommends no packages.

Versions of packages olwm suggests:
ii  menu                        2.1.44       generates programs menu for all me
ii  xview-clients               3.2p1.4-25.1 XView client programs

-- no debconf information
#ident	"@(#)environ.c	1.9	93/06/28 SMI"

 *      (c) Copyright 1989 Sun Microsystems, Inc.

 *      Sun design patents pending in the U.S. and foreign countries. See
 *      LEGAL_NOTICE file for terms of the license.

#include <stdio.h>
#ifdef SYSV
#include <string.h>
#include <strings.h>
extern char *strrchr();
extern char *strchr();
#include <X11/Xos.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include "mem.h"

extern	char **environ;

/* -----------------------------------------------------------------------
 *	Local Data Structures
 * -----------------------------------------------------------------------*/

 * 	Env - environment object
typedef struct _env {
	char	**environ;	/* array of environment strings */
	int	length;		/* length of environ array */
	int	used;		/* number of entries actually used */
} Env;

/* -----------------------------------------------------------------------
 *	Local Functions
 * -----------------------------------------------------------------------*/

 *	createEnv - Creates a new environment array that is the length of
 *		    of the current environment plus the number of additions.
static void
	Env	*env;
	int	nadditions;
	int	i = 0;

	/* find the number of items in the current environ */
	while (environ[i] != (char *)NULL) {

	/* create space for the environ strings */
	env->used = i;
	env->length = env->used + nadditions + 1;
	env->environ = MemAlloc(env->length*sizeof(char *));

	/* copy the current environ into the new one */
	for (i=0; i<env->used; i++) {
		env->environ[i] = MemNewString(environ[i]);
	env->environ[i] = (char *)NULL;

 *	putEnv - Puts the name,value pair into the specified environment
 *	         replacing any existing values.
 *		 Assumes there is space for the new setting.
static void
	Env	*env;
	char	*name;
	char	*value;
	int	nameLen = strlen(name);
	char	*envVar;
	int	count;

	/* create new env string with space for '=' and null */
	envVar = (char *)MemAlloc(nameLen + strlen(value) +2);


	/* search through, checking for variable in question */
	for (count=0 ; count<env->used; count++) {
		if (!strncmp(env->environ[count],name,nameLen))

	if (count == env->used)		/* finished loop without match */
		env->used++;		/* added 1 more var to the env */
		MemFree(env->environ[count]);	/* don't need */

	env->environ[count] = envVar;

	/* make sure the last entry in the vector is NULL */
	env->environ[env->used] = (char *)NULL;


 *	putDisplayEnv - sets the DISPLAY env to the appropriate screen
static void
	Env	*env;
	Display	*dpy;
	int	screen;
	char	*display = DisplayString(dpy);
	char	*colon,*dot;
	char	value[128];
	int	len;

	if ((colon = strrchr(display,':')) == (char *)NULL) {
	if ((dot = strchr(colon,'.')) != (char *)NULL) {
		len = dot - display;
	} else {
		len = colon - display;



#ifndef NOSVENV
 *	putSunViewEnv - sets the various SV environment variables
static void
	Env	*env;
	Display *dpy;
	int	screen;
	static char	*svEnv[] = { "WINDOW_PARENT", 
				     "WINDOW_TTYPARMS" };
	int		i, svEnvLen = sizeof(svEnv)/sizeof(char *);
	char		*result,*curpos;
	unsigned long	nitems,remainder;
	extern void	*GetWindowProperty();
	extern Atom	AtomSunViewEnv;

	result = (char *)GetWindowProperty(dpy,RootWindow(dpy,screen),

	if (result == NULL)

	curpos = result;
	for (i=0; i<svEnvLen; i++) {
		curpos += strlen(curpos) + 1;
	XFree((char *)result);
#endif /* NOSVENV */

/* -----------------------------------------------------------------------
 *	Global Functions
 * -----------------------------------------------------------------------*/

 *	MakeEnviron - returns a new environment array that contains the
 *		      current environ plus a modified DISPLAY and
 *		      SunView environment variables.
char **
	Display	*dpy;
	int	screen;
	Env	newEnv;
	int	nadditions;

	nadditions = 1;		/* for DISPLAY */

#ifndef NOSVENV
	nadditions += 3;	/* for SV environment */
#endif /* NOSVENV */



#ifndef NOSVENV
#endif /* NOSVENV */

	return newEnv.environ;

Reply to: