tramp-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Guard against random bash bug


From: Dominique Quatravaux
Subject: Re: [PATCH] Guard against random bash bug
Date: Wed, 14 Dec 2016 21:32:51 +0000


Le 14 déc. 2016 à 21:46, Michael Albinus <address@hidden> a écrit :

$val
itself could be '' (two single quotation marks), telling us "the empty
string". With your patch, '' would be taken literally.

Hmm, I did some tests like this (if you'll pardon the pedestrian style),

(setq tramp-remote-process-environment (setenv-internal tramp-remote-process-environment "TEST1" "''" t))
(setq tramp-remote-process-environment (setenv-internal tramp-remote-process-environment "TEST2" "\"" t))
(setq tramp-remote-process-environment (setenv-internal tramp-remote-process-environment "TEST3" "'" t))
(setq tramp-remote-process-environment (setenv-internal tramp-remote-process-environment "TEST4" "$" t))
(setq tramp-remote-process-environment (setenv-internal tramp-remote-process-environment "TEST5" "' )" t))
(setq tramp-remote-process-environment (setenv-internal tramp-remote-process-environment "TEST6" "!true" t))

and it all came out correctly:

kilimandjaro:~$ env|grep TEST
TEST4=$
TEST1=''
TEST6=!true
TEST2="
TEST3='
TEST5=' )

I seem to remember from "man bash" that double quotes protect against word splits (which happen fairly late themselves), and that variable expansions are not recursive. 

(Although your code does work, too so really it's up to you)

Yours truly,

— 
Dominique Quatravaux
Responsable informatique STI EPFL
+41 21 69 35624


reply via email to

[Prev in Thread] Current Thread [Next in Thread]