public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* How to handle length limit of PATH environment variable
@ 2018-04-05  9:19 Peter Bauer
  2018-04-05 10:06 ` Wolf Geldmacher
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Peter Bauer @ 2018-04-05  9:19 UTC (permalink / raw)
  To: cygwin

hi,

i was bitten by the length limit of the PATH variable of 4095 characters 
(see [1]) and could not find a way around it. This means i have a lot of 
software packages in different directories and each of them adds itself 
to the PATH so one can run the executables and have the shared libs 
available. Under Windows there is the "short path workaround" but what 
to do under Cygwin?
Creating links with shorter names to the directories is not feasible 
since there may be different users and different directories per user.

Any ideas?

thx,
Peter


[1] 
https://software.intel.com/en-us/articles/limitation-to-the-length-of-the-system-path-variable

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to handle length limit of PATH environment variable
  2018-04-05  9:19 How to handle length limit of PATH environment variable Peter Bauer
@ 2018-04-05 10:06 ` Wolf Geldmacher
  2018-04-05 16:26   ` Brian Inglis
  2018-04-05 11:50 ` Steven Penny
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Wolf Geldmacher @ 2018-04-05 10:06 UTC (permalink / raw)
  To: cygwin

On 05.04.2018 11:19, Peter Bauer wrote:
> hi,
>
> i was bitten by the length limit of the PATH variable of 4095 
> characters (see [1]) and could not find a way around it. This means i 
> have a lot of software packages in different directories and each of 
> them adds itself to the PATH so one can run the executables and have 
> the shared libs available. Under Windows there is the "short path 
> workaround" but what to do under Cygwin?
> Creating links with shorter names to the directories is not feasible 
> since there may be different users and different directories per user.
>
> Any ideas?
On Unix (though not on cygwin) I've previously solved such issues by 
writing a script that collects symlinks to the contents of some list of 
directories in a few (system and/or user specific) directories. These 
few directories then take the place of the list.

The script will need to be re-run whenever there are changes to the 
directories on the list, but that can usually be automated.

Cheers,
Wolf

> thx,
> Peter
>
>
> [1] 
> https://software.intel.com/en-us/articles/limitation-to-the-length-of-the-system-path-variable
>
> -- 
> 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
>

-- 
"Il semble que la perfection soit atteinte non quand il n'y a plus rien à ajouter, mais quand il n'y a plus rien à retrancher."
- Antoine de Saint-Exupéry, Terre des Hommes


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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to handle length limit of PATH environment variable
  2018-04-05  9:19 How to handle length limit of PATH environment variable Peter Bauer
  2018-04-05 10:06 ` Wolf Geldmacher
@ 2018-04-05 11:50 ` Steven Penny
  2018-04-05 17:50 ` Andrey Repin
  2018-04-06  0:31 ` Hans-Bernhard Bröker
  3 siblings, 0 replies; 9+ messages in thread
From: Steven Penny @ 2018-04-05 11:50 UTC (permalink / raw)
  To: cygwin

On Thu, 5 Apr 2018 11:19:01, Peter Bauer wrote:
> i was bitten by the length limit of the PATH variable of 4095 characters 
> (see [1]) and could not find a way around it. This means i have a lot of 
> software packages in different directories and each of them adds itself 
> to the PATH so one can run the executables and have the shared libs 
> available.

My Cygwin PATH looks like this:

    PATH=/usr/local/bin:/usr/bin

However I also have an install script that has lines like this:

    ln -s 'c:/program files/gpac/mp4box.exe' /usr/local/bin

This is good because you often *dont* want to be adding these directories to the
PATH. Good example is "C:\Windows\System32". It might have some programs you
want on the PATH (FTP, PING, REG, SETX), but if you add the whole directory you
are going to get collisions (EXPAND, FC, FIND, HELP, RESET, etc)


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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to handle length limit of PATH environment variable
  2018-04-05 10:06 ` Wolf Geldmacher
@ 2018-04-05 16:26   ` Brian Inglis
  0 siblings, 0 replies; 9+ messages in thread
From: Brian Inglis @ 2018-04-05 16:26 UTC (permalink / raw)
  To: cygwin

On 2018-04-05 04:05, Wolf Geldmacher wrote:
> On 05.04.2018 11:19, Peter Bauer wrote:
>> i was bitten by the length limit of the PATH variable of 4095 characters (see
>> [1]) and could not find a way around it. This means i have a lot of software
>> packages in different directories and each of them adds itself to the PATH so
>> one can run the executables and have the shared libs available. Under Windows
>> there is the "short path workaround" but what to do under Cygwin?
>> Creating links with shorter names to the directories is not feasible since
>> there may be different users and different directories per user.
>>
>> Any ideas?

