Debian Bug report logs - #489646
Wish for /etc/zsh/completion.d

Package: zsh; Maintainer for zsh is Debian Zsh Maintainers <pkg-zsh-devel@lists.alioth.debian.org>; Source for zsh is src:zsh.

Reported by: "Trent W. Buck" <trentbuck@gmail.com>

Date: Mon, 7 Jul 2008 03:18:02 UTC

Severity: wishlist

Reply or subscribe to this bug.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Clint Adams <schizo@debian.org>:
Bug#489646; Package zsh. Full text and rfc822 format available.

Acknowledgement sent to "Trent W. Buck" <trentbuck@gmail.com>:
New Bug report received and forwarded. Copy sent to Clint Adams <schizo@debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: "Trent W. Buck" <trentbuck@gmail.com>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: Wish for /etc/zsh/completion.d
Date: Mon, 07 Jul 2008 13:09:06 +1000
Package: zsh
Severity: wishlist

The upstream maintainers of a package I maintain (darcs) provide both
bash and zsh completion snippets.  Currently I install the latter to
/etc/bash_completion.d/darcs, but according to Clint of #debian-devel,
the only way to get these snippets activated by default is to push
them to zsh's upstream CVS.

It would be a good idea if individual maintainers could extend zsh's
completion by just dropping a snippet in some directory analogous to
bash's /etc/bash_completion.d.

PS: zsh already has a /usr/share/zsh/functions/Completion/Unix/_darcs,
which may or may not invalidate my specific case.




Information forwarded to debian-bugs-dist@lists.debian.org:
Bug#489646; Package zsh. Full text and rfc822 format available.

Acknowledgement sent to Clint Adams <schizo@debian.org>:
Extra info received and forwarded to list. Full text and rfc822 format available.

Message #10 received at 489646@bugs.debian.org (full text, mbox):

From: Clint Adams <schizo@debian.org>
To: "Trent W. Buck" <trentbuck@gmail.com>, 489646@bugs.debian.org
Subject: Re: Bug#489646: Wish for /etc/zsh/completion.d
Date: Sat, 12 Jul 2008 13:29:27 +0000
On Mon, Jul 07, 2008 at 01:09:06PM +1000, Trent W. Buck wrote:
> The upstream maintainers of a package I maintain (darcs) provide both
> bash and zsh completion snippets.  Currently I install the latter to
> /etc/bash_completion.d/darcs, but according to Clint of #debian-devel,
> the only way to get these snippets activated by default is to push
> them to zsh's upstream CVS.

Well, no, technically we can also make them patches downstream in the
zsh package, but what would be the point of forking?

> It would be a good idea if individual maintainers could extend zsh's
> completion by just dropping a snippet in some directory analogous to
> bash's /etc/bash_completion.d.

One benefit to doing it centrally is that any API changes can be
fixed with a single changeset.  What benefits does a completion.d
directory offer?

> PS: zsh already has a /usr/share/zsh/functions/Completion/Unix/_darcs,
> which may or may not invalidate my specific case.

Excluding comments, here is a diff between the zsh version and the darcs
source package version.  To me the zsh version looks a bit more robust
and handles URL arguments to darcs changes --repo.

If anything needs an update in the zsh version, let us know.

--- /proc/self/fd/11	2008-07-12 09:24:30.561214788 -0400
+++ /proc/self/fd/19	2008-07-12 09:24:30.561214788 -0400
@@ -1,4 +1,6 @@
 
+
+
 setopt EXTENDED_GLOB
 
 local DARCS=$words[1]
@@ -63,8 +65,6 @@
 	  action[i]='_users' ;;
 	EMAIL|FROM)
 	  action[i]='_email_addresses' ;;
-	URL)
-	  action[i]='_darcs_repository_or_tree' ;;
 	*)
  	  action[i]='' ;;
  	esac
