ssh + patch + $TMP
Cyrille Lefevre
cyrille.lefevre-lists@laposte.net
Tue Mar 9 02:53:00 GMT 2010
Kurt Franke a écrit :
> -----Ursprüngliche Nachricht-----
> Von: Cyrille Lefevre <cyrille.lefevre-lists@laposte.net>
> Gesendet: 06.03.2010 23:30:57
> An: cygwin@cygwin.com,Kurt-Franke@web.de
> Betreff: Re: ssh + patch + $TMP
>
>> the attached script only fork 5 processes (ps, grep, mount, find and
>> awk), and does not use any temporary files, so, it should not degrade
>> ssh logins performance.
>> existing environment variables are not overwritten.
<snip things I known for a long time, now, about 20 years of unix behind
me..., but you couldn't known that, so, don't care>
> thus you must write the environment settings build in awk script from registry to
> a file and source it at shell level after awk script has finished.
you are wrong here, no need for an output file to be sourced, you miss
the eval statement which interpret the output of the awk script within
the current shell. however, I've fixed a small bug here, it should be
eval "$(...)" and not eval $(...).
> and, of course, not all all existing environment variables should be preserved.
as said before, only non existing variables are exported. however, I've
added an array (override) of environment variables to override.
> in the special those with bad values must get a correct value.
all windows variables are converted to cygwin ones using cygpath -u like
translation within awk. however, I've added an array (nocygpath) of
variables to not translate.
> for example TMP and TEMP have invalid values after a logon via sshd - they are set
> to the value used by the user which is running the sshd and to the value of
> the actual user.
original TEMP variable :
TEMP="/cygdrive/c/Users/CYG_SE~1/AppData/Local/Temp"
yours (wrong) :
TEMP="/cygdrive/c/AppData/Local/Temp"
mine w/ override=TEMP :
TEMP="/cygdrive/c/Users/Cyrille/AppData/Local/Temp"
also, you don't handle ComSpec, nor Path and windir upper case
conversion as cygwin does and the Path content isn't added to the
current PATH one as windows does (improved w/ no duplicates).
> if running with a windows version less 6.0 in a sshd session USERNAME and USERDOMAIN
> have the values belonging to the SYSTEM user and not the values of the actual user.
did you setup cyglsa ?
what is the value of whoami from the "Windows XP Support Tools" ?
=> /cygdrive/c/program\ files/support\ tools/whoami
under Vista, it's /cygdrive/c/windows/system32/whoami
> may be some others have also invalid values.
> I think it is better to preserve a known list of variables and overwrite all others.
whatever you wanted, the idea was here and I just wanted to help you to
optimize your work.
anyway, I do it for fun, so, please, be more gentle next time and don't
fire someone else for whatever reason.
your script takes 15s while mine takes 1s only, so, learn about it.
Regards,
Cyrille Lefevre
--
mailto:Cyrille.Lefevre-lists@laposte.net
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ssh-session-env.sh
URL: <http://cygwin.com/pipermail/cygwin/attachments/20100309/1c3b0349/attachment.ksh>
-------------- next part --------------
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list