zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: ZSH Workers Mailing List <zsh-workers@sunsite.dk>
Subject: About zmodload test segfaults
Date: Wed, 23 May 2001 16:51:39 +0000	[thread overview]
Message-ID: <1010523165140.ZM9483@candle.brasslantern.com> (raw)
In-Reply-To: <3B0A896A.26BD1352@u.genie.co.uk>

On May 22,  4:44pm, Oliver Kiddle wrote:
} Subject: Re: Almost all tests pass under new cygwin
}
} It is the very last zmodload in the loop which does zmodload -i for
} every module it found in config.modules (the `for m in $mods' loop).
} I've gone through typing the zmodload commands manually and it is always
} the last one which causes the segfault regardless of the order in which
} they are loaded.

I still can't figure out how *loading* the modules can cause a seg fault
regardless of ordering, unless it's just the case that there are too many
modules to all be loaded at once.

My guess is that the failures on Solaris et al., which seem to happen at
the module *un*loading test, have to do with shared library linkage.  It
was wrong to simply discard all the dependencies and then unload.

Here's a patch to V01zmodload to force unloading to happen in reverse
dependency order, i.e., a module is only unloaded when nothing depends
on it, and then its dependencies are removed so it won't prevent some
other module from being unloaded.  If it's not possible to unload any
module that way, the zmodunload function calls zmodload -u to generate
the correct error message; this should happen only in case of circular
dependencies.

Please check whether this takes care of the zmodload test segfaults on
various architectures.

I wish zmodunload were suitable for use outside the test suite, but it
could be badly confused by use of module aliasing.

diff -u zsh-forge/current/Test/V01zmodload.ztst zsh-4.0/Test/V01zmodload.ztst
--- zsh-forge/current/Test/V01zmodload.ztst	Fri May 18 09:09:10 2001
+++ zsh-4.0/Test/V01zmodload.ztst	Wed May 23 09:37:46 2001
@@ -5,6 +5,7 @@
 # the config.modules file.  This differs for static vs. dynamic builds.
 
  mods=()
+ deps="$(zmodload -Ld)"
  while read name modfile link auto load funcs
  do
    [[ $name == \#* ]] && continue
@@ -13,6 +14,27 @@
    mods=($mods $name)
  done < $ZTST_testdir/../config.modules
 
+ zmodunload() {
+   local m n=$#
+   (( n == 0 )) && return 0
+   for m
+   do
+     if [[ -z ${(M)${(f)"$(zmodload -d)"}:#*:* $m( *|)} ]]
+     then
+       zmodload -u $m && zmodload -ud $m || return 1
+       shift
+     else
+       set $@[2,-1] $m
+     fi
+   done
+   if (( $# < n ))
+   then
+     zmodunload $*
+   else
+     zmodload -u $*
+   fi
+ }
+
 %test
 
 # This first test depends on knowing that zsh is run with +Z from the
@@ -125,22 +147,15 @@
  zmodload -e example
 1:Delete the module alias again
 
-# Remove all inter-module dependencies so that we can unload in any order.
-# Skip the two modules that are required by the test system!
+# Don't unload the two modules that are required by the test system!
 
  mods[(r)zsh/main]=()
  mods[(r)zsh/parameter]=()
- for m in $mods
- do
-   zmodload -ud $m
- done
-0d:Remove module dependecies
-
-# Unload all the modules again (except the two we skipped, of course).
-
- zmodload -u $mods
+ zmodunload $mods
 0d:Unload the modules loaded by this test suite
 
 %clean
 
- unset name modfile link auto load funcs mods m
+ eval "$deps"
+ unset deps name modfile link auto load funcs mods
+ unfunction zmodunload

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


  reply	other threads:[~2001-05-23 16:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-22 15:14 Almost all tests pass under new cygwin Andrej Borsenkow
2001-05-22 15:24 ` Andrej Borsenkow
2001-05-22 15:31 ` Bart Schaefer
2001-05-22 15:44   ` Oliver Kiddle
2001-05-23 16:51     ` Bart Schaefer [this message]
2001-05-24 12:15       ` About zmodload test segfaults Andrej Borsenkow
2001-05-25 16:54         ` PATCH: Block device tests Bart Schaefer
2001-05-26  8:24           ` Andrej Borsenkow
2001-05-27 22:54             ` Bart Schaefer
2001-05-28  6:50               ` Andrej Borsenkow
2001-05-28 16:06                 ` Bart Schaefer
2001-05-28 17:25                   ` Bart Schaefer
2001-05-29 10:34                   ` Peter Stephenson
2001-05-29 10:51                     ` Andrej Borsenkow
2001-05-29 15:37                       ` Bart Schaefer
2001-05-30  9:21                         ` Peter Stephenson
2001-05-28  9:21       ` About zmodload test segfaults Sven Wischnowsky
2001-05-22 15:53   ` Almost all tests pass under new cygwin Andrej Borsenkow
2001-05-23 11: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=1010523165140.ZM9483@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=zsh-workers@sunsite.dk \
    /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).