zsh-workers
 help / color / mirror / code / Atom feed
* Re: Bug#355430: zsh: acroread completion prints debugging information
       [not found]   ` <20060325095217.2524443157.qww314159@soup.q.ql.org>
@ 2006-03-25 15:11     ` Clint Adams
  2006-03-25 18:15       ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Clint Adams @ 2006-03-25 15:11 UTC (permalink / raw)
  To: zsh-workers; +Cc: 355430-forwarded, Jay Berkenbilt

> Sorry to have taken so long to do this.  The output contains a my
> entire environment among other things, so I was reluctant to just
> blindly paste it into a bug report without further study.  Upon
> looking into the problem, it turns out that the problem is caused by
> the fact that my /usr/bin/acroread is this shell script:
> 
> #!/bin/sh
> exec /usr/lib/Acrobat7.0/bin/acroread ${1+"$@"}
> 
> In the olden days, it used to not work to make /usr/bin/acroread a
> link to the actual acroread binary, but this does appear to work now.
> The way I found this was to do setopt -x before acroread TAB and to
> see that the loads of extra output I got started after evaluating line
> 7 of _acroread which shown here including the preceding comment:
> 
>   # Try extracting the version number directly from the executable.
>   # (This will fail if the executable is a wrapper script for acroread.)
>   local ver=${${${(f)"$(<$commands[$words[1]])"}:#^ver=*}##ver=}
> 
> I'm afraid my zsh isn't good enough to figure out what's happening
> there without consulting the manual.  Anyway, it seems this more than
> just fails if acroread is a wrapper, it actually causes this problem.
> 
> If you are able to reproduce the problem by putting the above script
> in your path as acroread, then hopefully I have provided sufficient
> information.  Otherwise, I will sanitize the output that I get so that
> it is suitable for public dissemination.  Anyway, here's the beginning
> of the output:
> 
> integer 10 readonly '!'=0
> integer 10 readonly '#'=0
> integer 10 readonly '$'=25511
[...]

What's happening is that that line is being run as "local" without the
argument.  Why?


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

* Re: Bug#355430: zsh: acroread completion prints debugging information
  2006-03-25 15:11     ` Bug#355430: zsh: acroread completion prints debugging information Clint Adams
@ 2006-03-25 18:15       ` Bart Schaefer
  2006-03-25 18:34         ` Clint Adams
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2006-03-25 18:15 UTC (permalink / raw)
  To: Clint Adams, zsh-workers; +Cc: 355430-forwarded, Jay Berkenbilt

On Mar 25, 10:11am, Clint Adams wrote:
} Subject: Re: Bug#355430: zsh: acroread completion prints debugging informa
}
} > The way I found this was to do setopt -x before acroread TAB and to
} > see that the loads of extra output I got started after evaluating line
} > 7 of _acroread which shown here including the preceding comment:
} > 
} >   # Try extracting the version number directly from the executable.
} >   # (This will fail if the executable is a wrapper script for acroread.)
} >   local ver=${${${(f)"$(<$commands[$words[1]])"}:#^ver=*}##ver=}

The comment is misleading.  The test above fails UNLESS the executable
is a shell script, not IF the executable is a shell script.  I'm not
sure if the comment author meant to imply an extra script around the
Adobe-supplied default script, or if he got his semantics backwards.

} What's happening is that that line is being run as "local" without the
} argument.  Why?

My only guess is that it has something to do with NULLGLOB and the junk
that would get spewed out by $(<$command[$words[1]]) in the event that
it really was reading directly from a binary executable.


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

* Re: Bug#355430: zsh: acroread completion prints debugging information
  2006-03-25 18:15       ` Bart Schaefer
@ 2006-03-25 18:34         ` Clint Adams
  2006-03-26  7:01           ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Clint Adams @ 2006-03-25 18:34 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers, 355430, Jay Berkenbilt

> My only guess is that it has something to do with NULLGLOB and the junk
> that would get spewed out by $(<$command[$words[1]]) in the event that
> it really was reading directly from a binary executable.

No, it happens for me too, and I don't have acroread installed.
Somehow the caret is Plan9-ing away the "ver=" outside the ${}
or something.

Index: Completion/X/Command/_acroread
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/Command/_acroread,v
retrieving revision 1.5
diff -u -r1.5 _acroread
--- Completion/X/Command/_acroread	10 May 2005 12:26:24 -0000	1.5
+++ Completion/X/Command/_acroread	25 Mar 2006 18:31:38 -0000
@@ -4,12 +4,12 @@
 
 # Try extracting the version number directly from the executable.
 # (This will fail if the executable is a wrapper script for acroread.)
-local ver=${${${(f)"$(<$commands[$words[1]])"}:#^ver=*}##ver=}
+local ver=${${${(f)"$(<$commands[$words[1]])"}:#(#s)ver=*}##ver=}
 [[ -n $ver ]] && _acroread_version=$ver
 
 if (( ! $+_acroread_version )); then
   local acropath=${${(s. .)${${(f)"$($words[1] -help 2>&1)"}[1]}}[2]}
-  _acroread_version=${${${(f)"$(<$acropath)"}:#^ver=*}##ver=}
+  _acroread_version=${${${(f)"$(<$acropath)"}:#(#s)ver=*}##ver=}
 fi
 
 if [[ $_acroread_version == 7.* ]]; then


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

* Re: Bug#355430: zsh: acroread completion prints debugging information
  2006-03-25 18:34         ` Clint Adams
@ 2006-03-26  7:01           ` Bart Schaefer
  2006-03-26 15:12             ` Clint Adams
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2006-03-26  7:01 UTC (permalink / raw)
  To: Clint Adams; +Cc: zsh-workers, 355430, Jay Berkenbilt

On Mar 25,  1:34pm, Clint Adams wrote:
}
} No, it happens for me too, and I don't have acroread installed.
} Somehow the caret is Plan9-ing away the "ver=" outside the ${}
} or something.

