From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2099.outbound.protection.outlook.com [40.107.237.99]) by sourceware.org (Postfix) with ESMTPS id 104EC3870902 for ; Thu, 17 Sep 2020 21:55:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 104EC3870902 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TGJXr/LDfXOuiLKeZZ+QpqNpox50LR0hbsFb5w4PviYnbnfVtwuGBputnJvWyLE89SIgRA+yZtwnSIu7nqbFkwIq1hrtwKgda0Q2EeSN4kBNqvQim30cSoX3JLX/+BH5+/hZ1Co3fur1zh0VsZnEErfYZz+bl+DBZSTiqJGU/tUvdgNg78SkbFZEYnh/0+P8FEKjKRCZj/RkhbtdKcgP7Bd42/0K75JWcbfZKktEL6zRfkkD7cPFuAFhV2tUM+G79+Cmk2d8FfSwGqPnZ6f+MTQKEJavq+/jxRuhCasn7m3aPzs1aEhKJaqhStWiQI14k8lCBCyp/l2ozSlH855QJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UXaX02yjJkSiQ5/JQVbF/dZ9sblWqQT0lZxXXYsMPUI=; b=EuWVQlCF0NPPA3q4T3sXIfBmj/ejyobQ5EvAxlfd518T3879HNrqEqXSieiM/9p8988sZMe3HBE3cJVvZC4w82iWOEkEFGCQ9yG2AEcOQFGEB8b4reiqJPrc4Kqx6ZAFAVdNS5k1OFw92H4nJbk9f2cCFdinquJk00X8stNptEwnNYdFQFEX472lTa0bjsWYZfqZPwOZDiUY/BG9OT+/KW19v092Sw0XRXGJgX1SIa6G+nBnf9CD1G9W/NLnc9oQ6PY8A/gvVCE2TUI1F9yXuwJ0xts2WQG3vUJrCUuNv3FTV6ObbyNT+fcteT5E9njOtGgZmzNJH6PwxezBsmr03A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cornell.edu; dmarc=pass action=none header.from=cornell.edu; dkim=pass header.d=cornell.edu; arc=none Received: from MN2PR04MB6176.namprd04.prod.outlook.com (2603:10b6:208:e3::13) by MN2PR04MB5744.namprd04.prod.outlook.com (2603:10b6:208:3a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16; Thu, 17 Sep 2020 21:55:38 +0000 Received: from MN2PR04MB6176.namprd04.prod.outlook.com ([fe80::c144:d206:c369:af44]) by MN2PR04MB6176.namprd04.prod.outlook.com ([fe80::c144:d206:c369:af44%7]) with mapi id 15.20.3348.019; Thu, 17 Sep 2020 21:55:38 +0000 Subject: Re: TMP/TEMP environment variable and /tmp To: Kristian Ivarsson Cc: cygwin@cygwin.com References: <3423eb8a-447e-015e-9eb7-84d455db0c4f@towo.net> From: Ken Brown Message-ID: <423c729e-4c66-dd5e-73c0-4c636089ea35@cornell.edu> Date: Thu, 17 Sep 2020 17:55:35 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-ClientProxiedBy: CH2PR18CA0038.namprd18.prod.outlook.com (2603:10b6:610:55::18) To MN2PR04MB6176.namprd04.prod.outlook.com (2603:10b6:208:e3::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.0.17] (68.175.129.7) by CH2PR18CA0038.namprd18.prod.outlook.com (2603:10b6:610:55::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.14 via Frontend Transport; Thu, 17 Sep 2020 21:55:37 +0000 X-Originating-IP: [68.175.129.7] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: da3f84bf-530b-406d-4c43-08d85b546982 X-MS-TrafficTypeDiagnostic: MN2PR04MB5744: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4yy/VLzZ/gckHvBn006jb43zgn4hYp6VYdrpYKiY3PIX1Eupez365ss8IBXzJxCeCyDbwxqr9Xl0jHtkahowJDDp9YDZZjbuFFgVeGgWwdlZWXBhF7wkEwHr4UM8rBq2IPXDvqlHUsTZdIMkycoppTLSp5bdUuPzjVxpcH8AIu3UxEFnfA5oflFY+fmmvDvwZ1m/hX0isQXaW9a3v12GlPQvGkpuTRIDIU3Tdeh2Shdv+6HJM9pzwuY5sOQ//E5EkJQLcJCc01OhL169PmXAk0Bt0SFDMLhSbfD8g2n4iScVkmmEmG7k5brf/pu+Fv37EKEwqcByS9NEHgOUwkKAXZD4v2K9+swcPbkQ869ZsSVFMjbEURFQkJeHjRiZXlmh X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR04MB6176.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(376002)(366004)(136003)(39860400002)(346002)(956004)(786003)(2906002)(2616005)(316002)(26005)(31686004)(186003)(31696002)(8936002)(16526019)(83380400001)(478600001)(4326008)(5660300002)(53546011)(86362001)(8676002)(66946007)(52116002)(66556008)(75432002)(6916009)(6486002)(66476007)(36756003)(16576012)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: eWx3HEIUfe7q9egEXjkWi9jwtOseWs0Ebwwx2BtQZkRO+29vQV87OzTRTBY6iKtq06cShe2mCdTOnfFemyhVSGCyX+MtBPxHmDIAp306spy0G/ocohv7/26slVJNScmvp4CoZ9WdOJ6NSFaZTP1g77jnX829VdRTzztJpmUMgDGpnQZy2VY0gDjZGcc/Q0V8XsGSFAWgNBRwONVhNF34GVVQkwRagBG1+E/Oq+s+C6v62Z8/u7AZd8aDsy+A71qMj4cvDL4XGTPFfV0JMvaoGE/emmReITRFnX2COl1Sble1iTlc5uNl2RzeZnG61KsFjLMAHF5x2UhqBqfq2/ommTADyrAcStjS3FGJaMzlA9MMV3RIGPJM5H1B2Fxiy9uN1xECtYLbAa+1kQr5akR6XcNHWFXUlMr9IAjpNUr8IDicY4caQWk+LkPNTmVje3e/mVu6lJYsF2KTF4Afo9VR4mdxYjv66SUsFZ6jotu9nBO7iauUnOhDx7IiQffXaHqZtlWcMycQt9zyY8uvUfy6Z7uWvbkKONRyzb+8uFi9NWSbdvks5OleiqMuw3sdJSxXG4/Novppfz35C+Q1CipH6HbqHQijBKbGpVS4idPedD8tS+8sEQKgz4rSHq6zfh4iwt/IqLuHVYd4Ece/OV3BHg== X-OriginatorOrg: cornell.edu X-MS-Exchange-CrossTenant-Network-Message-Id: da3f84bf-530b-406d-4c43-08d85b546982 X-MS-Exchange-CrossTenant-AuthSource: MN2PR04MB6176.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Sep 2020 21:55:38.0381 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d7e4366-1b9b-45cf-8e79-b14b27df46e1 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: fpwFgNmSjbtgAoHVvAtj5p6IzIUB9HObPwZc+cTQ3pCDTZ6QsQPFH8G+kW3zoC2mhS5ERINn0Uyfbs1qJwf7LQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR04MB5744 X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00, DKIM_INVALID, DKIM_SIGNED, KAM_DMARC_STATUS, MSGID_FROM_MTA_HEADER, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no 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@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2020 21:55:41 -0000 On 9/17/2020 5:07 PM, Kristian Ivarsson via Cygwin wrote: > >>>>>>> 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 #include 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.