Search code examples
rubycygwin

Cygwin, via SSH, is missing a system variables


A bunch of system variables are missing in Cygwin when using ssh. Some that I noticed include:

  • A proper PATH including the Visual Studio paths.
  • VS80COMNTOOLS
  • TEMP
  • TMP
  • PROCESSOR_ARCHITECTURE
  • PROCESSOR_IDENTIFIER
  • PROCESSOR_LEVEL
  • PROCESSOR_REVISION
  • FP_NO_HOST_CHECK
  • PSMODULEPATH

This impacts trying to compile source, such as ruby, via ssh. These variables exist when using rdesktop.

How do I get these variables to exist in Cygwin when using ssh?


Solution

  • I found a post describing how to work around this: http://smithii.com/node/44

    Here is the bit 'o bash from that page:

    if [ "$SSH_TTY" ]; then
    pushd . >/dev/null
    for __dir in \
    /proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Session\ Manager/Environment \
    /proc/registry/HKEY_CURRENT_USER/Environment
    do
        cd "$__dir"
        for __var in $(ls -1 | tr '[a-z]' '[A-Z]')
        do
            test -z "${!__var}" && export $__var="`cat $__var`" >/dev/null 2>&1
        done
    done
    unset __dir
    unset __var
    popd >/dev/null
    fi
    

    edited: Moved the tr so it is only done once. It was painfully slow otherwise.