> On Unix (though not on cygwin) I've previously solved such issues by writing a
> script that collects symlinks to the contents of some list of directories in a
> few (system and/or user specific) directories. These few directories then take
> the place of the list.
> 
> The script will need to be re-run whenever there are changes to the directories
> on the list, but that can usually be automated.

Under Cygwin, I ln -rs custom local Cygwin scripts and exes in:
	/usr/local/bin/
added at the head of the Cygwin PATH,
and to keep them separate from Cygwin components, put custom local Windows user
scripts and exes in:
	/proc/cygdrive/c/usr/local/bin/
added after all Cygwin dirs in PATH, before other Windows dirs.
I keep Windows system specific scripts e.g. .cmd, .reg and exes requiring
elevation in:
	/proc/cygdrive/c/usr/local/sbin/
separate from the unprivileged components.
I add /usr/local/bin/ to the head of the cron PATH, and /home/.../bin/ to the
tail of the cron PATH, so everything used in cron jobs is there; I run
everything in Scheduled tasks from C:\usr\local\bin\ for similar reasons.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to handle length limit of PATH environment variable
  2018-04-05  9:19 How to handle length limit of PATH environment variable Peter Bauer
  2018-04-05 10:06 ` Wolf Geldmacher
  2018-04-05 11:50 ` Steven Penny
@ 2018-04-05 17:50 ` Andrey Repin
  2018-04-05 18:48   ` Achim Gratz
  2018-04-06  0:31 ` Hans-Bernhard Bröker
  3 siblings, 1 reply; 9+ messages in thread
From: Andrey Repin @ 2018-04-05 17:50 UTC (permalink / raw)
  To: Peter Bauer, cygwin

Greetings, Peter Bauer!

> hi,

> i was bitten by the length limit of the PATH variable of 4095 characters 
> (see [1]) and could not find a way around it. This means i have a lot of 
> software packages in different directories and each of them adds itself 
> to the PATH so one can run the executables and have the shared libs 
> available. Under Windows there is the "short path workaround" but what 
> to do under Cygwin?
> Creating links with shorter names to the directories is not feasible 
> since there may be different users and different directories per user.

> Any ideas?

1. HKCR (document associations)
Many applications do not realistically need to be in %PATH%, as they are only
usually called through associations.
You can register these associations and safely clean PATH of those offenders.

2. HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths
Many applications are adding to %PATH% for just one binary, which could
happily be registered there and no longer pollute global environment table.

Please report such applications to their authors.
Spare hammers for better reporting efficiency are available at your nearby
carpenters' tool shop.


P.S.
As a joke of the topic, I've had GPAC register its directory in the PATH 3
times from a single installation.

P.P.S.
Partial solution could be a wrapper that reduce PATH length by dropping
nonessential/duplicate/Win-specific paths before invoking Cygwin terminal.
I have such a wrapper for my own reasons.


-- 
With best regards,
Andrey Repin
Thursday, April 5, 2018 20:31:52

Sorry for my terrible english...


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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to handle length limit of PATH environment variable
  2018-04-05 17:50 ` Andrey Repin
@ 2018-04-05 18:48   ` Achim Gratz
  2018-04-06  0:35     ` Andrey Repin
  2018-04-11 13:43     ` Peter Bauer
  0 siblings, 2 replies; 9+ messages in thread
From: Achim Gratz @ 2018-04-05 18:48 UTC (permalink / raw)
  To: cygwin

Andrey Repin writes:
> P.P.S.
> Partial solution could be a wrapper that reduce PATH length by dropping
> nonessential/duplicate/Win-specific paths before invoking Cygwin terminal.
> I have such a wrapper for my own reasons.

You don't need one if your login shell is a POSIX shell and you don't
use Windows applications if you have set a system or user variable
CYGWIN_NOWINPATH to a non-empty value.  For tcsh I have patched
/etc/csh.login to do the moral equivalent; I guess that should be
packaged with tcsh eventually.

It's usually way easier to add to a clean path than removing cruft and I
generally lean into the direction of using wrapper scripts for Windows
applications that I need to use from Cygwin since quite often some other
things need attention aside from PATH.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptation for Waldorf rackAttack V1.04R1:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to handle length limit of PATH environment variable
  2018-04-05  9:19 How to handle length limit of PATH environment variable Peter Bauer
                   ` (2 preceding siblings ...)
  2018-04-05 17:50 ` Andrey Repin
@ 2018-04-06  0:31 ` Hans-Bernhard Bröker
  3 siblings, 0 replies; 9+ messages in thread
From: Hans-Bernhard Bröker @ 2018-04-06  0:31 UTC (permalink / raw)
  To: cygwin

Am 05.04.2018 um 11:19 schrieb Peter Bauer:

