From: "Thorsten Dahlheimer" <tdahlheim@gmx.net>
To: <zsh-workers@sunsite.dk>
Subject: PATCH: Prevent circular module aliases
Date: Tue, 9 Aug 2005 01:08:27 +0200 [thread overview]
Message-ID: <003401c59c6e$21b6f060$6183fea9@pcdahl4201> (raw)
[-- Attachment #1: Type: text/plain, Size: 265 bytes --]
The check that zmodload -A performs to prevent the creation of circular
alias chains is not thorough enough:
% zmodload -A A=B B=C B=A
% zmodload -A
A -> B
B -> A
% zmodload A
<stack overflow>
I've fixed that.
Regards,
Thorsten Dahlheimer
[-- Attachment #2: zmodload2.patch --]
[-- Type: application/octet-stream, Size: 1000 bytes --]
Index: Src/module.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/module.c,v
retrieving revision 1.18
diff -u -p -r1.18 module.c
--- Src/module.c 20 Jul 2005 16:08:22 -0000 1.18
+++ Src/module.c 8 Aug 2005 22:38:26 -0000
@@ -1093,12 +1091,15 @@ bin_zmodload_alias(char *nam, char **arg
zwarnnam(nam, "invalid module name `%s'", aliasname, 0);
return 1;
}
- find_module(aliasname, 1, &mname);
- if (!strcmp(mname, *args)) {
- zwarnnam(nam, "module alias would refer to itself: %s",
- *args, 0);
- return 1;
- }
+ do {
+ if (!strcmp(mname, *args)) {
+ zwarnnam(nam, "module alias would refer to itself: %s",
+ *args, 0);
+ return 1;
+ }
+ } while ((node = find_module(mname, 0, NULL))
+ && ((m = (Module) getdata(node))->flags & MOD_ALIAS)
+ && (mname = m->u.alias));
node = find_module(*args, 0, NULL);
if (node) {
m = (Module) getdata(node);
reply other threads:[~2005-08-08 22:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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='003401c59c6e$21b6f060$6183fea9@pcdahl4201' \
--to=tdahlheim@gmx.net \
--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).