From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22333 invoked by alias); 11 Dec 2009 17:44:18 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 27498 Received: (qmail 8825 invoked from network); 11 Dec 2009 17:44:16 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.220.214 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:sender:from:content-type :content-transfer-encoding:subject:date:message-id:to:mime-version :x-mailer; bh=fKvsUFxk8rVqo9AYu5rFIK6rbfVAwimPzS//tNLVT18=; b=QL81KEfEakt294ukd5vk8zozNH8biAK8t5a6NtKuzdVXdjGzw5ZGjZ9yxPUrdR426G e8leutKHKoxb6L0zRvz83JyhqVK4UaKWxqxa6ufm/NP8LPOqPWnT3abjJK664QXoesdD iZaKNK1vhqAAqIDtgxPqFtq9Ei6JuCykrBFMA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=sender:from:content-type:content-transfer-encoding:subject:date :message-id:to:mime-version:x-mailer; b=xEJMFDvdbocJ1l3VBtJ1FisIibfXidqZ5iEMHVxpqdA8WqiH5xN6iKTja0moscDzqw kYoQBW0KPw0hsjHZawTzco/kiC1tEe/PrvJLx/LcpsRLDDgc1sxQsHLAvYug0CUWXVBy 2Xq29YcC9kzOxlCptPUYLSA5nQ2AZTIAWyiEU= Sender: Joel Bernstein From: Joel Bernstein Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: segfault due to chpwd_function Date: Fri, 11 Dec 2009 17:36:47 +0000 Message-Id: <0742D8B8-F67E-48F7-BCCC-3F578A78D4B7@fysh.org> To: zsh-workers@zsh.org Mime-Version: 1.0 (Apple Message framework v1077) X-Mailer: Apple Mail (2.1077) I found a scenario leading to a segfault caused by a chpwd_function. The = function in question runs to completion when called from command line = directly after the 'cd' command, if it is removed from chpwd_functions = and called manually. The chpwd_function in question calls the "prompt" = function. Curiously, if I add debug prints to my chpwd_function and = precmd_function, I see that the chpwd_function completes and the = precmd_function is not entered. Thus I conclude that some state is = mutated by my chpwd_function (e.g. use of prompt()?) which causes zsh to = segfault after running it. The segfault (on e.g. cd ~/foo) looks like: Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x0000000000007075 0x0000000100020be4 in hasher () (gdb) bt #0 0x0000000100020be4 in hasher () #1 0x0000000100020c2b in gethashnode () #2 0x0000000100069995 in callhookfunc () #3 0x000000010000f057 in bin_cd () #4 0x000000010000cf0b in execbuiltin () #5 0x0000000100016adb in execcmd () #6 0x0000000100017995 in execpline2 () #7 0x0000000100017d7c in execpline () #8 0x0000000100018e27 in execlist () #9 0x0000000100018f65 in execode () #10 0x000000010002ab27 in loop () #11 0x000000010002bf74 in zsh_main () #12 0x0000000100001374 in start () And my chpwd_function looks like: prompt_chpwd () { current_prompt=3D$(prompt -c | tail -n1 | perl -pe 's/\W//g')=20 zgit_isgit && { if [ "$current_prompt" !=3D "wunjo" ] then prompt wunjo fi } || { if [ "$current_prompt" !=3D "joel" ] then prompt joel fi } } I believe I can workaround this issue by setting the desired prompt = theme to a var in my chpwd_function and calling prompt() from my = precmd_function but it seems an odd behaviour and perhaps a bug? I am running zsh 4.3.10 (i386-apple-darwin10.0.0).=20 Please let me know if I can provide more information. /joel=