Re: Portable Cygwin: Hard-Coded Paths in a Restored Cygwin.bat File?
Jon Turney via Cygwin-apps <[email protected]> Sat, 14 Feb 2026 17:26:45 +0000
| Newsgroups | gmane.os.cygwin.applications |
|---|---|
| Message-ID | <[email protected]> |
On 16/08/2025 14:47, Jon Turney via Cygwin-apps wrote: > On 05/08/2025 05:56, Brian Inglis via Cygwin-apps wrote: >> On 2025-08-04 17:30, Matthew Sheets via Cygwin-apps wrote: >>> Are there two different versions of Cygwin.bat that Cygwin Setup >>> could create depending on the context in which Cygwin Setup is executed? >>> >>> If Cygwin setup is being used to create a new installation, the >>> installed Cygwin.bat is fairly path independent: >>> @echo off >>> setlocal enableextensions >>> set TERM= >>> cd /d "%~dp0bin" && .\bash --login -i >>> >>> [...] >> >> You could also rm /Cygwin.bat and rerun /etc/postinstall/base-files- >> profile.sh, possibly with a .done suffix after Setup. >> >>> For a portable setup, I am intending to remove and wrap Cygwin.bat >>> and have _zero_ issue with Cygwin Setup restoring it (I was actually >>> hoping Cygwin Setup _did_ restore Cygwin.bat so that any updates to >>> Cygwin.bat could be incorporated), but the challenge here is that a >>> completely different Cygwin.bat that contains hard-coded paths is >>> created upon restoration. Is this file content difference expected? >>> Could the `cd /d "%~dp0bin"` syntax be used in both cases (in place >>> of the hardcoded paths)? >> >> It has been and should be since at least 2016, when it was added to >> base-files; previously it was installed by Cygwin Setup and never >> updated if it existed: >> >> https://cygwin.com/cgit/cygwin-apps/setup/tree/desktop.cc? >> id=bf1d58#n163 >> > Huh. > > Well, a patch to setup either to remove that function (since it doesn't > seem to serve any useful purpose now), or modernize the batch file it > writes would be very welcome. This should be addressed as of setup 2.936. I removed this code from setup, so postinstall should always create the portable version of cygwin.bat.