public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* TMP and TEMP get redefined, but I need the original values
@ 2011-06-12 17:56 Roland Bluethgen
  2011-06-12 19:07 ` Ken Brown
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Roland Bluethgen @ 2011-06-12 17:56 UTC (permalink / raw)
  To: cygwin

Hey folks!

I don't update my Cygwin installation regularly, but recently I did, and 
then a script of mine stopped working.

Looking for the cause I found out that the Cygwin maintainers chose to 
redefine the TEMP and TMP environment variables in /etc/profile like this:

unset TMP TEMP
TMP="/tmp"
TEMP="/tmp"

http://cygwin.com/ml/cygwin/2011-03/msg00211.html

Before that change, the TMP and TEMP defined by Windows were used 
unmodified (except for cygpath translation). I'm sure the maintainers 
have good reasons for this change. However, now I'm unable to find out 
the original TEMP setting from a script.

To help your imagination what this could be good for, the purpose of the 
script in question is for aiding in Windows maintenance, specifically 
for cleaning up the TEMP folder.

I helped myself by deactivating the lines cited above in /etc/profile 
for now, but that is clearly not a fine solution. Well, I could store 
the original values of TMP and TEMP in backup variables, like 
WINDOWS_TEMP or so. That would have to go in /etc/profile before the 
variables are unset. But then, this modification would probably get 
overwritten the next time something is changed in that file on the 
distribution side. (If it would not, I wouldn't have had the problem in 
the first place.)

So, any ideas how this could be solved in a clean way?

--
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: TMP and TEMP get redefined, but I need the original values
  2011-06-12 17:56 TMP and TEMP get redefined, but I need the original values Roland Bluethgen
@ 2011-06-12 19:07 ` Ken Brown
  2011-06-12 19:19   ` Andy Koppe
  2011-06-12 20:05 ` Thorsten Kampe
  2011-06-14  6:44 ` szgyg
  2 siblings, 1 reply; 10+ messages in thread
From: Ken Brown @ 2011-06-12 19:07 UTC (permalink / raw)
  To: cygwin

On 6/12/2011 1:55 PM, Roland Bluethgen wrote:
> Hey folks!
>
> I don't update my Cygwin installation regularly, but recently I did, and
> then a script of mine stopped working.
>
> Looking for the cause I found out that the Cygwin maintainers chose to
> redefine the TEMP and TMP environment variables in /etc/profile like this:
>
> unset TMP TEMP
> TMP="/tmp"
> TEMP="/tmp"
>
> http://cygwin.com/ml/cygwin/2011-03/msg00211.html
>
> Before that change, the TMP and TEMP defined by Windows were used
> unmodified (except for cygpath translation). I'm sure the maintainers
> have good reasons for this change. However, now I'm unable to find out
> the original TEMP setting from a script.
>
> To help your imagination what this could be good for, the purpose of the
> script in question is for aiding in Windows maintenance, specifically
> for cleaning up the TEMP folder.
>
> I helped myself by deactivating the lines cited above in /etc/profile
> for now, but that is clearly not a fine solution. Well, I could store
> the original values of TMP and TEMP in backup variables, like
> WINDOWS_TEMP or so. That would have to go in /etc/profile before the
> variables are unset. But then, this modification would probably get
> overwritten the next time something is changed in that file on the
> distribution side.

No, it wouldn't get overwritten.  Your /etc/profile will only get 
overwritten if it's unchanged from the default.

Ken

--
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: TMP and TEMP get redefined, but I need the original values
  2011-06-12 19:07 ` Ken Brown
@ 2011-06-12 19:19   ` Andy Koppe
  2011-06-12 20:50     ` Roland Bluethgen
  0 siblings, 1 reply; 10+ messages in thread
From: Andy Koppe @ 2011-06-12 19:19 UTC (permalink / raw)
  To: cygwin

On 12 June 2011 20:07, Ken Brown wrote:
> On 6/12/2011 1:55 PM, Roland Bluethgen wrote:
>>
>> Hey folks!
>>
>> I don't update my Cygwin installation regularly, but recently I did, and
>> then a script of mine stopped working.
>>
>> Looking for the cause I found out that the Cygwin maintainers chose to
>> redefine the TEMP and TMP environment variables in /etc/profile like this:
>>
>> unset TMP TEMP
>> TMP="/tmp"
>> TEMP="/tmp"
>>
>> http://cygwin.com/ml/cygwin/2011-03/msg00211.html
>>
>> Before that change, the TMP and TEMP defined by Windows were used
>> unmodified (except for cygpath translation). I'm sure the maintainers
>> have good reasons for this change. However, now I'm unable to find out
>> the original TEMP setting from a script.
>>
>> To help your imagination what this could be good for, the purpose of the
>> script in question is for aiding in Windows maintenance, specifically
>> for cleaning up the TEMP folder.
>>
>> I helped myself by deactivating the lines cited above in /etc/profile
>> for now, but that is clearly not a fine solution. Well, I could store
>> the original values of TMP and TEMP in backup variables, like
>> WINDOWS_TEMP or so. That would have to go in /etc/profile before the
>> variables are unset. But then, this modification would probably get
>> overwritten the next time something is changed in that file on the
>> distribution side.
>
> No, it wouldn't get overwritten.  Your /etc/profile will only get
> overwritten if it's unchanged from the default.

