Commit graph

288 commits

Author SHA1 Message Date
Daniel Shahaf
ae7e291873 45066: internal: Document forklevel, locallevel, and exit_pending. 2019-12-18 06:01:50 +00:00
Martijn Dekker
c578f0a08b 45004: Fix typos in comments 2019-12-11 02:37:39 +00:00
Peter Stephenson
d946f22a4c 44664: Fix problem with temporary assignment.
"foo=bar builtin" inside a function lost any variable from
enclosing scope.
2019-08-14 15:16:59 +01:00
Peter Stephenson
8cbbc04d97 44509: Prevent crash with modified path / PATH combination.
Crash came from "fn() { typeset -U path=($path); unset PATH; }".

Note PATH unset is global as only path was made local.
2019-07-15 09:44:47 +01:00
Oliver Kiddle
3de2333b08 44307: allow for atoi() returning a negative number 2019-05-20 00:14:01 +02:00
Wesley Schwengle
51d2e91a7e 44164: Avoid stringop-truncation warning 2019-03-25 20:42:54 +09:00
Peter Stephenson
f99f7dca75 43616: Various parameter setting and display fixes.
Mostly to do with typeset -p and tied variables and their interaction.

Some general tied variable fixes.
2018-10-08 10:10:42 +01:00
Stephane Chazelas
a75b47973d 43546: "typeset -p" should show -U flag 2018-09-25 10:06:18 +01:00
Peter Stephenson
f58b35bf88 43264: fix ${+assoc[nonexistent]} with KSH_ARRAYS 2018-08-09 09:48:35 +01:00
dana
b066cc3ea9 42297: (e) subscript flag needs extra work with scalars 2018-05-14 16:54:19 +01:00
Oliver Kiddle
373efa085d Nelson H. F. Beebe: 19597 (rebased 42369): return Inf, NaN etc from floating point operations instead of errors to allow non-stop IEEE 754 arithmetic 2018-05-13 10:02:01 +02:00
Oliver Kiddle
90afd36922 42597: plug memory leak found by coverity 2018-04-07 14:37:46 +02:00
Stephane Chazelas
c2cc8b0fbe Avoid crash copying empty hash table.
Visible with typeset -p.
2018-01-04 17:12:13 +00:00
Peter Stephenson
174e560a23 41787 (plus minor tweaks): use $FUNCSTACK for function nesting depth.
Initialised from existing configuration value.
2017-10-02 09:44:26 +01: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
ab7be4238c More [key]=value tweaks
Some rephrasings.

Update typeset -p for associative arrays to use new syntax.
2017-09-14 21:43:37 +01:00
Peter Stephenson
54b3958440 First go at var=([key]=value) syntax.
Works for both normal and typeset case, also var+=...

Still to do: allow to be mixed with straight array assignment,
improve typeset -p, implement [key]+=value.
2017-09-13 20:54:00 +01:00
Barton E. Schaefer
11d2dbda38 41225: sethparam() should not attempt to change special parameters into hashes 2017-06-05 09:45:45 -07:00
Peter Stephenson
a2e2f5668d 40990: Fix crash with bogus path in sh emaulation.
When startying in sh emulation don't link PATH-style parameters
to array equivalents.  To allow this to function, don't check
for the linkage when exporting the colon-separated parameter.
2017-04-21 18:07:42 +01:00
Peter Stephenson
f6ab9a281d 40932: Parameter subscripts need to count parentheses.
Otherwise they can terminate in the middle of an expression.
2017-04-03 10:04:03 +01:00
Barton E. Schaefer
c93f29b52d 40799: fix $- expansion partly broken by 40760 2017-03-08 21:33:25 -08:00
Daniel Shahaf
67d882479b 40745 + 40753: Fix 'unset ZLE_RPROMPT_INDENT' not restoring the default behaviour.
To reproduce:

    RPS1=foo
    ZLE_RPROMPT_INDENT=42
    unset ZLE_RPROMPT_INDENT
