Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Util/helpfiles - problem with provided example



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]



Messages sorted by: Reverse Date, Date, Thread, Author