X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=QlDNW4RQOduu6xHB HXYN0DNGMM1Y3fDcfLB+RGqUVpzAyELQe1aqnBr0gmumgkFt9qCfonlWbTvr6be7 zv84fzSeXwoYqMcnH60bxNLYKvIKAyShN6qJxplppFs5jXTrI1FBfnuwU7khjop4 D3utjvfxhXjgeQGcQE2oPjL0r4E= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=uC92uvjRguESjeMP4sAOV6 VFaE4=; b=I3a2cuP1BV+fQ0UBtknslSq5vw6Iy9UUMAoYDPf/r3LNOfCs9Xf43D g74mm37Rh6rybUUVrd23Cu/Y5CwWcpLySNf7NwXE7k/CrDyhCg3HiKuYEIkzC06I C9ZEQVkja5bOsZjZnxSYyMxPkgK3LHlVgbNz73P31nOhR6KpPA2Tg= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2594, aspx X-HELO: mail-it0-f45.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=R0wj37yXMXOV+XWNN1MvSoKldH4QNjjmcf21KeDJeRc=; b=jOR5TGa2zUOTpTQGYzE8M1R+z6xewGzdwEmduaFXJe3YfKG7KtsB0cJt8kjcPsH/WV 9WlIcUZnOSGD3LZcnhABfzD63EedMbPDdCPRJCPdhr1s0srbjL7xOZYCuN4cZAAUmFnV nCdtTQWeuiixEcvUeyNbz1Hu2c/+pOuf6A0pzNmccwMfSctZdHlcX19E/qb1Zctprotr 9nCjwX7vpxAkfQ1jU5lavHQFNyPSICGK3eO6ogZpD0Dy7UCATewGFyfOo/sRi+ODC5t6 /DB6bM7+lyMo+1artEfJdiz/G9PQgsHjGF7ATUTRt2mNKaMmyOHmJ4VQ6ToI1yCzdsee Epzw== X-Gm-Message-State: AEkoouvhv1xN0BMSx9Rd5qWl8RY/XGBcmEMo8bI/SFd2A5jKSuF04W1y89X47+dlkXI6dA== X-Received: by 10.36.39.77 with SMTP id g74mr23366331ita.51.1470747549750; Tue, 09 Aug 2016 05:59:09 -0700 (PDT) Subject: Re: PATHEXT is fundamental to Windows and Should be recognised by CYGWIN To: cygwin AT cygwin DOT com References: <001001d1edf1$a4e1ae90$eea50bb0$@rogers.com> <1C0AE95E-0118-4353-AA77-4D41F1AE9AE1 AT solidrocksystems DOT com> <001a01d1eea9$f7949a90$e6bdcfb0$@rogers.com> <76ec05e9-140a-19cb-942b-698582c3d024 AT gmail DOT com> <001f01d1ef2c$f04af9e0$d0e0eda0$@rogers.com> <20160805152951 DOT GO25811 AT calimero DOT vinschen DOT de> <57A6ED1C DOT 1060402 AT gmx DOT de> <20160808112321 DOT GF32150 AT calimero DOT vinschen DOT de> <20160808143321 DOT GS25811 AT calimero DOT vinschen DOT de> From: cyg Simple Message-ID: <8dc84987-802d-30d3-3ebb-2ba25871b561@gmail.com> Date: Tue, 9 Aug 2016 08:58:55 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160808143321.GS25811@calimero.vinschen.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes On 8/8/2016 10:33 AM, Corinna Vinschen wrote: > On Aug 8 09:43, cyg Simple wrote: >> As for PATHEXT we can do the following scenario instead. >> >> export PATHEXT="$PATHEXT;.TXT" >> vi foo.txt >> :set ff=dos >> i >> a >> b >> c >> >> :wq >> cmd /c foo > > As you show here, the PATHEXT definition is so that it also contains > file suffixes which require to know the interpreters starting them. To > implement that, the lib would have to either read the registry to know > the connection between suffix and interpreter (which is pretty > convoluted), or it would have to "start the file", aka call ShellExecute > on the file, without knowing what process will come up as child process. > In your example that would be Notepad or Write. > > The way this works is just not feasible to be used from inside the DLL, > e.g.: > > - ShellExecute does not return a handle to the called process, so the > parent can't wait(2) for it. > > - ShellExecute does not allow to specify an environment for the child > process. Cygwin's Windows environment is reduced to minimal size. > Cygwin children inherit the POSIX environment by a simple copy > process. Only when starting a non-Cygwin process, this process gets > a full Windows environment by means of the matching CreateProcess > parameter. > Sorry, it seems I confused the issue. I was suggesting with this example that as a Cygwin shell user I could use this technique to start a file if I so choose without any modification to Cygwin. > So, if we actually implement PATHEXT, its usage would be limited to > suffixes of binary files and files starting with #!, or we > would have to use a way to start an application which doesn't work well > in a POSIX scenario, or we would have to search the registry for the > suffix linkage. Additionally to searching a variable number of files > for each single file access. I tried "chmod +x foo.txt; ./foo.txt" but that results in Cygwin assuming the text file is a script and executing each line of the file. If PATHEXT were used only to determine that the file should be passed to ShellExecute instead it might be beneficial but since I can easily just do "cmd /c foo.txt" then probably not so much. > > Additionally I would (again?) like to stress that PATHEXT is a feature > of CMD, aka, the shell. It's not a feature of the underlying libs. And other application type programs and libraries. WSH for one makes use of PATHEXT. https://msdn.microsoft.com/en-us/library/fd7hxfdd(v=vs.84).aspx -- cyg Simple -- 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