That can be a problem in itself though, if you do want to benefit from
any updates. Therefore I think that the TMP/TEMP setting should go
into /etc/profile.d/temp.sh or some such, so that it can be removed or
modified without touching /etc/profile. Saving the original values
seems a good idea too.

(The reason for overriding TMP/TEMP is that having them point at the
default Windows temp directory causes odd permissions to be picked up
from that directory in some operations. IIRC, 'patch' was the
motivating example.)

Andy

--
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: TMP and TEMP get redefined, but I need the original values
  2011-06-12 17:56 TMP and TEMP get redefined, but I need the original values Roland Bluethgen
  2011-06-12 19:07 ` Ken Brown
@ 2011-06-12 20:05 ` Thorsten Kampe
  2011-06-12 21:01   ` Roland Bluethgen
  2011-06-14  6:44 ` szgyg
  2 siblings, 1 reply; 10+ messages in thread
From: Thorsten Kampe @ 2011-06-12 20:05 UTC (permalink / raw)
  To: cygwin

* Roland Bluethgen (Sun, 12 Jun 2011 19:55:56 +0200)
> I don't update my Cygwin installation regularly, but recently I did, 
and 
> then a script of mine stopped working.
> 
> Looking for the cause I found out that the Cygwin maintainers chose to 
> redefine the TEMP and TMP environment variables in /etc/profile like this:
> 
> unset TMP TEMP
> TMP="/tmp"
> TEMP="/tmp"
> [...]
> So, any ideas how this could be solved in a clean way?

If you want Linux TMP and Windows TMP point to the same directory then 
mount it in fstab or use $USERPROFILE/AppData/Local/Temp.

Thorsten


--
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: TMP and TEMP get redefined, but I need the original values
  2011-06-12 19:19   ` Andy Koppe
@ 2011-06-12 20:50     ` Roland Bluethgen
  0 siblings, 0 replies; 10+ messages in thread
From: Roland Bluethgen @ 2011-06-12 20:50 UTC (permalink / raw)
  To: cygwin

Andy Koppe wrote:
> On 12 June 2011 20:07, Ken Brown wrote:
>> On 6/12/2011 1:55 PM, Roland Bluethgen wrote:
>>> But then, this modification would probably get
>>> overwritten the next time something is changed in that file on the
>>> distribution side.
>> No, it wouldn't get overwritten.  Your /etc/profile will only get
>> overwritten if it's unchanged from the default.
> 
> That can be a problem in itself though, if you do want to benefit from
> any updates.

I agree. To benefit from distribution side updates and still retain user 
side changes would require a merging operation on system update. FreeBSD 
does it this way, it's rather complicated procedure.


> Therefore I think that the TMP/TEMP setting should go
> into /etc/profile.d/temp.sh or some such, so that it can be removed or
> modified without touching /etc/profile.

I'm not sure if it's so easy. The profile.d inclusion is performed 
pretty far down in /etc/profile and a properly set up TMP might be 
required before that point in the startup file.


--
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: TMP and TEMP get redefined, but I need the original values
  2011-06-12 20:05 ` Thorsten Kampe
@ 2011-06-12 21:01   ` Roland Bluethgen
  2011-06-13  6:20     ` Thorsten Kampe
  0 siblings, 1 reply; 10+ messages in thread
From: Roland Bluethgen @ 2011-06-12 21:01 UTC (permalink / raw)
  To: cygwin

Thorsten Kampe wrote:
> If you want Linux TMP and Windows TMP point to the same directory then 
> mount it in fstab or use $USERPROFILE/AppData/Local/Temp.

I shortened the story a bit, it's really more complicated. The TMP 
definition in my case is user-crafted, not the default value which is 
normally set up when a user is created in the Windows system.

Also, this approach would defeat the intended purpose of the 
redefinition of TMP (avoiding permissions screwup). Or am I missing 
something here?

--
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: TMP and TEMP get redefined, but I need the original values
  2011-06-12 21:01   ` Roland Bluethgen
