diff options
author | Joey Hess <joey@kitenet.net> | 2011-08-15 16:17:48 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-08-15 16:17:48 -0400 |
commit | 7401415a4c6d90c48cbe8e8d9ca6cc8539c8f3c7 (patch) | |
tree | 0d5c7c6596657ef7de4105c117fc426ed4d0feb5 | |
parent | 148f8aa0018ee5b6961103983ab14362f67ee847 (diff) | |
download | debootstrap-7401415a4c6d90c48cbe8e8d9ca6cc8539c8f3c7.tar.gz |
IFS clobbering workaround
This is not because of too much haskell programming. It's because using
IFS in shell is always followed by chasing down IFS clobbering portability
bugs in shell, no matter how careful you are.
-rw-r--r-- | functions | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -6,14 +6,15 @@ smallyes() { } in_path () { - IFS=":" _in_path "$1" -} -_in_path () { + local OLD_IFS="$IFS" + IFS=":" for dir in $PATH; do if [ -x "$dir/$1" ]; then + IFS="$OLD_IFS" return 0 fi done + IFS="$OLD_IFS" return 1 } |