TMP/TEMP environment variable and /tmp

Thomas Wolff towo@towo.net
Wed Sep 16 11:12:03 GMT 2020


Am 16.09.2020 um 13:04 schrieb marco atzeri via Cygwin:
> On Wed, Sep 16, 2020 at 10:53 AM Kristian Ivarsson via Cygwin
> <cygwin@cygwin.com> wrote:
>> Dear folks
>>
>> Does anyone know why cygwin annex the TMP (and TEMP) environment variable(s)
>> and sets them to /tmp for cygwin-built-applications (executables) ?
>>
>> This results in that when you want the current users TMP-folder you end up
>> with the /tmp path. As a result,when writing to that, without having cygwin
>> installed (e.g. C:\cygwin64\), it seems like it refers to ${CWD}/../tmp/ and
>> that is not always accessible by all users
>>
>>
>> Does anyone know the rational with this behaviour and what can be done to
>> get hold of the (real) Windows TMP/TEMP environment-variable-values (in a
>> (hopefully) platform independent way) ?
>>
>>
>> Best regards,
>> Kristian
>>
> the logic behind is that the program should be located
> in
>      $YOUR_ROOT/bin
>
> and the temp will be
>      $YOUR_ROOT/tmp
>
> so if you are making your custom tree, try to stick on that expectation
> and have both directories.
In general, you are free to set TMP to a directory of your choice, 
that's the purpose of that variable, no need to sync it with some root.
There is a comment in /etc/profile:
   # TMP and TEMP as defined in the Windows environment
   # can have unexpected consequences for cygwin apps,
but it does not explain what consequences that might be; probably some 
trouble with ACL/access permissions for temporary files.
Thomas


More information about the Cygwin mailing list