Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Aug 2007 19:12:32 -0500 (CDT)
From:      "Sean C. Farley" <scf@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        sergei@FreeBSD.org
Subject:   ports/115702: [PATCH] shells/zsh: various completion fixes
Message-ID:  <200708220012.l7M0CWMt036008@thor.farley.org>
Resent-Message-ID: <200708220020.l7M0K1gS029981@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         115702
>Category:       ports
>Synopsis:       [PATCH] shells/zsh: various completion fixes
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 22 00:20:00 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Sean C. Farley
>Release:        FreeBSD 6.2-STABLE i386
>Organization:
>Environment:
System: FreeBSD thor.farley.org 6.2-STABLE FreeBSD 6.2-STABLE #0: Sun Jul 29 20:06:46 CDT 2007
>Description:
- Added FreeBSD flavor of locate to completion.
- mount completions were parsing mount output in reverse order.
- umount completions were completely failing due to readlink options
  that are Linux-centric.

Note:  umount completions only partially work.  umount<Space><Tab> will
give a correct list, but partial completion will not work just right:
e.g.,  umount<Space>/us<Tab> will result in "umount /us/".  Someone
better with completions should have a look at it.

Added file(s):
- files/patch-Completion-Unix-Command-_locate
- files/patch-Completion-Unix-Command-_mount
- files/patch-Completion-Unix-Type-_canonical_paths

Port maintainer (sergei@FreeBSD.org) is cc'd.

Generated with FreeBSD Port Tools 0.77
>How-To-Repeat:
>Fix:

--- zsh-4.3.4_1.patch begins here ---
diff -ruN --exclude=CVS /usr/ports/shells/zsh.orig/files/patch-Completion-Unix-Command-_locate /usr/ports/shells/zsh/files/patch-Completion-Unix-Command-_locate
--- /usr/ports/shells/zsh.orig/files/patch-Completion-Unix-Command-_locate	1969-12-31 18:00:00.000000000 -0600
+++ /usr/ports/shells/zsh/files/patch-Completion-Unix-Command-_locate	2007-08-21 19:06:30.769116000 -0500
@@ -0,0 +1,40 @@
+--- Completion/Unix/Command/_locate.orig	2006-09-27 09:50:25.000000000 -0500
++++ Completion/Unix/Command/_locate	2007-08-20 22:08:08.000000000 -0500
+@@ -11,7 +11,7 @@
+   ;;
+ 
+   (locate)
+-  input="$(_call_program locate $words[0] -V)"
++  input="$(_call_program locate $words[0] -V 2>&1)"
+   case $input in
+     (*mlocate*)
+     ltype=mlocate
+@@ -25,6 +25,10 @@
+     ltype=gnu
+     ;;
+ 
++    (*illegal option*)
++    ltype=bsd
++    ;;
++
+     # guess
+     (*)
+     ltype=$best_guess
+@@ -108,4 +112,17 @@
+     --help'[Show help]' \
+     '*:pattern: '
+   ;;
++
++  (bsd)
++  _arguments -s : \
++    -0'[Output separated by NUL characters]' \
++    -S'[Show database statistics]' \
++    -c'[Output the number of matching entries]' \
++    -d'[Use alternative database]:database:_files' \
++    -i'[Ignore case distinctions in patterns]' \
++    -l'[Limit search results]:file limit: ' \
++    -m'[Use mmap instead of stdio library]' \
++    -s'[Use stdio instead of mmap]' \
++    '*:pattern: '
++  ;;
+ esac
diff -ruN --exclude=CVS /usr/ports/shells/zsh.orig/files/patch-Completion-Unix-Command-_mount /usr/ports/shells/zsh/files/patch-Completion-Unix-Command-_mount
--- /usr/ports/shells/zsh.orig/files/patch-Completion-Unix-Command-_mount	1969-12-31 18:00:00.000000000 -0600
+++ /usr/ports/shells/zsh/files/patch-Completion-Unix-Command-_mount	2007-08-21 19:06:30.769116000 -0500
@@ -0,0 +1,13 @@
+--- Completion/Unix/Command/_mount.orig	2006-05-28 13:46:56.000000000 -0500
++++ Completion/Unix/Command/_mount	2007-08-20 21:22:22.000000000 -0500
+@@ -859,8 +859,8 @@
+     ;;
+   *)
+     /sbin/mount | while read mline; do
+-      mp_tmp+=( $mline[(w)1] )
+-      dev_tmp+=( $mline[(w)3] )
++      dev_tmp+=( $mline[(w)1] )
++      mp_tmp+=( $mline[(w)3] )
+     done
+     ;;
+   esac
diff -ruN --exclude=CVS /usr/ports/shells/zsh.orig/files/patch-Completion-Unix-Type-_canonical_paths /usr/ports/shells/zsh/files/patch-Completion-Unix-Type-_canonical_paths
--- /usr/ports/shells/zsh.orig/files/patch-Completion-Unix-Type-_canonical_paths	1969-12-31 18:00:00.000000000 -0600
+++ /usr/ports/shells/zsh/files/patch-Completion-Unix-Type-_canonical_paths	2007-08-21 19:06:30.769116000 -0500
@@ -0,0 +1,20 @@
+--- Completion/Unix/Type/_canonical_paths.orig	2006-05-28 13:36:06.000000000 -0500
++++ Completion/Unix/Type/_canonical_paths	2007-08-20 21:23:04.000000000 -0500
+@@ -38,7 +38,7 @@
+   files=($@)
+ else
+   for __index in $@; do
+-    files+=$(readlink -qf $__index)
++    files+=$(/usr/bin/stat -qr $__index | cut -d' ' -f16)
+   done
+ fi
+ 
+@@ -48,7 +48,7 @@
+   expref=${~origpref}
+   [[ $origpref == (|*/). ]] && rltrim=.
+   curpref=${${expref%$rltrim}:-./}
+-  canpref=$(readlink -qf $curpref)
++  canpref=$(/usr/bin/stat -qr $curpref | cut -d' ' -f16)
+   if [[ $? -eq 0 ]]; then
+     [[ $curpref == */ && $canpref == *[^/] ]] && canpref+=/
+     canpref+=$rltrim
--- zsh-4.3.4_1.patch ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200708220012.l7M0CWMt036008>