X-Recipient: archive-cygwin@delorie.com
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 56A5B3861838
Authentication-Results: sourceware.org;
 dmarc=none (p=none dis=none) header.from=iname.com
Authentication-Results: sourceware.org;
 spf=pass smtp.mailfrom=bstewart@iname.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mail.com;
 s=dbd5af2cbaf7; t=1609799989;
 bh=33q7i1zqmNjSy+mRaILONlTBWHa2rMa/twAwpKBC4y0=;
 h=X-UI-Sender-Class:References:In-Reply-To:From:Date:Subject:To;
 b=aq4Ep/evBkQFSu5PTfZ8WopUI2+HVDbpDW8vm9LI9P6tpS3FKolFcG2G2GX5vT9D2
 NrvkfluHdLu5p/9j6cH+FcYvorlCa2GJcrbh490mPXrf5HgI2DeEgfEnrXnEyLCgpZ
 R6EboN2L93bY2EwGaHJNrA6OAV/CGYSDreWWvf3w=
X-UI-Sender-Class: 214d933f-fd2f-45c7-a636-f5d79ae31a79
X-Gm-Message-State: AOAM531dxu+4CwO4l0JGFycGAzBc0UgeH7XjBIVvThI3PyTH3yvIV7nQ
 yTo9Ip/e3USMlZShdJCfl1sZc4RLLHLaq7i1BzE=
X-Google-Smtp-Source: ABdhPJzLJIATLaqu8dUQI5XRiLdnhHUCRR9c+WJWc4oSMU4W39VgrgZRxEYA6HmyEz1wVeX/zouQ7Lsx1thws5YXvcI=
X-Received: by 2002:a2e:9605:: with SMTP id v5mr35051345ljh.81.1609799987206; 
 Mon, 04 Jan 2021 14:39:47 -0800 (PST)
MIME-Version: 1.0
References: <vriuwnwznjj7.fsf@gavenkoa.example.com>
 <vriu5z4cpd84.fsf@gavenkoa.example.com>
In-Reply-To: <vriu5z4cpd84.fsf@gavenkoa.example.com>
From: Bill Stewart <bstewart@iname.com>
Date: Mon, 4 Jan 2021 15:39:20 -0700
X-Gmail-Original-Message-ID: <CANV9t=QXiTVAYp=us72vmTOqf0LuTCRnzG4_Yc_Oa-SYUgjFNQ@mail.gmail.com>
Message-ID: <CANV9t=QXiTVAYp=us72vmTOqf0LuTCRnzG4_Yc_Oa-SYUgjFNQ@mail.gmail.com>
Subject: Re: Setting env var CYGWIN for Cygwin service?
To: cygwin@cygwin.com
X-Provags-ID: V03:K1:0zQ0gFzyLhlyc9xRYm2FW5ALkCONmf/yWAUGBahg9TQLEJOyX5T
 z/d3TpIlJH8+EGL0hnI4s6rRSAy+ItW11cAY69KeB+cYou5TT9VqDBJbIVZDhrgNdDgEXcY
 PGSJGx6GmJhYmSzzrws+GbqyO/d8nFpj6EIK97cJekCuWUYCsd1bS7iQtQrVQxoWKtlY97R
 r18F5bYf65uydUgAVxY5g==
X-UI-Out-Filterresults: notjunk:1;V03:K0:YBAC0Fgv1nc=:/GDc3c2ugOvrlxXo7f8WBs
 ok0jYUtiSp3sepr6zBWv0sY27NXAnHjVCsjwBNq2IgJC0r92jR9KvFSEIqBC0h2SFb+gkARLe
 raqsquvrgXabNciak1AlO9H4Bntnhw3xW8WCO6zaJcruMbYlmsbcUYzXSJfPcuBFFxc2uVrUE
 iUnj8Qfm7B11yZ6ElkoquTOl9ttjmuie5Oif7EGQzbebP/k1sgkILIkQJmc2AcvtYE5GNUEJU
 G7abN9gRJBnJl2qI6EKQZ6gmlTzS5L8GZSFUAl9u50w1rm4M9tFIklOk0PsWUJo0vGXOD8ZaW
 Gi9VxpgY8OwkZgM4HEa27CjQB+D8Y7rzOiOSPI3Uc6BgOXrRAu0z3LcBb2S4aYLUyDWWxB9EY
 RaX7byRZ0eGEHvMBYzGRbexuqqrdylTvZiRqdGuUcRUu+xlP/4T/w3M+79K0zYXpVlUnLAN6t
 nv3NtPSe6grJRqypNmyTGKnDTrkfr3kc286EvmOIRQJvKrNGadqJrcXtwlmdj3eevpmunogrq
 MLoALLgU/1PMZjXmcsamQsVkQzQm1CMCuj7HRYUjBFlzoJxCRTlW9fUCiMQAvuxqlDrYQbP2c
 28cDWorWRI9O4AXrkKVp3aR80yedHp+58ySYjp8UCXeWZVtG8kexjmbl6vz3ocJtUVyS5Tw4f
 p/GIGpz5oicHohuJkf9cj3ELJNn+jW1PcIw7gOrEgIRRJwRF530BVPo4buvGHaQR3BxFwwZG8
 C4JvAd/2TRjbIZ6ivpCrZi+8ueUX1aDVmFHM9LLFSFrX84SWvi1bzKlAtId4HKKmUB79CR/4B
 z/dm7HVNyoWjpxQB3JyjPtaRaxWtrzPEDHZIB7qo7eCDOliBhg4Cc3NUq8xtGUSwz8Z7Z9Z0l
 ReYnQJwQ6LG3vNrhR4Bg==
X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, DKIM_SIGNED,
 DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, 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@cygwin.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@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: "Cygwin" <cygwin-bounces@cygwin.com>

On Mon, Jan 4, 2021 at 3:08 PM Oleksandr Gavenko wrote:

> /usr/bin/exim-config has line with:
>
>   cygrunsrv -I exim -p /usr/bin/exim -e CYGWIN="${cygenv}" ...
>
> So it is the answer (as pointed by others).
>
> Still "procexp" doesn't show anything else besides PATH/WINDIR for "exim"
> process. It can be that cygrunsrv passed env vars in some Cygwin *magical way*.
>
> Cannot confirm this, attempt to read /proc/X/environ gives "<defunct>". There
> is no problem to read "environ" for other Cygwin processes.

I have observed the same thing. The environment variable setting
exists in the HKLM\System\CurrentControlSet\Services\<servicename>\Parameters\Environment
registry subkey, but Process Explorer does not show the environment
variable in the list of environment variables for the process.

I have not looked at the code, but it seems that environment variables
specified in this way are not propagated to the environment block for
the process but instead are read some other way.

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