zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Danek Duvall <duvall@emufarm.org>, zsh-workers@sunsite.dk
Subject: PATCH: Re: expansion bug in 4.0.3?
Date: Sat, 3 Nov 2001 16:43:31 +0000	[thread overview]
Message-ID: <1011103164331.ZM8483@candle.brasslantern.com> (raw)
In-Reply-To: <20011103000021.A9262@lorien.emufarm.org>

On Nov 3, 12:00am, Danek Duvall wrote:
}
}     % echo $$
}     146
}     % print -l ${$(</proc/$$/environ)}
}     DISPLAY=:0.0 HOME=/home/duvall LOGNAME=duvall USER=duvall [ ... ]
}     % print -l ${$(</proc/146/environ)}
}     DISPLAY=:0.0
}     HOME=/home/duvall
}     LOGNAME=duvall
}     USER=duvall
}     [ ... ]
} 
} Is this a bug, or is there some behavior I'm not understanding properly?

It's a bug.  The optimization that causes $(<filename) to be implmented
without forking is not properly saving/restoring some state, such that
the expansion of $$ in the file name causes zsh to behave as if you'd
written it with double quotes, i.e. `print -l ${"$(</proc/$$/environ)"}'.

This bug doesn't exist in 3.0.x because the state that needs to be saved
and restored wasn't introduced until 3.1.9-pws-19.  However, the bug has
probably been present ever since then -- for more than two years.

The following would appear to be the fix.  "make check" still passes.

Index: Src/subst.c
===================================================================
--- Src/subst.c	2001/10/17 14:38:29	1.8
+++ Src/subst.c	2001/11/03 16:34:57
@@ -245,11 +245,13 @@
 mod_export void
 singsub(char **s)
 {
+    int omi = mult_isarr;
     local_list1(foo);
 
     init_list1(foo, *s);
 
     prefork(&foo, PF_SINGLE);
+    mult_isarr = omi;
     if (errflag)
 	return;
     *s = (char *) ugetnode(&foo);


-- 
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-11-03 16:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-03  8:00 Danek Duvall
2001-11-03 16:43 ` Bart Schaefer [this message]
2001-11-03 17:13   ` PATCH: " Bart Schaefer
2001-11-03 20:35   ` [16215] " Danek Duvall

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=1011103164331.ZM8483@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=duvall@emufarm.org \
    --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).