Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Allow '=' aliases to be used with -L
- X-seq: zsh-workers 42494
- From: Joey Pabalinas <joeypabalinas@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: [PATCH] Allow '=' aliases to be used with -L
- Date: Wed, 21 Mar 2018 16:58:07 -1000
- Cc: Joey Pabalinas <joeypabalinas@xxxxxxxxx>, "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=HYk9rbWxi1K15R0rTT675+fdIVTe1kAtg0PVXQXae9Y=; b=twz0/yrKI7u9Vfd8p2OaVO0YGdaMjnDU0doNHY3UDQ00pV4UlskW0sXSCIXP6+kPsw ENdc+6AZIgma1S0A694a3ruegnF7ZpGQsYTUXMj6cgwawtOgpzUp0Wxoi4II+Q0uLZjW kzAQTObI+qJaMfPcqbqHuqVPX3ezT3NyMMJ9fjMgRS1WVdAmr529BCVv2sdY1GPHoofS EbWHzJ9bgpDmYzq5ZWHun+i/C+x38JscK0RA7CxaTOsgv/Q/NebAEwnQUPHGrQ+H5WI/ p+4ZYZX7dWgEN1UMvBYnz163OhPVR31uBmnGENmMQQcUK7IxdhqulsingGybnW+wp+Jb JTbg==
- In-reply-to: <CAH+w=7aC9qsUaqz6arQitzoZsCXjeedSX5zUYE_Qwd-CLNQX6Q@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20180322011905.45n377wsxp62k57e@gmail.com> <CAH+w=7aC9qsUaqz6arQitzoZsCXjeedSX5zUYE_Qwd-CLNQX6Q@mail.gmail.com>
On Wed, Mar 21, 2018 at 06:37:37PM -0700, Bart Schaefer wrote:
> Unfortunately you can't put this in the base shell, because assignment
> to the aliases array is only supported by a module.
Ah you are right, I didn't realize that. How about if we check if the
module is loaded first? If it happens to not be we can just use the
old failure path.
Revised patch below:
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/Src/hashtable.c b/Src/hashtable.c
index b7baa314220509240d..53e7e99e1a9f1505b6 100644
--- a/Src/hashtable.c
+++ b/Src/hashtable.c
@@ -1303,11 +1303,23 @@ printaliasnode(HashNode hn, int printflags)
}
if (printflags & PRINT_LIST) {
- /* Fast fail on unrepresentable values. */
+ /*
+ * '=' aliases need to be special cased with direct alias
+ * table assignment (`aliases[=]=...`). If the zsh/parameter
+ * module isn't loaded just print a warning and fail.
+ */
if (strchr(a->node.nam, '=')) {
- zwarn("invalid alias '%s' encountered while printing aliases",
- a->node.nam);
- /* ### TODO: Return an error status to the C caller */
+ /* Fast fail on unrepresentable values. */
+ if (!module_loaded("zsh/parameter")) {
+ zwarn("invalid alias '%s' encountered while printing aliases",
+ a->node.nam);
+ /* ### TODO: Return an error status to the C caller */
+ return;
+ }
+
+ printf("aliases[=]=");
+ quotedzputs(a->text, stdout);
+ putchar('\n');
return;
}
--
2.16.2
Attachment:
signature.asc
Description: PGP signature
Messages sorted by:
Reverse Date,
Date,
Thread,
Author