env-search is a program idea I had and implemented. If you have a
program that works in one account and not another, but still on the same
machine, then env-search may be able to help you:
Find out whether the problem is related to a difference in
environment variables (good for any number of env var differences)
Which env var needs to be changed in the broken account, to make
the program work (assuming there is a single-variable difference
that will lead to a solution)
The usual causes of a program working for one account, and not another
are (just to contextualize the usefulness of env-search) :
Permissions (access) differences
Environment variable differences (this is the one that env-search
helps with)
Different file and/or directory content in a place pointed to by
an environment variable, for example $HOME or $TMPDIR
Differences in registry-like facilities, like gconf or ODM.
Usage is like:
badaccount$ env-search -s /tmp/broken
goodaccount$ env-search -s /tmp/working
Write a script that can run your program, and exits with a 0
status (*ix true) if the program ran correctly, or exits with a status of 1
(*ix false) if the program ran incorrectly. It has to be 0 and 1,
not 0 and nonzero. Call it "/tmp/test-prog", for the sake of
discussion. An example script follows.
#!/bin/bash
make clean > /dev/null 2>&1
yes '' 2> /dev/null | ./Configure > /dev/null 2>&1
if make 2>&1 | grep 'undefined struct/union member' > /dev/null 2>&1
then
exit 1
else
exit 0
fi
...and then sit back and wait while the program does some
testing. Ideally, it'll refine your understanding of the problem at least
a little bit, if not tell you exactly which variable you need to
work with (IE, which environment variable to set to what value, to
make the broken account, unbroken :).
Here's some sample output:
tokyo-root> /tmp/env-search -b /tmp/broken -w /tmp/working -c /tmp/check -r
Good, brokendict does yield a false result from compareprog
Good, workingdict does yield a true result from compareprog
same in both: ['GSU', 'HOSTNAME', 'HOSTTYPE', 'MACHTYPE', 'OSTYPE',
'PWD', 'TARGETUSER', 'TZ', '_']
same name in both but different values: ['DISPLAY', 'EDITOR', 'HOME',
'LOGNAME', 'MAIL', 'PATH', 'PS1', 'SHELL', 'SHLVL', 'SSH_CONNECTION',
'SSH_TTY', 'TERM', 'USER', 'XAUTHORITY']
missing from working: ['DONOTPASS', 'MAILCHECK']
missing from broken ['CC', 'CONFIG_SHELL', 'EXINIT', 'LESS', 'MANPATH',
'OS', 'PAGER', 'SIGNATURE', 'SSH_AUTH_SOCK', 'TMOUT', 'TMPDIR']
var DISPLAY did not appear to help, continuing...
var EDITOR did not appear to help, continuing...
var HOME did not appear to help, continuing...
var LOGNAME did not appear to help, continuing...
var MAIL did not appear to help, continuing...
Good, modifying the value of:
PATH
...to...
/dcs/packages/ethereal/bin:/dcs/packages/security/bin:/dcs/packages/samba/bin:/dcs/packages/gnu/bin:/dcs/packages/cap/bin:/dcs/bin:/dcs/etc:/dcslib/allsys/bin:/dcslib/allsys/etc:/usr/openwin/bin:/usr/X11R6/bin:/usr/bin/X11:/dcs/packages/Xlocal/bin:/dcs/packages/X/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/etc:/etc:/usr/ucb:/usr/bsd:/usr/proc/bin
...appears to have fixed the problem.
Good, this appears to be a single variable problem.
tokyo-root>
This software is owned by The university of California, Irvine,
and is not distributed under
any version of the GPL. GPL is a fine series of licenses, but the owners of the software need it to be distributed under these terms.
export-to-env-search is a related program. It reads a list of "export VARIABLE='value'" lines, and converts them to the
format env-search uses to save an environment in a file. There's further documentation in the comments at the top of the script.
Future directions:
It'd be nice to handle problems stemming from multiple
environment variables more effectively.
It'd also be nice to have a mode where the user explicitly agrees
to assume a single-environment-variable-issue, and the program uses
that information to speed up the search, using a binary search.
It might be useful to have a mode where you don't have to specify
a check command with the -c flag, instead having the program ask you
if things are working on each iteration. This would probably be more
practical if combined with item #2 above, to reduce the number of
iterations from n to log(n).
I'm starting to realize that this same technique could be applied
to other things as well, like the files in two accounts' home
directories, gconf data, and more.