delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org A400F3857C79 |
DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; |
s=default; t=1600408613; | |
bh=cD1ORuZV8aShCrfgP5nPDx4GCyW23x9AzRt0Eu3d7J0=; | |
h=Subject:Date:References:In-Reply-To:To:List-Id:List-Unsubscribe: | |
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: | |
From; | |
b=swnbtujHvWPVEjcODZ6BNDU69bZ5P/LEWqAKy08y+NRQIeXaIYhML0OkCxOeu154M | |
o0GeD9+yRAIJ5L9XHokcZfRee2/GvfUkFo5Az9UL4CaKBnPT7Wg4bh332NZzRdeXwY | |
lQ3cQyE9UOqK3CaYrdOhFdx6V/o5KleMmaiwihTs= | |
X-Original-To: | cygwin AT cygwin DOT com |
Delivered-To: | cygwin AT cygwin DOT com |
DMARC-Filter: | OpenDMARC Filter v1.3.2 sourceware.org E0E583857C79 |
X-Google-DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; |
d=1e100.net; s=20161025; | |
h=x-gm-message-state:content-transfer-encoding:from:mime-version | |
:subject:date:message-id:references:cc:in-reply-to:to; | |
bh=euJo6x6o9quoh74zdP7MKT5Tkl2cM62yn0FANISAzHQ=; | |
b=LnxhmgyFAGQ/FfYm+eSGjb4I3YeM+JKm7Imvu8WlgPdTEuqif4JQJ1gWjJL8FshGOt | |
wn2Gg79wUjW5+R5Uv+/r0O3vzDmjEUSXL1DBK3MUnOyCKvw3K9g4sI/DPFM5Aa1EjaGO | |
ovfkqkt0qVV65po1zVzlCSOSBdkVRxkP6xTEBD2h0/nta5hls+fjEffa5ij0Bt2BzPAi | |
K+vWjseihOvWZDmJFcJx8TO6w11a7VzZ+XX6AdBClLa0IdR+uXJNSiB+lxY9bAtI9ibn | |
SXFnOmlAHD70RCB+lB8jkulwu61ZwemivqC+Tug7mNqJLqNjUEo9UbtlEsFo9Ka341oU | |
TymQ== | |
X-Gm-Message-State: | AOAM531vUyHku/97lGFDHccvsUki7gpfQb8qPspdmyifXnGvrnI23WD0 |
LmlFp3LB0O92nUBYFaKT9S8= | |
X-Google-Smtp-Source: | ABdhPJy0tjbz6XNXjdj2PcMTBS1cRPtPaKd+JGQfg9YsVItqQZduJMl4GNf3ed9eDG+sGA4XJYYPiQ== |
X-Received: | by 2002:a2e:8597:: with SMTP id b23mr11594640lji.41.1600408609378; |
Thu, 17 Sep 2020 22:56:49 -0700 (PDT) | |
Mime-Version: | 1.0 (1.0) |
Subject: | Re: TMP/TEMP environment variable and /tmp |
Date: | Fri, 18 Sep 2020 07:56:47 +0200 |
Message-Id: | <EA51058C-D017-4CCE-B207-C5EFD8CCC088@gmail.com> |
References: | <423c729e-4c66-dd5e-73c0-4c636089ea35 AT cornell DOT edu> |
In-Reply-To: | <423c729e-4c66-dd5e-73c0-4c636089ea35@cornell.edu> |
To: | Ken Brown <kbrown AT cornell DOT edu> |
X-Mailer: | iPhone Mail (17H35) |
X-Spam-Status: | No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, |
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, MIME_QP_LONG_LINE, | |
RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, | |
TXREP autolearn=ham autolearn_force=no version=3.4.2 | |
X-Spam-Checker-Version: | SpamAssassin 3.4.2 (2018-09-13) on |
server2.sourceware.org | |
X-BeenThere: | cygwin AT cygwin DOT com |
X-Mailman-Version: | 2.1.29 |
List-Id: | General Cygwin discussions and problem reports <cygwin.cygwin.com> |
List-Archive: | <https://cygwin.com/pipermail/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-request AT cygwin DOT com?subject=help> |
List-Subscribe: | <https://cygwin.com/mailman/listinfo/cygwin>, |
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe> | |
From: | Kristian Ivarsson via Cygwin <cygwin AT cygwin DOT com> |
Reply-To: | Kristian Ivarsson <sten DOT kristian DOT ivarsson AT gmail DOT com> |
Cc: | cygwin AT cygwin DOT com |
Sender: | "Cygwin" <cygwin-bounces AT cygwin DOT com> |
X-MIME-Autoconverted: | from base64 to 8bit by delorie.com id 08I5vLTo009509 |
>>>>>>>> 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) ? >>>>>>> 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. >>>>> Nowadays that would be $LOCALAPPDATA/Temp, or if you really insist, the >>>>> content of /proc/registry/HKEY_CURRENT_USER/Environment/TMP (or TEMP), >>>>> after similarly expanding environment variable references found in that. >>>>> >>>>> The fact that getting Windows' idea of the user's TEMP directory is not >>>>> immediately platform independent may well have been part of the rationale >>>>> for not even trying that. >>>> >>>> Well, at least it's up to the user >>>> >>>> If the user sets its TMP-variable to "C:\Jabba Dabba Dooo" or "/jabba dabba doo", I expect the value of getenv("TMP") should be just that and regardless of OS the value returned is whatever the variable is set to and not magically changed to "/tmp" >>> Of course and that's not happening, no worries. The issue was that TMP is set in /etc/profile and not inherited from the Windows environment. >> Well, where my Cygwin-compiled-application is running, there’s no Cygwin-installation and thus no /etc/profile so it cannot be set there (if /etc/profile is not a built in resource in every executable), so there must be some text-value inside the compiled executables used in some manner somehow > > There must be something going on in your environment that you haven't told us yet. I just tried the following test case: > > #include <stdio.h> > #include <stdlib.h> > int > main () > { > printf ("The value of TMP is %s\n", getenv ("TMP")); > } > > In a Cygwin bash shell I get > > The value of TMP is /tmp > > Running the same executable under a Windows Command Prompt, I get > > The value of TMP is /c/Users/kbrown/AppData/Local/Temp > > So Cygwin converts TMP to a Posix path [*], but it doesn't change it to "/tmp". > > Ken > > [*] See environ.cc:303 for a list of environment variables that Cygwin converts. Hmm, you’re right Ken I tried this before taking off for a vacation and the Windows-TMP-variable is extracted I now suspect that we maybe do have some logic that falls back to /tmp if the TMP-variable is NULL and perhaps the variable is NULL because we launch the process with CreateProcess and perhaps the environment-variables doesn’t get inherited then ? The reason why we use CreateProcess from within a cygwin-application to create another cygwin-application (instead of fork or such) might seem weird, but it has its reasons I need to confirm this after the vacation-trip or if someone already know if environment-variables “dissapear” if things such as CreateProcess are used ? Best regards, Kristian -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple
webmaster | delorie software privacy |
Copyright 2019 by DJ Delorie | Updated Jul 2019 |