zsh-workers
 help / color / mirror / code / Atom feed
* Util/helpfiles - problem with provided example
@ 2004-07-26 22:30 Michael Prokop
  2004-07-28 10:01 ` Peter Stephenson
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Prokop @ 2004-07-26 22:30 UTC (permalink / raw)
  To: zsh-workers

Hello,

I just found a problem when using the example function provided in
zsh/Util/helpfiles. I'm refering to current zsh-cvs-sources.

An example:

$ which man    # this is the function 'run-help' which I'm using in my setup
man () {
        typeset zhelp=~/.zsh/zsh_help # or wherever
        [[ $1 = . ]] && 1=dot
        [[ $1 = : ]] && 1=colon
        if [[ $1 = compctl ]]
        then
                man zshcompctl
        elif [[ -f $zhelp/$1 ]]
        then
                ${=PAGER:-more} $zhelp/$1
        else
                command man $*                    # notice this line
        fi
}
$ man zsh             # now I'm trying to read the manual - works ->
Reformatting zsh(1), please wait...
$ run-help() {        # now I do copy/paste from Util/helpfiles ->
    typeset zhelp=~/.zsh/zsh_help          # or wherever
    [[ $1 = . ]] && 1=dot
    [[ $1 = : ]] && 1=colon
    if [[ $1 = compctl ]]; then
       man zshcompctl
    elif [[ -f $zhelp/$1 ]]; then
       ${=PAGER:-more} $zhelp/$1
    else
       man $1                                     # this is the original
    fi
  }
$ man zsh
Segmentation fault
$

The important difference in the two functions:
'man $1' vs. 'command man $*'.

The '$*' is important for covering cmdlines like 'man 3 printf'.
AFAICS the segfault happens because of the recursive 'man'-function.

Maybe this could be changed in Util/helpfiles because it might be a
trap ;-).

regards,
(-: Michael
-- 
www.michael-prokop.at
~
~
".signature" [New] 1L, 22C [w]


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

end of thread, other threads:[~2004-07-29 15:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-26 22:30 Util/helpfiles - problem with provided example Michael Prokop
2004-07-28 10:01 ` Peter Stephenson
2004-07-28 10:21   ` Peter Stephenson
2004-07-29 15:40   ` 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).