> i was bitten by the length limit of the PATH variable of 4095 characters 
> (see [1]) and could not find a way around it. This means i have a lot of 
> software packages in different directories and each of them adds itself 
> to the PATH so one can run the executables and have the shared libs 
> available. 

As far as DLLs are concerned, that would be a misuse of the PATH.  AFAIK 
they will already be found by being in the same directory as the 
executable that needs them.

> Under Windows there is the "short path workaround" but what 
> to do under Cygwin?

Being Cygwin, you should do what Unix has always done: do away with the 
whole idea that every program needs an entire directory tree of its own. 
  The promise that this would somehow make separate installation and, 
more importantly, un-installation or update of program packages much 
easier was never really kept, anyway.

I.e. you shoule have _one_ tree like thone below /usr, instead of dozens 
of c:/programs/manufacturer/package trees.  And while maintaining such a 
collection on Windows might seem nightmarish, tools like "stow" make it 
quite manageable on a Unix-style platform, with Unix-style software 
packages.  With stow, it works like this for a typical autoconf'ed package:

	.../configure --prefix=somewhere
	make
	make install prefix=somewhere/.stow/packagename
	pushd somewhere/.stow/
	stow packagename
	popd

Stow then builds and maintains a thicket of symlinks from "somewhere" 
into the individual packages' trees under "somewhere/.stow" such that 
the packages work just as if they had actually been installed directly 
into "somewhere", while they're still separate and can be updated or 
uninstalled individually.  Sometimes package have to be massaged bit 
(e.g. for GNU info 'dir' files), but it works remarkably well given how 
simple it is, at heart.

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to handle length limit of PATH environment variable
  2018-04-05 18:48   ` Achim Gratz
@ 2018-04-06  0:35     ` Andrey Repin
  2018-04-11 13:43     ` Peter Bauer
  1 sibling, 0 replies; 9+ messages in thread
From: Andrey Repin @ 2018-04-06  0:35 UTC (permalink / raw)
  To: Achim Gratz, cygwin

Greetings, Achim Gratz!

> Andrey Repin writes:
>> P.P.S.
>> Partial solution could be a wrapper that reduce PATH length by dropping
>> nonessential/duplicate/Win-specific paths before invoking Cygwin terminal.
>> I have such a wrapper for my own reasons.

> You don't need one if your login shell is a POSIX shell and you don't
> use Windows applications if you have set a system or user variable
> CYGWIN_NOWINPATH to a non-empty value.

If-if-if.
What if I explicitly do not want to do that?
It reduces interoperability to miniscule levels.

> It's usually way easier to add to a clean path than removing cruft and I
> generally lean into the direction of using wrapper scripts for Windows
> applications that I need to use from Cygwin since quite often some other
> things need attention aside from PATH.

For me, it's easier to wrap Cygwin apps, since I have sane wrapping material
(and many Cygwin tools not requiring any wrapping to begin with).


-- 
With best regards,
Andrey Repin
Friday, April 6, 2018 03:18:18

Sorry for my terrible english...


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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to handle length limit of PATH environment variable
  2018-04-05 18:48   ` Achim Gratz
  2018-04-06  0:35     ` Andrey Repin
@ 2018-04-11 13:43     ` Peter Bauer
  1 sibling, 0 replies; 9+ messages in thread
From: Peter Bauer @ 2018-04-11 13:43 UTC (permalink / raw)
  To: cygwin

On 04/05/2018 08:47 PM, Achim Gratz wrote:
> Andrey Repin writes:
>> P.P.S.
>> Partial solution could be a wrapper that reduce PATH length by dropping
>> nonessential/duplicate/Win-specific paths before invoking Cygwin terminal.
>> I have such a wrapper for my own reasons.
> You don't need one if your login shell is a POSIX shell and you don't
> use Windows applications if you have set a system or user variable
> CYGWIN_NOWINPATH to a non-empty value.  For tcsh I have patched
> /etc/csh.login to do the moral equivalent; I guess that should be
> packaged with tcsh eventually.
>
> It's usually way easier to add to a clean path than removing cruft and I
> generally lean into the direction of using wrapper scripts for Windows
> applications that I need to use from Cygwin since quite often some other
> things need attention aside from PATH.
>

i went for this solution as the default PATH after opening a Cygwin 
terminal was already ~2000 characters long.

thx a lot,
Peter

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-04-11 13:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-05  9:19 How to handle length limit of PATH environment variable Peter Bauer
2018-04-05 10:06 ` Wolf Geldmacher
2018-04-05 16:26   ` Brian Inglis
2018-04-05 11:50 ` Steven Penny
2018-04-05 17:50 ` Andrey Repin
2018-04-05 18:48   ` Achim Gratz
2018-04-06  0:35     ` Andrey Repin
2018-04-11 13:43     ` Peter Bauer
2018-04-06  0:31 ` Hans-Bernhard Bröker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).