@@ -98,8 +98,9 @@
     _call_program help-commands darcs --help | while read -A hline; do
 	(( ${#hline} < 2 )) && continue
 	[[ $hline[1] == darcs ]] && continue
- 	[[ $hline[1] == [A-Z]* ]] && continue
- 	cmdlist=( $cmdlist "${hline[1]}:${hline[2,-1]/(#b)([A-Z])(*)./${match[1]:l}$match[2]}" )
+ 	[[ $hline[1] == Usage: ]] && continue
+ 	[[ $hline[1] == Use ]] && continue
+ 	cmdlist=( $cmdlist "${hline[1]}:${hline[2,-1]}" )
      done
     arguments=(':commands:(($cmdlist))')
 fi
@@ -189,7 +190,12 @@
 
     local in_tree_head in_tree_tail
     _darcs_make_tree_path in_tree_head in_tree_tail
-    local recorded_dir="$abs_root/_darcs/current/$in_tree_head"
+    local recorded_dir
+    if [[ -d $abs_root/_darcs/current ]]; then
+        recorded_dir="$abs_root/_darcs/current/$in_tree_head"
+    else
+        recorded_dir="$abs_root/_darcs/pristine/$in_tree_head"
+    fi
     local -a controlled_files controlled_dirs existing_files existing_dirs 
     local -a dir_display_strs removed_dir_display_strs
     controlled_files=${(z)$(print $recorded_dir/$in_tree_tail*(.:t))}
@@ -235,8 +241,11 @@
   local local_repos_path="$(_darcs_absolute_tree_root)/_darcs/prefs/repos"
   local global_repos_path="$HOME/.darcs/repos"
   local -a local_repos global_repos
-  [[ -e $local_repos_path ]] && local_repos=( $(<$local_repos_path) )
-  [[ -e $global_repos_path ]] && global_repos=( $(<$global_repos_path) )
+    local -a global_repos
+    [[ -e $local_repos_path ]] && cat $local_repos_path | read -A local_repos
+    [[ -e $global_repos_path ]] && cat $global_repos_path | read -A global_repos
+    local_repos=${local_repos:# #}
+    global_repos=${global_repos:# #}
   _description repositories expl "repositories"
   (( ${#local_repos} )) && compadd "$expl[@]" -- "$local_repos[@]"
   (( ${#global_repos} )) && compadd "$expl[@]" -- "$global_repos[@]"
@@ -445,6 +454,3 @@
 }
 
 _darcs_main "$@"
-
-
-




Information forwarded to debian-bugs-dist@lists.debian.org, Clint Adams <schizo@debian.org>:
Bug#489646; Package zsh. Full text and rfc822 format available.

Acknowledgement sent to "Trent W. Buck" <trentbuck@gmail.com>:
Extra info received and forwarded to list. Copy sent to Clint Adams <schizo@debian.org>. Full text and rfc822 format available.

Message #15 received at 489646@bugs.debian.org (full text, mbox):

From: "Trent W. Buck" <trentbuck@gmail.com>
To: Clint Adams <schizo@debian.org>
Cc: 489646@bugs.debian.org
Subject: Re: Bug#489646: Wish for /etc/zsh/completion.d
Date: Sun, 13 Jul 2008 01:22:16 +1000
On Sat, Jul 12, 2008 at 01:29:27PM +0000, Clint Adams wrote:
>> It would be a good idea if individual maintainers could extend
>> zsh's completion by just dropping a snippet in some directory
>> analogous to bash's /etc/bash_completion.d.

I shouldn't have said "a good idea".  It's certainly an idea, but I
don't know if it's a good one.

I don't mind if you tag this wontfix, really I don't.  I'd just like
to discuss exactly why it's a good/bad idea, so that next time someone
has the idea they can find this ticket and not have to bother anyone
about it (particularly, you or upstream).  Maybe there's already such
a ticket upstream, and I didn't find it.  If that's the case, this
ticket can just be linked to it (i.e. with the "forwarded" directive.)

> What benefits does a completion.d directory offer?

The "benefit" I see is that the responsibility of maintaining the
completion code for a utility becomes the responsibility of the
maintainer of that utility, rather than the zsh maintainers.

I'm not sure if this is actually a benefit; it means the completion
code will be written by people who are less fluent in zsh, but more
aware of what the completion behaviour for the utility is.

> One benefit to doing it centrally is that any API changes can be
> fixed with a single changeset.

Similarly, the proposed mechanism would allow the zsh completion file
to be updated by the same changeset that introduces CLI changes.  It
would also mean that when there's a CLI-incompatible upgrade from
foo_1 to foo_2 in Debian, it's not necessary to upgrade zsh to "fix"
the completion script.

I'm not really familiar with zsh, and I don't know how complex zsh
completion code can be, or how often a CLI change would require
changes to the associate completion code.  (For example, add a new
switch foo --bar is auto-detect by typical completion scripts because
they get the list of available switches from foo --help.)

It also occurs to me that perhaps the mechanism would allow versioned
scripts, so that zsh version N can ship with completion support for
foo M, but the foo maintainer can override that completion file with a
different one in the foo M+1 package.




Information forwarded to debian-bugs-dist@lists.debian.org, Clint Adams <schizo@debian.org>:
Bug#489646; Package zsh. (Thu, 01 Jan 2009 20:33:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Richard Hartmann" <richih.mailinglist@gmail.com>:
Extra info received and forwarded to list. Copy sent to Clint Adams <schizo@debian.org>. (Thu, 01 Jan 2009 20:33:02 GMT) Full text and rfc822 format available.

Message #20 received at 489646@bugs.debian.org (full text, mbox):

From: "Richard Hartmann" <richih.mailinglist@gmail.com>
To: 489646@bugs.debian.org, "Clint Adams" <schizo@debian.org>, "Zsh Workers" <zsh-workers@sunsite.dk>
Subject: /etc/zsh_completion.d/ in Debian -- useful or harmful?
Date: Thu, 1 Jan 2009 21:30:40 +0100
Hi all,

it has been requested[1] that Debian introduces
/etc/zsh_completion.d similar to /etc/bash_completion.d

Pros:

* Package maintainers can introduce their own completions
   independent from upstream
* Users don't need to upgrade zsh in order to get new
   completions for new features in a package
* Completions for different versions of software can be used
   depending on what is actually installed

Cons:

* Upgrades might not make it back upstream
* Broken/stale completions might override Zsh's


What does everyone think of that? Personally, I can't
decide whether this is good or bad. It does have potential
in both directions.


Richard

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=489646




Information forwarded to debian-bugs-dist@lists.debian.org, Clint Adams <schizo@debian.org>:
Bug#489646; Package zsh. (Fri, 02 Jan 2009 04:21:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dan Nelson <dnelson@allantgroup.com>:
Extra info received and forwarded to list. Copy sent to Clint Adams <schizo@debian.org>. (Fri, 02 Jan 2009 04:21:02 GMT) Full text and rfc822 format available.

Message #25 received at 489646@bugs.debian.org (full text, mbox):

From: Dan Nelson <dnelson@allantgroup.com>
To: Richard Hartmann <richih.mailinglist@gmail.com>
Cc: 489646@bugs.debian.org, Clint Adams <schizo@debian.org>, Zsh Workers <zsh-workers@sunsite.dk>
Subject: Re: /etc/zsh_completion.d/ in Debian -- useful or harmful?
Date: Thu, 1 Jan 2009 21:26:33 -0600
In the last episode (Jan 01), Richard Hartmann said:
> it has been requested[1] that Debian introduces
> /etc/zsh_completion.d similar to /etc/bash_completion.d

How does this differ from the existing ${datadir}/zsh/site-functions
directory?  Some FreeBSD port management tools install completion
scripts into that directory and zsh seems to pick them up
automatically, and it looks like some python-twisted Linux rpms install
into site_functions too.

-- 
	Dan Nelson
	dnelson@allantgroup.com




Information forwarded to debian-bugs-dist@lists.debian.org, Clint Adams <schizo@debian.org>:
Bug#489646; Package zsh. (Fri, 02 Jan 2009 15:12:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Clint Adams <clint@zsh.org>:
Extra info received and forwarded to list. Copy sent to Clint Adams <schizo@debian.org>. (Fri, 02 Jan 2009 15:12:06 GMT) Full text and rfc822 format available.

Message #30 received at 489646@bugs.debian.org (full text, mbox):

From: Clint Adams <clint@zsh.org>
To: Dan Nelson <dnelson@allantgroup.com>, 489646@bugs.debian.org
Cc: Richard Hartmann <richih.mailinglist@gmail.com>, Zsh Workers <zsh-workers@sunsite.dk>
Subject: Re: Bug#489646: /etc/zsh_completion.d/ in Debian -- useful or harmful?
Date: Fri, 2 Jan 2009 15:09:14 +0000
On Thu, Jan 01, 2009 at 09:26:33PM -0600, Dan Nelson wrote:
> How does this differ from the existing ${datadir}/zsh/site-functions
> directory?  Some FreeBSD port management tools install completion
> scripts into that directory and zsh seems to pick them up
> automatically, and it looks like some python-twisted Linux rpms install
> into site_functions too.

In Debian's case, the site-functions directory is reserved strictly
for the machine's administrator(s), and thus packages are forbidden
to populate it.




Information forwarded to debian-bugs-dist@lists.debian.org, Clint Adams <schizo@debian.org>:
Bug#489646; Package zsh. (Fri, 02 Jan 2009 16:57:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jörg Sommer,,, <joerg@alea.gnuu.de>:
Extra info received and forwarded to list. Copy sent to Clint Adams <schizo@debian.org>. (Fri, 02 Jan 2009 16:57:04 GMT) Full text and rfc822 format available.

Message #35 received at 489646@bugs.debian.org (full text, mbox):

From: Jörg Sommer,,, <joerg@alea.gnuu.de>
To: 489646@bugs.debian.org
Subject: Re: /etc/zsh_completion.d/ in Debian -- useful or harmful?
Date: Fri, 2 Jan 2009 14:21:39 +0100
Hi Richard,

"Richard Hartmann" <richih.mailinglist@gmail.com> wrote:
> it has been requested[1] that Debian introduces
> /etc/zsh_completion.d similar to /etc/bash_completion.d

Are completion functions configuration files? Why should they be neath of
/etc? I would reject this request and point the package maintainer to
/usr/share/zsh/functions. The admin can still place it's completion
functions in /etc/zsh.

Bye, Jörg.
-- 
Mancher Hahn meint, dass die Sonne seinetwegen aufgeht.
                                               (Theodor Fontane)




Information forwarded to debian-bugs-dist@lists.debian.org, Clint Adams <schizo@debian.org>:
Bug#489646; Package zsh. (Fri, 02 Jan 2009 17:12:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Danek Duvall <duvall@comfychair.org>:
Extra info received and forwarded to list. Copy sent to Clint Adams <schizo@debian.org>. (Fri, 02 Jan 2009 17:12:02 GMT) Full text and rfc822 format available.

Message #40 received at 489646@bugs.debian.org (full text, mbox):

From: Danek Duvall <duvall@comfychair.org>
To: Dan Nelson <dnelson@allantgroup.com>, 489646@bugs.debian.org, Richard Hartmann <richih.mailinglist@gmail.com>, Zsh Workers <zsh-workers@sunsite.dk>
Subject: Re: Bug#489646: /etc/zsh_completion.d/ in Debian -- useful or harmful?
Date: Fri, 2 Jan 2009 09:10:53 -0800
On Fri, Jan 02, 2009 at 03:09:14PM +0000, Clint Adams wrote:

> On Thu, Jan 01, 2009 at 09:26:33PM -0600, Dan Nelson wrote:
> > How does this differ from the existing ${datadir}/zsh/site-functions
> > directory?  Some FreeBSD port management tools install completion
> > scripts into that directory and zsh seems to pick them up
> > automatically, and it looks like some python-twisted Linux rpms install
> > into site_functions too.
> 
> In Debian's case, the site-functions directory is reserved strictly
> for the machine's administrator(s), and thus packages are forbidden
> to populate it.

What Perl has done, and what Sun has done for its Python distribution as
well, is to introduce a vendor-packages (for Python; vendor_perl for perl)
directory which is for packaged modules which can thus conflict with
neither the core modules nor with anything installed by hand.  That's one
way past this particular objection.  I agree that for packaged functions,
though, a place under /usr is more appropriate than under /etc.

Danek




Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Thu Apr 24 08:12:10 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.