zsh-workers
 help / color / mirror / code / Atom feed
* [zsh] ant completion broken
@ 2008-08-31  9:23 David LE BOURGEOIS
  2008-08-31 13:30 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: David LE BOURGEOIS @ 2008-08-31  9:23 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 916 bytes --]

Hello.

I wish to report a problem about zsh-4.3.6, concerning the _ant
completion file. The zsh-workers/24129 fix breaks the ant completion for
target name.

In fact, the regular expression used in sed contains two spaces. And
since, in most of XML tags, the property separator is a single space,
the completion fails for many of build.xml files.

As a fix, deleting one of the two spaces from the regular expression
makes the ant completion working again. Also, replacing the remaining
single space by the POSIX [[:blank:]] pattern might provide a safer
parsing of the target name.

So, I send a patch file as attachment that fixes the _ant file.

Thank you for considering my report.

Regards.

PS: Does it matter if I ask to be Cc:ed for getting all replies?

-- 
David LE BOURGEOIS
E-mail : david.lebourgeois (at) free.fr
XMPP   : david.lebourgeois (at) jabber.fr
PGP    : http://david.lebourgeois.free.fr/pgp/

[-- Attachment #2: _ant.patch --]
[-- Type: text/plain, Size: 638 bytes --]

--- zsh-4.3.6/Completion/Unix/Command/_ant	2007-11-29 10:45:58.000000000 +0100
+++ zsh-4.3.6/Completion/Unix/Command/_ant.new	2008-08-31 10:42:55.000000000 +0200
@@ -10,7 +10,7 @@
     importedfiles=( $(sed -n "s/ *<import[^>]* file=[\"']\([^\"']*\)[\"'].*/\1/p" < $1) )
     # Tweaked to omit targets beginning with "-" that can't
     # be invoked from the command line; see zsh-workers/24129.
-    sed -n "s/ *<target[^>]*  name=[\"']\([^-][^\"']*\)[\"'].*/\1/p" $1
+    sed -n "s/ *<target[^>]*[[:blank:]]name=[\"']\([^-][^\"']*\)[\"'].*/\1/p" $1
     if (( $#importedfiles )) ; then
 	( cd $1:h
     	for file in $importedfiles ; do

[-- Attachment #3: _ant.patch.asc --]
[-- Type: text/plain, Size: 189 bytes --]

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD4DBQBIumI6fGpn1bRTyEYRAhyBAKC3AWK5df2OveanWP88C+1JIAOyXwCXbCnq
sdJLBChTN6vYYuveJ+byag==
=diPn
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [zsh] ant completion broken
  2008-08-31  9:23 [zsh] ant completion broken David LE BOURGEOIS
@ 2008-08-31 13:30 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2008-08-31 13:30 UTC (permalink / raw)
  To: zsh-workers; +Cc: David LE BOURGEOIS

On Sun, 31 Aug 2008 11:23:34 +0200
David LE BOURGEOIS <david.lebourgeois@free.fr> wrote:
> I wish to report a problem about zsh-4.3.6, concerning the _ant
> completion file. The zsh-workers/24129 fix breaks the ant completion for
> target name.
> 
> In fact, the regular expression used in sed contains two spaces. And
> since, in most of XML tags, the property separator is a single space,
> the completion fails for many of build.xml files.
> 
> As a fix, deleting one of the two spaces from the regular expression
> makes the ant completion working again. Also, replacing the remaining
> single space by the POSIX [[:blank:]] pattern might provide a safer
> parsing of the target name.

I'd prefer just deleting one of the spaces if that works OK, since zsh
has historically worked with some pretty ancient versions of sed.  I'm
not sure this is necessary, just can't prove it isn't, so if the
following works...

Index: Completion/Unix/Command/_ant
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_ant,v
retrieving revision 1.16
diff -u -r1.16 _ant
--- Completion/Unix/Command/_ant	29 Nov 2007 09:49:43 -0000	1.16
+++ Completion/Unix/Command/_ant	31 Aug 2008 13:28:06 -0000
@@ -10,7 +10,7 @@
     importedfiles=( $(sed -n "s/ *<import[^>]* file=[\"']\([^\"']*\)[\"'].*/\1/p" < $1) )
     # Tweaked to omit targets beginning with "-" that can't
     # be invoked from the command line; see zsh-workers/24129.
-    sed -n "s/ *<target[^>]*  name=[\"']\([^-][^\"']*\)[\"'].*/\1/p" $1
+    sed -n "s/ *<target[^>]* name=[\"']\([^-][^\"']*\)[\"'].*/\1/p" $1
     if (( $#importedfiles )) ; then
 	( cd $1:h
     	for file in $importedfiles ; do


-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-08-31 13:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-31  9:23 [zsh] ant completion broken David LE BOURGEOIS
2008-08-31 13:30 ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).