File bash-completion-pwd-bnc725657.patch of Package aaa_base.openSUSE_12.1_Update

 complete.bash |   42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

--- a/files/etc/profile.d/complete.bash
+++ b/files/etc/profile.d/complete.bash	2012-03-16 10:50:10.286434407 +0000
@@ -9,14 +9,10 @@
 
  _def="-o default -o bashdefault"
  _dir="-o nospace -o dirnames -o plusdirs"
-_file="-o nospace -o dirnames"
+_file="-o nospace -o filenames"
+_mkdr="-o nospace -o dirnames"
 _nosp="-o nospace"
 
-#
-# bnc#725657
-#
-shopt -s direxpand 2> /dev/null || true
-
 # Escape file and directory names, add slash to directories if needed.
 # Escaping could be done by the option 'filenames' but this fails
 # e.g. on variable expansion like $HO<TAB>
@@ -46,11 +42,15 @@ _compreply_ ()
     # a directory, then indicate this by letting readline put a space behind
     # it.
     #
-    if test ${#COMPREPLY[@]} -eq 1 \
-	-a -f ${COMPREPLY[0]} \
-	-a ! -d ${COMPREPLY[0]}
-    then
-	compopt +o nospace
+    if test ${#COMPREPLY[@]} -eq 1 ; then
+	eval x="${COMPREPLY[@]}"
+	if test -d "$x"
+	then
+	    compopt -o plusdirs
+	    compopt +o nospace
+	else
+	    compopt -o nospace
+	fi
     fi
 
     #
@@ -84,7 +84,7 @@ _cdpath_ ()
 
     for x in ${CDPATH//:/$'\n'}; do
 	o=${#COMPREPLY[@]}
-	for s in $(compgen -d $x/$c); do
+	for s in $(compgen -d +o plusdirs $x/$c); do
 	    if [[ (($sym == on && -h $s) || ($dir == on && ! -h $s)) && ! -d ${s#$x/} ]] ; then
 		s="${s}/"
 	    fi
@@ -176,7 +176,7 @@ _cd_ ()
 		    let isdir++
 		    eval COMPREPLY=\(${COMPREPLY[@]}\)
 		fi							;;
-    \~*/*)	COMPREPLY=($(compgen -d $s 		-- "${c}"))
+    \~*/*)	COMPREPLY=($(compgen -d $s +o plusdirs 	-- "${c}"))
 		if ((${#COMPREPLY[@]} > 0)) ; then
  		    compopt +o plusdirs
 		    let isdir++
@@ -188,7 +188,7 @@ _cd_ ()
 		fi							;;
     *\:*)	if [[ $COMP_WORDBREAKS =~ : ]] ; then
 		    x=${c%"${c##*[^\\]:}"}
-		    COMPREPLY=($(compgen -d $s          -- "${c}"))
+		    COMPREPLY=($(compgen -d $s +o plusdirs -- "${c}"))
  		    COMPREPLY=(${COMPREPLY[@]#"$x"})
 		    ((${#COMPREPLY[@]} == 0)) || let isdir++
 		fi
@@ -217,7 +217,7 @@ else
     complete ${_def} ${_dir}  -F _cd_		cd
 fi
 complete ${_def} ${_dir}  -F _cd_		rmdir pushd chroot chrootx
-complete ${_def} ${_file} -F _cd_		mkdir
+complete ${_def} ${_mkdr} -F _cd_		mkdir
 
 # General expanding shell function
 _exp_ ()
@@ -343,7 +343,7 @@ _exp_ ()
     \$\{*\})	   eval COMPREPLY=\(${c}\) ;;
     \$\{*)		COMPREPLY=($(compgen -v -P '${' -S '}'  -- ${c#??}))	;;
     \$*)		COMPREPLY=($(compgen -v -P '$'          -- ${c#?}))	;;
-    \~*/*)		COMPREPLY=($(compgen -f -X "$e"         -- ${c}))	;;
+    \~*/*)		COMPREPLY=($(compgen -f -X "$e" +o plusdirs -- ${c}))	;;
     \~*)		COMPREPLY=($(compgen -u ${s}	 	-- ${c}))	;;
     *@*)		COMPREPLY=($(compgen -A hostname -P '@' -S ':' -- ${c#*@})) ;;
     *[*?[]*)		COMPREPLY=()			# use bashdefault
@@ -358,9 +358,9 @@ _exp_ ()
 			COMPREPLY=($(compgen -G "${c}"))			;;
     *)
 	if test "$c" = ".." ; then
-			COMPREPLY=($(compgen -d -X "$e" ${_nosp} -- $c))
+			COMPREPLY=($(compgen -d -X "$e" ${_nosp} +o plusdirs -- $c))
 	else
-			COMPREPLY=($(compgen -f -X "$e" -- $c))
+			COMPREPLY=($(compgen -f -X "$e" +o plusdirs -- $c))
 	fi
     esac
 
@@ -418,7 +418,7 @@ _gdb_ ()
 		COMPREPLY=($(compgen -W "${COMPREPLY[*]}" -- "$c")) ;;
     -s|e|-se)	COMPREPLY=($(compgen -f -- "$c")) ;;
     -c|-x)	COMPREPLY=($(compgen -f -- "$c")) ;;
-    -d)		COMPREPLY=($(compgen -d ${_nosp} -- "$c")) ;;
+    -d)		COMPREPLY=($(compgen -d ${_nosp} +o plusdirs -- "$c")) ;;
     *)
 		if test -z "$c"; then
 		    COMPREPLY=($(command ps axho comm,pid |\
@@ -505,13 +505,13 @@ _man_ ()
 	--) COMPREPLY=($ol) 	;;
  	-?) COMPREPLY=($c)	;;
 	\./*)
-	    COMPREPLY=($(compgen -f -d -X '\./.*'  -- $c)) ;;
+	    COMPREPLY=($(compgen -f -d -X '\./.*' +o plusdirs  -- $c)) ;;
     [0-9n]|[0-9n]p)
 	    COMPREPLY=($c)	;;
 	 *)
 	case "$o" in
 	    -l|--local-file)
-		COMPREPLY=($(compgen -f -d -X '.*' -- $c)) ;;
+		COMPREPLY=($(compgen -f -d -X '.*' +o plusdirs -- $c)) ;;
 	[0-9n]|[0-9n]p)
 		s=$(eval echo {${m}}$o/)
 		if type -p sed &> /dev/null ; then
openSUSE Build Service is sponsored by