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:

The usual causes of a program working for one account, and not another are (just to contextualize the usefulness of env-search) :
  1. Permissions (access) differences
  2. Environment variable differences (this is the one that env-search helps with)
  3. Different file and/or directory content in a place pointed to by an environment variable, for example $HOME or $TMPDIR
  4. Differences in registry-like facilities, like gconf or ODM.


Usage is like:
  1. badaccount$ env-search -s /tmp/broken
  2. goodaccount$ env-search -s /tmp/working
  3. 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.
  4. badaccount$ env-search -b /tmp/broken -w /tmp/working -c /tmp/test-prog
  5. ...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:

download it here

  • 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:
    1. It'd be nice to handle problems stemming from multiple environment variables more effectively.
    2. 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.
    3. 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).
    4. 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.



    Hits: 4235
    Timestamp: 2024-03-01 12:18:08 PST

    Back to Dan's tech tidbits

    You can e-mail the author with questions or comments: