1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-10 12:40:58 +02:00
Commit graph

203 commits

Author SHA1 Message Date
Jun-ichi Takimoto
baedd62f0d 43219 (except term{cap,info}.c): fix several memory leaks 2018-07-31 22:15:58 +09:00
Joey Pabalinas
110b13e109 42313: avoid null-pointer deref when using ${(PA)...} on an empty array result 2018-01-23 22:28:08 -08:00
Peter Stephenson
b3fa5c528c 41877: Separate out SH_FILE_EXPANSION loop from parameter substitution.
Parameter substitution can add nodes that need to be rescanned by
it, but not by file expansion, so the two don't play well together.
2017-10-13 18:17:09 +01:00
Barton E. Schaefer
b84d69cf52 41828, 41830: skip SHFILEEXPANSION for new nodes added by stringsubst() in prefork() 2017-10-08 18:08:09 -07:00
Peter Stephenson
728f2adfc8 Add typeset -p1, like typeset -p with newlines 2017-10-01 17:53:56 +01:00
Peter Stephenson
6230e82d44 41764 (test tweaked): allow [key]+=value when modifying arrays 2017-09-27 09:41:50 +01:00
Peter Stephenson
7d4b41b52a 41747: Don't create hash entry if just checking existence.
Pass a flag in indicating this case.
2017-09-25 20:03:05 +01:00
Peter Stephenson
85b0dd7133 Updates for ksh array element syntax.
Move detection of key/value pairs down into prefork().

Detect normal array assignment and [key]=val array assignemnt
separately.  Mark key / value pairs with Marker and pass up flag.  Deal
with marked triads specially later on.
2017-09-24 17:33:07 +01:00
Peter Stephenson
e44600d9aa 41661: Need to remove tokens before using bufferwords() for (z) 2017-09-10 18:01:39 +01:00
Barton E. Schaefer
207263a61e 40929 (replaces 40598): paramsubst() should always return scalar when PREFORK_SINGLE was passed in from prefork()
Previous commit (74fe4d09) consumed too much of the input linked list,
leading to later expansions being skipped.  This commit converts from
array to string sooner, but may thereby alter rc_expand_param and array
element uniqueness behavior.
2017-04-02 14:43:27 -07:00
Barton E. Schaefer
420fc41b7c 40832: fix $x:P when PWD=/ 2017-03-11 14:40:12 -08:00
Peter Stephenson
f3f8537cfa 40760: Always tokenize unquoted - to Dash.
This fixes use of pattern match character ranges in unusual contexts.

Attempt to detect a tokenized - in cases where we don't care.
2017-03-07 10:43:58 +00:00
Barton E. Schaefer
4b8db48c6b 40640: the (A) parameter flag forces array result even if assignment syntax is not used 2017-02-25 15:56:50 -08:00
Barton E. Schaefer
74fe4d0950 40598: paramsubst() should always return scalar when PREFORK_SINGLE was passed 2017-02-20 13:26:49 -08:00
Barton E. Schaefer
b3c186028e 40593: SHWORDSPLIT + unset IFS should cause default splitting of $@ 2017-02-20 13:26:49 -08:00
Peter Stephenson
4d6097657c 40375: autoload with explicit path mustn't trash already loaded function.
Also remove unnecessary dupstring() on already duplicated string
when expanding =cmd.
2017-01-18 09:57:55 +00:00
Barton E. Schaefer
c4dba4f2e6 users/22319: ${ary1:^ary2} should not change isarr state of expansion of ary1
Unless ary1 is made from a scalar, semantics of (@) in double quotes is lost.
2017-01-03 14:44:12 -08:00
Barton E. Schaefer
a409adc33b 40071: change Dash back to "-" before evaluating named directory expansions 2016-12-03 15:00:46 -08:00
Barton E. Schaefer
3ba86f4db4 40034: clear badcshglob when ignoring errors 2016-11-29 12:35:57 -08:00
Eitan Adler
110ffae9fe 40035: Cosmetic fixes for comments and documentation.
Mostly fixes to doubled words.
2016-11-29 17:13:52 +00:00
Peter Stephenson
921b39ac6b 39949: Special case for "-" in directory names.
It can be sh-tokenized to Dash to allow for appearing in ranges
after substitution, so needs to be turned back to "-" in that case.
2016-11-15 18:01:32 +00:00
Julien Cretin
a96e34b459 39579: Fix string calculation for parameter quoting.
Where there was no closing quote the size or position of the null
could be wrongly calculated.
2016-10-06 10:57:10 +01:00
Peter Stephenson
07c8fbe596 34943: Fixes for "command" with multiple options.
These need to combine properly, and alos "command -p" with either
-v or -V needs to search for builtins and then using the default
system path.
2016-09-29 11:01:00 +01:00
Peter Stephenson
a4b8ee13be zsh-users/21903: Fix ${...?...} in interactive shell.
On failure should abort back to top level, but we reset the error
flag around commands.  Add a hard error flag that's only reset at top level.
2016-09-14 10:33:18 +01:00
Daniel Shahaf
f368720b8b 39252: internal: quotestring: Drop the 'e' parameter, which no caller uses. 2016-09-11 09:22:18 +00:00
Barton E. Schaefer
fa48711e31 39115: repair forced joining when (@) and (j) are used together 2016-08-29 08:34:03 -07:00
Daniel Shahaf
7154052ebe 39046 + 39061: New :P history modifier. 2016-08-22 03:34:30 +00:00
Barton E. Schaefer
a1a58dde6a 39035: ${(A)name=word} should expand as an array even when there is only one element. 2016-08-12 16:10:26 -07:00
Barton E. Schaefer
68e14c41f2 39028: more join/split cases fixed and tested. 2016-08-12 00:55:32 -07:00
Barton E. Schaefer
f7c3aa170b 39019 (cf. PWS 39013): fix SHWORDSPLIT regression introduced by workers/29313
Also add test cases for more join/split combinations
2016-08-10 18:33:04 -07:00
Daniel Shahaf
1a368bf31f 38973: Optimize indexing array parameters.
% () { for 1 in $prefix/zsh/bin/zsh Src/zsh; do $1 -f -c 'a=( {1..1000000} ); repeat 3 time ( repeat 300 : $a[1]  )'; done }
( repeat 300; do; : $a[1]; done; )  1.68s user 0.01s system 98% cpu 1.718 total
( repeat 300; do; : $a[1]; done; )  1.69s user 0.01s system 99% cpu 1.710 total
( repeat 300; do; : $a[1]; done; )  1.69s user 0.01s system 99% cpu 1.714 total

