zsh-workers
 help / color / mirror / code / Atom feed
* arr=('') broken
@ 1996-06-28 14:52 Peter Stephenson
  1996-06-28 15:08 ` Zoltan Hidvegi
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Stephenson @ 1996-06-28 14:52 UTC (permalink / raw)
  To: Zsh hackers list

Assigning empty strings to arrays (set -A still works OK) was broken
by the changes in untokenisation.  This broke my multicomp function.

% sofar=('')
% print $#sofar
0

The patch should be something like the following.  I've written it
this way on the assumption that if we get as far as the array code,
the list must have passed through globlist and hence has had unwanted
elements pruned already.  As I understand it, globlist() now always
returns untokenised text, and one needs to be careful not to
untokenise twice which can in principal do bad things to
eight-bit-cleanliness, which is why I added the first hunk and removed
the untokenize() in the second hunk.

*** Src/exec.c~	Fri Jun 21 10:47:16 1996
--- Src/exec.c	Fri Jun 28 16:46:44 1996
***************
*** 1047,1053 ****
  	    if (empty(vl))
  		val = ztrdup("");
  	    else {
! 		untokenize(peekfirst(vl));
  		val = ztrdup(ugetnode(vl));
  	    }
  	    if (xtr)
--- 1047,1054 ----
  	    if (empty(vl))
  		val = ztrdup("");
  	    else {
! 		if (!isset(GLOBASSIGN))
! 		    untokenize(peekfirst(vl));
  		val = ztrdup(ugetnode(vl));
  	    }
  	    if (xtr)
***************
*** 1066,1075 ****
  	    char *pp;
  
  	    pp = (char *) ugetnode(vl);
! 	    if (*pp) {
! 		*ptr = ztrdup(pp);
! 		untokenize(*ptr++);
! 	    }
  	}
  	*ptr = NULL;
  	if (xtr) {
--- 1067,1073 ----
  	    char *pp;
  
  	    pp = (char *) ugetnode(vl);
! 	    *ptr++ = ztrdup(pp);
  	}
  	*ptr = NULL;
  	if (xtr) {

-- 
Peter Stephenson <pws@ifh.de>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77330
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: arr=('') broken
  1996-06-28 14:52 arr=('') broken Peter Stephenson
@ 1996-06-28 15:08 ` Zoltan Hidvegi
  0 siblings, 0 replies; 2+ messages in thread
From: Zoltan Hidvegi @ 1996-06-28 15:08 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-workers

> Assigning empty strings to arrays (set -A still works OK) was broken
> by the changes in untokenisation.  This broke my multicomp function.
> 
> % sofar=('')
> % print $#sofar
> 0
> 
> The patch should be something like the following.  I've written it
> this way on the assumption that if we get as far as the array code,
> the list must have passed through globlist and hence has had unwanted
> elements pruned already.  As I understand it, globlist() now always
> returns untokenised text, and one needs to be careful not to
> untokenise twice which can in principal do bad things to
> eight-bit-cleanliness, which is why I added the first hunk and removed
> the untokenize() in the second hunk.

I also discovered this bug and fixed yesterday :-) in a bit different way.
There is no problem calling untokenize twice.  Untokenize does not affect
8-bit cleannes.  8-bit conversion is only done when zsh communicates with
the outer world.

zsh-3.0-pre1 will be out today which will have this fixed.

Zoltan



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1996-06-28 15:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-06-28 14:52 arr=('') broken Peter Stephenson
1996-06-28 15:08 ` Zoltan Hidvegi

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).