Skip to content

Instantly share code, notes, and snippets.

@mkhl
Created June 4, 2009 08:53
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mkhl/123525 to your computer and use it in GitHub Desktop.
Save mkhl/123525 to your computer and use it in GitHub Desktop.
Patch to `/usr/libexec/path_helper` to prevent hangs with long `PATH`s
Patch to `/usr/libexec/path_helper` to prevent hangs with long `PATH`s.
--- path_helper_bak 2009-05-07 15:54:37.000000000 +0200
+++ path_helper 2009-06-04 10:51:39.000000000 +0200
@@ -15,7 +15,7 @@
for f in "$DIR" "$DIR".d/* ; do
if [ -f "$f" ]; then
for p in $(< "$f") ; do
- [[ "$NEWPATH" = *(*:)${p}*(:*) ]] && continue
+ egrep -q "(^|${SEP})${p}($|${SEP})" <<<"$NEWPATH" && continue
[ ! -z "$NEWPATH" ] && SEP=":"
NEWPATH="${NEWPATH}${SEP}${p}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment