(mount) Fix leaking fs_* vars to the environment. Explicitly save/restore IFS to be posix conformant.

This commit is contained in:
Crestez Dan Leonard 2010-02-07 01:05:51 +02:00
parent b493869b8d
commit 1c4b461882

View File

@ -29,7 +29,9 @@ _reply_compgen_array()
ecur="${ecur/#$\'/\$\'}" ecur="${ecur/#$\'/\$\'}"
# Actually generate completions. # Actually generate completions.
local oldifs="$IFS"
IFS=$'\n' eval 'COMPREPLY=(`compgen -W "$wlist" -- "${ecur}"`)' IFS=$'\n' eval 'COMPREPLY=(`compgen -W "$wlist" -- "${ecur}"`)'
IFS="$oldifs"
# Strip starting $' in reply if present in cur. # Strip starting $' in reply if present in cur.
# This is necesarry because readline interprets everything after ' as a # This is necesarry because readline interprets everything after ' as a
@ -48,10 +50,14 @@ _linux_fstab()
COMPREPLY=() COMPREPLY=()
# Read and unescape values into COMPREPLY # Read and unescape values into COMPREPLY
local fs_spec fs_file fs_other
while read -r fs_spec fs_file fs_other; do while read -r fs_spec fs_file fs_other; do
if [[ $fs_spec = [#]* ]]; then continue; fi if [[ $fs_spec = [#]* ]]; then continue; fi
[[ $fs_spec = */* ]] && { IFS=$'\0' eval "COMPREPLY+=( $'$fs_spec' )"; } local oldifs="$IFS"
[[ $fs_file = */* ]] && { IFS=$'\0' eval "COMPREPLY+=( $'$fs_file' )"; } IFS=$'\0'
[[ $fs_spec = */* ]] && eval "COMPREPLY+=( $'$fs_spec' )";
[[ $fs_file = */* ]] && eval "COMPREPLY+=( $'$fs_file' )";
IFS="$oldifs"
done done
_reply_compgen_array _reply_compgen_array