zsh-workers
 help / color / mirror / code / Atom feed
From: Michael Prokop <news@michael-prokop.at>
To: zsh-workers@sunsite.dk
Subject: Util/helpfiles - problem with provided example
Date: Tue, 27 Jul 2004 00:30:20 +0200	[thread overview]
Message-ID: <2004-07-27T00-04-58@netz.michael-prokop.at> (raw)

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]


             reply	other threads:[~2004-07-27 22:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-26 22:30 Michael Prokop [this message]
2004-07-28 10:01 ` Peter Stephenson
2004-07-28 10:21   ` Peter Stephenson
2004-07-29 15:40   ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2004-07-27T00-04-58@netz.michael-prokop.at \
    --to=news@michael-prokop.at \
    --cc=zsh-workers@sunsite.dk \
    --cc=zsh@michael-prokop.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).