2017-03-08 10:04:44 +00:00
Sebastian Gniazdowski
8522e996ec 40781: optimize array assignment, similar to 39995 for string assignment 2017-03-04 15:35:19 -08:00
Peter Stephenson
a32fb005d6 40486: Don't warn on creation of MATCH etc. in regex.
This because they are created implicitly rather than by explicit
user request, so the warning may not be useful.
2017-02-02 10:03:57 +00:00
Daniel Shahaf
ad1b46578e 40460: WARN_NESTED_VAR: Don't warn when assigning to a slice of an existing array 2017-02-01 01:49:45 +00:00
Peter Stephenson
1633b2800d 40423: WARN_NESTED_VARS, conversion the other way 2017-01-26 20:07:51 +00:00
Peter Stephenson
80e47a9a5d 40422: More WARN_NESTED_VAR cases.
Converting type when using a calling scope was broken in the
original patch.
2017-01-26 19:58:17 +00:00
Peter Stephenson
b3637caa90 40413: WARN_NESTED_VAR subscripted variable fix.
No warning needed on paramter that's created temporarily to
help assignment.
2017-01-25 09:35:30 +00:00
Peter Stephenson
c861b17bbf 40391: Add WARN_NESTED_VAR option and functions -W.
These are companions to WARN_CREATED_GLOBAL, warning when a variable
from an enclosing scope is altered.
2017-01-23 09:50:57 +00:00
Daniel Shahaf
9d87cd948e 40270 (after 39995): Add cross-reference for robustness. 2017-01-05 15:58:18 +00:00
Sebastian Gniazdowski
4fb4ce190c 40231: Optimise setarrvalue(). 2016-12-28 05:29:59 +00:00
Daniel Shahaf
334ed65e27 40068: Abort execution when setuid/setgid fail.
The incumbent code would print an error message and continue execution
with the previous uid/gid values, not even setting lastval:

    % UID=42 id -u; echo $?
    zsh: failed to change user ID: operation not permitted
    1000
    0
    %
2016-12-03 10:00:08 +00:00
Daniel Shahaf
fd2ca229dd 40067: internal: Document 'cmatcher', parse_cmatcher(), 'comptoend', unsetparam_pm(), and getindex(). 2016-12-03 09:54:11 +00:00
Barton E. Schaefer
a9fe87e18c 40032: consistency in handling of subscript slices outside the bounds of an array parameter
unposted: README: example describing 40032
2016-11-29 12:31:33 -08:00
Guillaume Maudoux
dae21874d4 39900: Add TERMINFO_DIRS special like TERMINFO.
Although this is a colon-separated array there is no tied array.
2016-11-20 20:24:15 +00:00
Peter Stephenson
368884a3aa 39995 (from 39977): Optimise string parameter assignment.
If setter is the standard one and string length is unchnaged we can
copy into place.
2016-11-20 19:41:52 +00:00
Daniel Shahaf
f35198d837 39992: setarrvalue: Allocate a correctly-sized array.
No memory was lost; the array was allocated with room for one (char *) element
more than was required.
2016-11-20 11:56:02 +00:00
Jun-ichi Takimoto
3fd50d06a1 39937: fix a problem introduced by 39886.
$a[i,j] should become an empty array if i>j.
2016-11-15 00:17:35 +09:00
Barton E. Schaefer
d676d1bf4b 39893: use arrdup_max() to show explicitly the difference in two code branches
no functional change
2016-11-10 21:01:32 -08:00
Daniel Shahaf
7139b73724 39874/0001: setarrvalue: Remove needless initialization. 2016-11-11 04:35:41 +00:00
Peter Stephenson
65ea1a033b 39887: no need to conditionalise assignment of strlen() 2016-11-09 13:45:11 +00:00
Peter Stephenson
a1633e09a7 39886 based on 39877: Optimise arrdup to arrdup_max.
Only duplicate as much of the array as is needed.
2016-11-09 11:54:57 +00:00
Sebastian Gniazdowski
49407686b4 39875: add dupstring_glen to avoid redundant strlen calls 2016-11-09 10:32:48 +00:00
Sebastian Gniazdowski
06e4ec853a 39871: cut down number of strlen()s in getstrvalue() 2016-11-08 15:14:08 +00:00
Sebastian Gniazdowski
68a576bc55 39869: can transfer ownership of core of array when assigning 2016-11-08 10:49:13 +00:00
Barton E. Schaefer
ab81b98c49 39758: revise 39704 for array and hash parameters; more POSIXBUITINS tweaks for
export

39704 was commit 0f5e670, forgot to reference article number in that log.

"typeset -p" outputs "typeset" for array and hash parameters, even when
exported, because those types can be marked export but are never pushed
to the enviroment.

For POSIXBUILTINS, "export var" does not implicitly set $var, and its
export state is preserved when assigned (but not when explicitly unset).
2016-10-29 11:56:50 -07:00
Barton E. Schaefer
0f5e670cde "typeset -p" uses "export" commands or the "-g" option for parameters that are not local to the current scope 2016-10-24 07:14:39 -07:00