From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14901 invoked by alias); 24 Jan 2016 11:10:44 -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: 37759 Received: (qmail 16609 invoked from network); 24 Jan 2016 11:10:43 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-Biglobe-Sender: From: "Jun T." Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: V01zmodload fails on Cygwin Message-Id: Date: Sun, 24 Jan 2016 20:10:14 +0900 To: "zsh-workers@zsh.org" Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) X-Mailer: Apple Mail (2.1510) X-Biglobe-Spnum: 49926 V01zmodload.ztst fails on my Cygwin (on 64 bit Windows7): CYGWIN_NT-6.1 2.4.0(0.293/5/3) 2016-01-15 16:16 x86_64 (probably the latest 64bit cygwin) First of all, I want to be confirmed that the test fails also on other cygwin systems. If I run % ZTST_verbose=3D2 make TESTNUM=3DV01 check the last part of the output looks like ZTST_getchunk: read code chunk: mods[(r)zsh/main]=3D() zmodunload $mods zmodload zsh/parameter ZTST_test: examining line: Running test: Unload the modules loaded by this test suite ZTST_test: expecting status: 0 Input: /tmp/zsh.ztst.in.3560, output: /tmp/zsh.ztst.out.3560, error: = /tmp/zsh.ztst.terr.3560 ZTST_execchunk: status 0 ************************************** 0 successful test scripts, 1 failure, 0 skipped ************************************** So the execchunk for 0d:Unload the modules loaded by this test suite has succeeded but ztst.zsh seems to die before 0:Listing feature autoloads includes unloaded modules With some experiment, I found that the following causes a core dump: cygwin$ ~/bin/zsh -f # the zsh I have just built % zmodload zsh/param/private % zmodload -u zsh/param/private % local i but I couldn't get any backtrace from the core. The following is my *guess* as to what is going wrong. On Cygwin, parm_private.dll is built by gcc -g -shared -Wl,--export-all-symbols -o param_private.dll = param_private..o ../../Src/libzsh-5.2-dev-1.dll -liconv -ldl = -lncursesw -lrt -lm -lc So it seems some symbols from libzsh-5.2-dev-1.dll also exists in param_private.dll, and gethashnode2 is one of those symbols: % nm libzsh-5.2-dev-1.dll | grep '[Tt] gethashnode2' 0000000514fd1b7f T gethashnode2 % nm Modules/param_private.dll | grep '[Tt] gethashnode2' 00000004bea72a58 T gethashnode2 In function cleanup_(), at line 628 of Src/Module/param_private.c: realparamtab->getnode2 =3D gethashnode2; the gethashnode2 seems to point to the symbol in param_private.dll, which can not be accessed after the module has been unloaded. The following patch seems to work, but I hope someone who knows cygwin better to confirm/improve the patch. # do we need to use #ifdef __CYGWIN__ ? diff --git a/Src/Modules/param_private.c b/Src/Modules/param_private.c index e13813c..f0679a4 100644 --- a/Src/Modules/param_private.c +++ b/Src/Modules/param_private.c @@ -567,6 +567,8 @@ static struct features module_features =3D { }; =20 static struct builtin save_local; +static GetNodeFunc save_getnode2; +static ScanFunc save_printnode; static struct reswd reswd_private =3D {{NULL, "private", 0}, TYPESET}; =20 /**/ @@ -577,6 +579,8 @@ setup_(UNUSED(Module m)) =20 /* Horrible, horrible hack */ getparamnode =3D realparamtab->getnode; + save_getnode2 =3D realparamtab->getnode2; + save_printnode =3D realparamtab->printnode; realparamtab->getnode =3D getprivatenode; realparamtab->getnode2 =3D getprivatenode2; realparamtab->printnode =3D printprivatenode; @@ -624,8 +628,8 @@ cleanup_(Module m) removehashnode(reswdtab, "private"); =20 realparamtab->getnode =3D getparamnode; - realparamtab->getnode2 =3D gethashnode2; - realparamtab->printnode =3D printparamnode; + realparamtab->getnode2 =3D save_getnode2; + realparamtab->printnode =3D save_printnode; =20 deletewrapper(m, wrapper); return setfeatureenables(m, &module_features, NULL);