That doesn't seem to be it either.  E.g.:

schaefer<502> print -R ver=${${${(f)"$(</dev/null)"}:#^ver=*}##ver=}
ver=

Furthermore, this ...
 
} +local ver=${${${(f)"$(<$commands[$words[1]])"}:#(#s)ver=*}##ver=}

... does not work for me at all.  The "^" does not mean "anchor at
beginning", it means "do NOT match the following pattern".  What's
really wanted is:

local ver=${${${(Mf)"$(<$commands[$words[1]])"}:#ver=*}##ver=}


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

* Re: Bug#355430: zsh: acroread completion prints debugging information
  2006-03-26  7:01           ` Bart Schaefer
@ 2006-03-26 15:12             ` Clint Adams
  0 siblings, 0 replies; 5+ messages in thread
From: Clint Adams @ 2006-03-26 15:12 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers, 355430, Jay Berkenbilt

> That doesn't seem to be it either.  E.g.:
> 
> schaefer<502> print -R ver=${${${(f)"$(</dev/null)"}:#^ver=*}##ver=}
> ver=

% emulate -R zsh
% print -R paco ver=${${${(f)"$(</home/clint/bin/acroread)"}:#^ver=*}##ver=}
paco ver=#!/bin/sh exec /usr/local/bin/acroread "$@"
% setopt extendedglob 
% print -R paco ver=${${${(f)"$(</home/clint/bin/acroread)"}:#^ver=*}##ver=}
paco ver=
% setopt rcexpandparam 
% print -R paco ver=${${${(f)"$(</home/clint/bin/acroread)"}:#^ver=*}##ver=}
paco

> } +local ver=${${${(f)"$(<$commands[$words[1]])"}:#(#s)ver=*}##ver=}
> 
> ... does not work for me at all.  The "^" does not mean "anchor at
> beginning", it means "do NOT match the following pattern".  What's
> really wanted is:
> 
> local ver=${${${(Mf)"$(<$commands[$words[1]])"}:#ver=*}##ver=}

Aha.

Index: Completion/X/Command/_acroread
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/Command/_acroread,v
retrieving revision 1.5
diff -u -r1.5 _acroread
--- Completion/X/Command/_acroread	10 May 2005 12:26:24 -0000	1.5
+++ Completion/X/Command/_acroread	26 Mar 2006 15:04:18 -0000
@@ -4,12 +4,12 @@
 
 # Try extracting the version number directly from the executable.
 # (This will fail if the executable is a wrapper script for acroread.)
-local ver=${${${(f)"$(<$commands[$words[1]])"}:#^ver=*}##ver=}
+local ver=${${${(Mf)"$(<$commands[$words[1]])"}:#ver=*}##ver=}
 [[ -n $ver ]] && _acroread_version=$ver
 
 if (( ! $+_acroread_version )); then
   local acropath=${${(s. .)${${(f)"$($words[1] -help 2>&1)"}[1]}}[2]}
-  _acroread_version=${${${(f)"$(<$acropath)"}:#^ver=*}##ver=}
+  _acroread_version=${${${(Mf)"$(<$acropath)"}:#ver=*}##ver=}
 fi
 
 if [[ $_acroread_version == 7.* ]]; then


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

end of thread, other threads:[~2006-03-26 15:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20060305163923.12356.23913.reportbug@soup.q.ql.org>
     [not found] ` <20060306020302.GA6489@scowler.net>
     [not found]   ` <20060325095217.2524443157.qww314159@soup.q.ql.org>
2006-03-25 15:11     ` Bug#355430: zsh: acroread completion prints debugging information Clint Adams
2006-03-25 18:15       ` Bart Schaefer
2006-03-25 18:34         ` Clint Adams
2006-03-26  7:01           ` Bart Schaefer
2006-03-26 15:12             ` Clint Adams

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).