( repeat 300; do; : $a[1]; done; )  0.00s user 0.01s system 72% cpu 0.022 total
( repeat 300; do; : $a[1]; done; )  0.00s user 0.01s system 72% cpu 0.022 total
( repeat 300; do; : $a[1]; done; )  0.01s user 0.01s system 69% cpu 0.023 total
2016-08-01 08:01:28 +00:00
Barton E. Schaefer
984c18048b 38599: skip the "no such named directory" warning when NO_EXEC is in effect 2016-06-04 09:51:23 -07:00
Daniel Shahaf
9e7cefcc95 unposted: internal: Document modify(). 2016-06-03 20:39:25 +00:00
Peter Stephenson
dc2397f754 users/21352: ensure $'' doesn't get elided.
Assign nulstring to it if empty.  Test for all forms of quotation
marks.
2016-03-07 09:44:54 +00:00
Peter Stephenson
f5b8efa7e0 37344: restore old printable quoting, add ${(q+)...}.
The \C- form is only used inside quotedzputs().

${(q+)...} outputs a quotedzputs() representation.
2015-12-07 21:49:07 +00:00
Barton E. Schaefer
bc30d6bfca 37206: fix ${(t)param} for "typeset -H param" 2015-11-23 19:18:44 -08:00
Peter Stephenson
d814071b14 37096: Another $${(P)...} tweak.
Make a top level (P) work with nested ones, i.e. ${(P)${(P)...}...}
2015-11-12 14:28:15 +00:00
Peter Stephenson
7a951ef93e 37094: Further tweaks to parameter name references.
Safety in array test.

Make nested references work.

Add parameter tests.
2015-11-11 22:14:16 +00:00
Peter Stephenson
830d54e629 37092: make nested ${(P)name} properly refer to parameter on return 2015-11-11 18:04:20 +00:00
Peter Stephenson
e8d6041f69 37074: extend previous fix to over whitespace at end 2015-11-07 18:05:43 +00:00
Peter Stephenson
0fcc6c8fb2 37073: another SH_WORD_SPLIT problem.
In cases like x${:- y} the space was simply removed instead of
being used for splitting.
2015-11-06 17:28:02 +00:00
Barton E. Schaefer
a9add3de54 35694: fix handling of history modifiers applied across all elements of an array parameter value 2015-07-06 16:35:05 -07:00
Peter Stephenson
75cafccc0a 35343: Avoid $#name length handling for POSIX_IDENTIFIERS 2015-05-31 16:40:14 +01:00
Peter Stephenson
e88610b786 35326: $#- was misparsed as ${#-} 2015-05-29 16:06:47 +01:00
Peter Stephenson
0da0a0b9c7 35153: nested math substitution 2015-05-15 10:19:53 +01:00
Peter Stephenson
59a874f94e 35151: improved check for parameter q and b flags 2015-05-15 09:58:17 +01:00
Peter Stephenson
6269db883a 35067: Add (b) parameter flag for pattern char backslashing.
Doc tweak from Daniel in 35071.

Includes test.
2015-05-10 19:19:34 +01:00
Peter Stephenson
6fa63a0ce2 34606: fix up nested arithmetic substitution
Arithmetic within a parameter substitution is a special
case that needs fixing with the introduction of the new
Inparmath token.

Add test.
2015-02-22 21:32:08 +00:00
Peter Stephenson
2cbf9d7e65 34573: Safer failure to handle command substitution 2015-02-19 12:01:16 +00:00
Peter Stephenson
52e938bac9 34570: Another nasty command / math substituion thing.
Mark arithmetic substitutions with tokens to make sure the substitution
go knows what to do.  Before it was guessing by counting the
parentheses at the end.
2015-02-19 10:22:40 +00:00