[CMake] Finding the "Temp" directory code

Michael Wild themiwi at gmail.com
Sat Nov 14 05:58:33 EST 2009


On 14. Nov, 2009, at 11:44 , Eric Noulard wrote:

> 2009/11/14 Michael Wild <themiwi at gmail.com>:
>>
>> Just using /tmp isn't such a good idea (because of predictability and
>> symlink attacks). Which is why on APPLE TMPDIR looks like for, but  
>> this
>> changes with each session.
>>
>> /var/folders/Z9/Z9lmRtS+E1CUYo8TIW8r8E+++TM/-Tmp-
>
> I didn't know that property of "session-uniqueness" but that's  
> pretty good.
> There is no such mechanism I am aware of on Linux
>
>> Probably you CAN use /tmp if on UNIX and TMPDIR is not set, but  
>> then you
>> should create a sub-directory with STRING(RANDOM ...)
>
> Yes I agree my primary reason for doing that (create a subdir)
> wasn't security but uniqueness, now I think one should require both
> by crafting a tmpdir from  STRING(RANDOM ...)
> AND
> some USER specific data as a prefix or suffix like ENV(USER) or ENV 
> (USERNAME).
>

Hmm, not sure anymore its unique to the session. Just tried logging in  
and out several times with different users, and it seems that I always  
get the same temporary directory for a each user. Not sure what  
happens on reboot.

Michael



More information about the CMake mailing list