DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 4BKMG1dE1627938 Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 4BKMG1dE1627938 Authentication-Results: delorie.com; dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=pR2qrYFk X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E65713858414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1734732959; bh=Ix+IU8XjlcfsQRV58tOXROyP7YAWu/Yo3b8mn9g9qoE=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=pR2qrYFkdKXfP/g2jiWf4UGPT32TrdSqQ2NuLpdJZ//SFf9riJDr0Xus2TjWJl59D Q+aV8fiWUCFOxTfG6JGhdSQohDel+b+60/dl/GniJcjs1PNEn19Bibc9P8Lju2DjkK a0l8KRwMeytgv1oERNlAhtZVgaHol51AJ+9ET1RM= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CB2E13858D26 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CB2E13858D26 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734732931; cv=none; b=XZh/INJQ9/gXguGBL0DqwLSZuWn6/NwskdnKCihAFful8P2/yaGrrkrKN5OcpxDBehHwDg5jbvFWkR7oNZxyvP+b039uGqKABy36YbIjtlgXhY3OZ+ixhCIIiueSX8R+5AkeDDxoMpYtcZPMtDtB1xHqStPNVrqnSdLctEniFv0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734732931; c=relaxed/simple; bh=1rhIolXarOVYmQcfjo2ocgfgMHaUjoau43IEhqynj9o=; h=Message-ID:Date:MIME-Version:Subject:To:From:DKIM-Signature; b=O3Qc+eg9frQj1NAH7B08g+idevrsvYM6kNCRRZoD2cCSrHVlRLqi+YyWekLQA9yDj2gaZlwfD5NdaRzGwydLCxfzn7XtsJxJ26ePTwXE1c3ApUOTPKpKEBlvkSVISwHc2ajmdj86dI+61QhdsfFR3/6wKoMoMXhsrbbDp6cM/ng= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CB2E13858D26 Message-ID: Date: Fri, 20 Dec 2024 15:15:28 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: env and PATH Content-Language: en-CA To: cygwin AT cygwin DOT com References: <77a3709d-ec4d-497b-bf6c-75f29dc8c992 AT kircheis DOT it> Organization: Systematic Software In-Reply-To: <77a3709d-ec4d-497b-bf6c-75f29dc8c992@kircheis.it> X-Rspamd-Queue-Id: 982BB6000A X-Rspamd-Server: rspamout03 X-Stat-Signature: obay1j3s4d6usz7mf7x7r8fqaxeomxdi X-Session-Marker: 427269616E2E496E676C69734053797374656D6174696353572E61622E6361 X-Session-ID: U2FsdGVkX19jM5yM5A3d0eEja7oQ7ETj4OizWwucJK4= X-HE-Tag: 1734732904-900912 X-HE-Meta: U2FsdGVkX1870l8nD623llGqqmHz9QwMSMDyj7mNUwi5iLy01ta6SpuqaLf5/QhCGgOmi4NV42j6Gws2d8bGs0sS1jX01UC8SIBixORJXi/wpSyv+Tg7anTNxrGboCpv4r/SHJcfO3ja9gUe6cTXrYNGHyqljAV+3JcBbSoFAftC4Cn2Itz3wnLnY/4ZBc1eVcIuqL4w1pUWyesfYgMFzDFAV/k+NIyIB6yQ2k6QddMbgCit6c+01gGBJ8kPxRPri9uYM9po8J9gdq43VKamC2KfMzah7NwaRHx7dnqcBTqNSNlU5Ymhrkw8Hqf8NjzQQun8XFiDM/D8OiZ2vXt6BEguHaNR5YIw X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Brian Inglis via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Brian Inglis Content-Type: text/plain; charset="utf-8"; Format="flowed" Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 4BKMG1dE1627938 Hi Federico, Looks like non-Cygwin program launch is messing up PATH not on the current drive: $ cd /proc/cygdrive/d $ cat -A /proc/cygdrive/d/tmp/t.cmd echo %PATH%^M$ $ env -i PATH='C:\Windows;C:\Windows\system32;' /bin/sh -c 'echo $PATH' C:\Windows;C:\Windows\system32; $ env -i PATH='C:\Windows;C:\Windows\system32;' `cygpath $COMSPEC` /s /c \ "d:\tmp\t.cmd" D:\>echo C;D:\Windows;C;D:\Windows\system32; C;D:\Windows;C;D:\Windows\system32; D:\>exit On 2024-12-20 09:51, Federico Kircheis via Cygwin wrote: > Hello to everyone, > > > I've noticed that env seems to handle the environment variable PATH in a > particular way > > > ----- > > cd /d; > > env -i PATH='C:\Windows;C:\Windows\system32;' /c/Windows/System32/ > WindowsPowerShell/v1.0/powershell.exe > # in the powershell instance > echo $env:PATH > C;D:\Windows;C;D:\Windows\system32; > ---- > > > From this and other examples it seems that env uses for PATH  as separator, > then preprends the current drive to all paths that begin with '\' (thus all of > them), and ";" is treated as part of the path > > > I would like to use the PATH as-is in the invoked program, just like it is done > for other variables, for example > > ---- > cd /d > env -i OPATH='C:\Windows;C:\Windows\system32;' /c/Windows/System32/ > WindowsPowerShell/v1.0/powershell.exe > # in the powershell instance > echo $env:OPATH > C:\Windows;C:\Windows\system32; > ---- > > in this case OPATH is forwarded as-is to powershell.exe. > > I understand that PATH is special, that for cygwin processes some transformation > might be necessary. > > But is there any way to achieve what I'm trying? > > I search if there is maybe a separation option for telling env to use PATH as- > is, but could not find none. > > > Best > > Federico > -- Take care. Thanks, Brian Inglis Calgary, Alberta, Canada La perfection est atteinte Perfection is achieved non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add mais lorsqu'il n'y a plus rien à retirer but when there is no more to cut -- Antoine de Saint-Exupéry -- 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