@ 2011-06-13  6:20     ` Thorsten Kampe
  2011-06-13 14:15       ` Roland Bluethgen
  0 siblings, 1 reply; 10+ messages in thread
From: Thorsten Kampe @ 2011-06-13  6:20 UTC (permalink / raw)
  To: cygwin

* Roland Bluethgen (Sun, 12 Jun 2011 23:01:12 +0200)
> Thorsten Kampe wrote:
> > If you want Linux TMP and Windows TMP point to the same directory then 
> > mount it in fstab or use $USERPROFILE/AppData/Local/Temp.
> 
> I shortened the story a bit, it's really more complicated. The TMP 
> definition in my case is user-crafted, not the default value which is 
> normally set up when a user is created in the Windows system.

TMP in Cygwin is "user-crafted"? TMP in Windows? TMP in your script?
 
> Also, this approach would defeat the intended purpose of the 
> redefinition of TMP (avoiding permissions screwup). Or am I missing 
> something here?

If you're the only Cygwin user on your machine, this is a reasonable 
way. Otherwise not.

Thorsten


--
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: TMP and TEMP get redefined, but I need the original values
  2011-06-13  6:20     ` Thorsten Kampe
@ 2011-06-13 14:15       ` Roland Bluethgen
  0 siblings, 0 replies; 10+ messages in thread
From: Roland Bluethgen @ 2011-06-13 14:15 UTC (permalink / raw)
  To: cygwin

Thorsten Kampe wrote:
> * Roland Bluethgen (Sun, 12 Jun 2011 23:01:12 +0200)
> 
> TMP in Cygwin is "user-crafted"? TMP in Windows? TMP in your script?

TMP in Windows.


>> Also, this approach would defeat the intended purpose of the 
>> redefinition of TMP (avoiding permissions screwup). Or am I missing 
>> something here?
> 
> If you're the only Cygwin user on your machine, this is a reasonable 
> way. Otherwise not.

You mean, the permissions problem only surfaces on machines, where 
multiple users use the same cygwin install? Ok, I'll consider that.

For now I resorted to copying the TEMP value to WINDOWS_TEMP on the 
native Windows side already, and then refer to that backup from the 
script in question.


--
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: TMP and TEMP get redefined, but I need the original values
  2011-06-12 17:56 TMP and TEMP get redefined, but I need the original values Roland Bluethgen
  2011-06-12 19:07 ` Ken Brown
  2011-06-12 20:05 ` Thorsten Kampe
@ 2011-06-14  6:44 ` szgyg
  2011-06-14 18:21   ` Roland Bluethgen
  2 siblings, 1 reply; 10+ messages in thread
From: szgyg @ 2011-06-14  6:44 UTC (permalink / raw)
  To: cygwin

On 6/12/2011 7:55 PM, Roland Bluethgen wrote:
> Looking for the cause I found out that the Cygwin maintainers chose to
> redefine the TEMP and TMP environment variables in /etc/profile
>
> However, now I'm unable to find out
> the original TEMP setting from a script.

Windows stores the environment variables in the registry, under 
`HKEY_CURRENT_USER\Environment' and 
`HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session 
Manager\Environment'. You can access these through /proc/registry in 
cygwin. For an example see the PRINTER setting in /etc/profile.

szgyg

--
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: TMP and TEMP get redefined, but I need the original values
  2011-06-14  6:44 ` szgyg
@ 2011-06-14 18:21   ` Roland Bluethgen
  0 siblings, 0 replies; 10+ messages in thread
From: Roland Bluethgen @ 2011-06-14 18:21 UTC (permalink / raw)
  To: cygwin

szgyg wrote:
> Windows stores the environment variables in the registry, under 
> `HKEY_CURRENT_USER\Environment' and 
> `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session 
> Manager\Environment'. You can access these through /proc/registry in 
> cygwin. For an example see the PRINTER setting in /etc/profile.

That is an excellent note. Documentation can be found at
http://www.cygwin.com/cygwin-ug-net/using-specialnames.html. The regtool 
might be also useful in this regard.



--
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-06-14 18:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-12 17:56 TMP and TEMP get redefined, but I need the original values Roland Bluethgen
2011-06-12 19:07 ` Ken Brown
2011-06-12 19:19   ` Andy Koppe
2011-06-12 20:50     ` Roland Bluethgen
2011-06-12 20:05 ` Thorsten Kampe
2011-06-12 21:01   ` Roland Bluethgen
2011-06-13  6:20     ` Thorsten Kampe
2011-06-13 14:15       ` Roland Bluethgen
2011-06-14  6:44 ` szgyg
2011-06-14 18:21   ` Roland Bluethgen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).