Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [BUG] var=$* and var=$@ create array with SHWORDSPLIT and null or unset IFS
- X-seq: zsh-workers 40599
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: [BUG] var=$* and var=$@ create array with SHWORDSPLIT and null or unset IFS
- Date: Mon, 20 Feb 2017 13:20:58 -0800
- Authentication-results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=brasslantern-com.20150623.gappssmtp.com
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=+lfqxS8q/Xt79NP0y9Cd8Zf/S3pg+rXYd2eV0oh5Sh4=; b=G1Xsz9GYk3E2AAzzsih9AsVer591cBJe8Go/4nKIy47/59MG3sd3SU/pALrRYMBYFi lJR8BlpP/foYOSDaPUKI4rdCHSAMs+gv/bSmXVF/BpasShAsneHCup/ctqKsC9h7yGg6 H/TAig8lModHpqHTtpSNWoqsCcPil4D/WqtpIrQu9fJ83zz6TjQ99ij2pY7NpRiqLjAm d3VUeQtkXgxPSmIfMM+rqx9qkhVB5r0KB5uc0MGkRKNs0MYF7OCoq/2Gi5/Kv3RpiO79 gRyCMDN31Yw8wCaUdlbX3uXG3D7XXlTnR1Bbp0kHefzgVnEs8Kw3JRM1JI77IwsVSK9l mLQg==
- In-reply-to: <170220105837.ZM12210@torch.brasslantern.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>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <62e5833f-14b1-b42b-31af-2f1532b565ed@inlv.org> <170216211431.ZM25042@torch.brasslantern.com> <170220105837.ZM12210@torch.brasslantern.com>
On Feb 20, 10:58am, Bart Schaefer wrote:
}
} >--- null IFS, native splitting ---
} >> var=$@
} >[one two three four]
} >> var=$*
} >[onetwo threefour]
} >> var="$@"
} >[one two three four]
} >> var="$*"
} >[onetwo threefour]
}
} Joining the array for assignment is forced by prefork() passing
} PREFORK_SINGLE down to paramsubst(). Joining is supposed to be done on
} the first character of $IFS in this case. When IFS is null (as opposed
} to unset), this causes both $@ and $* to join on empty string.
}
} Where is the space supposed to come from when joining $@ here?
Thanks to Chet Ramey for pointing me at
http://austingroupbugs.net/view.php?id=888
Which says (very last block of examples) that var=$@ and var="$@" and
a whole slew of their variations, have unspecified behavior.
Consequently I'm going to take the position that zsh is allowed to join
these with empty string rather than pulling a field separator out of
its proverbial hat, and I will tweak 40565 appropriately and commit.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author