1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-11-22 13:21:27 +01:00
Commit graph

342 commits

Author SHA1 Message Date
Philippe Altherr
e1fed5439c 53782: Src/params.c, Test/K01nameref.ztst: changes to nameref base level:
- avoid changing base on assignment;
 - omit base level for up-scope references
 - do not follow reference chains for base level of new references
2025-10-26 16:52:51 -07:00
Philippe Altherr
1e0d2b0d7e 53781: fix loading of autoload variable via a reference 2025-10-26 14:06:57 -07:00
Bart Schaefer
25399e5437 unposted: fix silly bug wherein ${(!)ref} uppercased the referent name 2025-05-14 13:39:14 -07:00
Bart Schaefer
b0fa403a3d 53602: "typeset -nu" always refers to at a call level above the declaration 2025-05-12 21:29:16 -07:00
Bart Schaefer
1706805d46 unposted: fix bad pointer found by valgrind 2025-05-09 17:00:33 -07:00
Bart Schaefer
abd541e18c 53568: fix additional problems with reference scoping, update documentation
Scope exits could miss some scope updates in named reference chains.
References declared -u behave like any other reference upon scope exit.
2025-05-09 16:38:28 -07:00
Bart Schaefer
f555e902db 53546,53557 (plus test): Fix scoping of "placeholder" named references
When using placeholders declared several levels earlier than assignment:
1) Searching "up" for "typeset -n -u" could find deeper locals than intended
2) Searching for a subscript reference could skip to the top level
3) Exiting a function scope could incorrectly change the reference level
2025-05-06 10:50:53 -07:00
Bart Schaefer
e7163e69d9 53431: fix assignment via named reference to parameters in outer scopes 2025-03-31 15:25:34 -07:00
dana
6bb792dba8 53257: use monotonic clock where appropriate
update the following features to use the monotonic clock for calculating time
deltas and intervals:

* MAILCHECK parameter
* PERIOD parameter
* SECONDS parameter
* %(nS.t.f) prompt-expansion sequence
* time built-in's elapsed time and cpu % values
* zsh/zftp ZFTP_TMOUT parameter
* zsh/zprof timings

also use CLOCK_MONOTONIC_RAW instead of CLOCK_MONOTONIC on macOS
2024-12-26 10:09:25 -06:00
Bart Schaefer
f282ff5792 53209 + tests: do not unmetafy via string pointers into global parameter table 2024-11-05 13:50:51 -08:00
Jun. T
b2f24ff0d2 53026: fix failure to free old value when setting new value of reference 2024-08-06 14:37:39 -07:00
Bart Schaefer
72751bfe1f 53025: fix memory leaks and pointer errors upon named reference self-reference 2024-08-05 15:59:48 -07:00
Bart Schaefer
65da467441 53023: fix memory leak of unset private parameter 2024-08-05 15:49:15 -07:00
Bart Schaefer
326e8635fe 52752: typeset -p fixes for local exports and "export -x" / "readonly -r" output. 2024-03-14 13:11:31 -07:00
Bart Schaefer
330821de01 52692: local typeset of the name of a named reference hides the reference 2024-03-05 21:13:33 -08:00
Bart Schaefer
d27ea2ae02 unposted (cf. 52617): only scalars can instantiate a declared named reference 2024-03-04 21:36:45 -08:00
Bart Schaefer
610b18875a 52650 plus minor fixes: add -u for named references pointing to "upper" scope 2024-03-04 21:07:01 -08:00
Bart Schaefer
d1ff06f991 52652: fix obscure bug unsetting the array part of a tied parameter pair 2024-03-02 21:37:25 -08:00
Bart Schaefer
85172998f4 52619 (plus tests): no empty element when appending array to unset scalar 2024-02-28 20:40:26 -08:00
Oliver Kiddle
5331ff11c6 52594: support for POSIX real-time signals with kill and trap
Also add new -L option to kill for a more verbose listing of signals
2024-02-28 00:21:11 +01:00
Bart Schaefer
4b9cd6b8bd 52583: extra check for proper scope and existence of readonly specials 2024-02-23 09:51:06 -08:00
Bart Schaefer
6b21e5c0e2 52559: revise "typeset -p" with respect to local readonly special parameters
Update doc and tests to describe handling of global readonly specials and
to account for side-effects on zsh/param/private.
2024-02-20 20:16:03 -08:00
Bart Schaefer
336249e7ea unposted: referent of named reference cannot start with digits
This duplicates ksh behavior and doesn't change useful functionality.
2024-02-18 12:19:25 -08:00
Bart Schaefer
8801665e5b 52513: fixes and doc for using nofork substitutions with private parameters
Also fixes a crash bug with {fd}>&N redirections and private parameters
2024-02-03 12:07:14 -08:00
Bart Schaefer
98a6892cb1 52244: Fix a batch of minor defects reported by Coverity.
Coverity defects 1547831, 1547826 (remove unused function), 1521551,
1500752, 1500747, 1401549, 1372423, 1270645, 1255799, 1255792, 1255789,
1255787, 1255782, 1255750
2023-10-26 08:27:18 -07:00
Bart Schaefer
0f0ba0539e 52195: cached_username is already metafied when initializing LOGNAME 2023-10-01 13:38:25 -07:00
Bart Schaefer
29644f12e7 52193: handle UTF8-encoded USERNAME and therefore home directory in zcompile
Includes one unposted thinko fix ztrdup -> dupstring
2023-10-01 11:34:33 -07:00
Bart Schaefer
baa19d2a85 51945: assorted documentation improvements, bug fixes, and new test
1) Document the behavior of "typeset -n existing_var" (via Jun T. comment)
2) Prohibit "typeset -nm pattern" because, well, it's insane.  Add test.
3) Improve doc for ${(!)ref} including ${{t!)ref} (Jun T.)
4) Fix doc for how-to unset of a named ref (Jun T.)
5) Allow "typeset +r -n ref" and "typeset +r +n ref" (Jun T.)
6) Fix "typeset -r -n ref=param" to create readonly references
7) Avoid accidental removal of PM_UNSET flag (Jun T.) and update test
8) Fix "typeset -gn ref=value" and add a test for it
9) Add tests for read-only reference behavior
10) Fix infinite recursion when resolving scope of an unset local
named reference, add test.
2023-07-26 20:15:21 -07:00
Jun-ichi Takimoto
1b9bc3441c 51884: reset IFS if it contains invalid characters
This happens only if MULTIBYTE option is on.
2023-06-26 16:52:40 +09:00
Bart Schaefer
4345eed1fe 51887: namespaces recognized in math, incorrect usages rejected. 2023-06-22 13:36:40 -07:00
Bart Schaefer
8d009d35a9 51510: Skip namespaces in "set"/"typeset" output, add tests, fix bug 2023-03-06 20:01:04 -08:00
Bart Schaefer
0562be0af8 51509 (+ fix typo): Add ${(!)name} for the referred-to name of a named reference
Extend ${!name} in ksh emulation for same
2023-03-06 19:54:48 -08:00
Bart Schaefer
4bc1f6e0d2 51484: Extend named reference handling for special parameters, improve doc. 2023-03-05 14:06:25 -08:00
Bart Schaefer
a9ba166216 51483: Enable assignment and expansion of parameters with ksh-like namespace prefixes. 2023-03-05 14:03:42 -08:00
Peter Stephenson
82f307bddf Fix access to autoloaded parameter.
Namerefef resolution needs to happen on the parameter after autoload.
2023-02-21 12:16:40 +00:00
Bart Schaefer
32cceefa95 51437: Fix incorrectly-passed test case, masked by unrelated bug.
A bug with zmodload when unloading/reloading a static module caused the
state of the shell options to change during K01 test.  Worked around it.
Also changed warnnestedvar messages to look more like other such.
2023-02-14 17:54:42 -08:00
Bart Schaefer
03887bb03f 51430: Misc. problems with typeset and $parameters
* Fix and test for regression of assignment when using typeset command
* Fix output of typeset +m and $parameters[ref]
* Prevent segfault in typeset
2023-02-13 18:20:11 -08:00
Bart Schaefer
f4c706f0c8 51417: Check subscripts in named reference values more rigorously. 2023-02-12 12:20:33 -08:00
Bart Schaefer
3eed6f70cd 51402: Some ksh/bash features, additional sanity checking
* Add "unset -n"
* Allow and enforce "typeset -n -r" for read-only references
* "can't change type via subscript reference" error
* Better checking for self-referential declarations/assignments
* Ksh-style "foo=bar; typeset -n foo" creates foo=bar reference
* Support "typeset -n ref; for ref in ..."
* Subscripted references use NO_EXEC for safety
* References assigned in called scopes reset scope at end
* Allow named references to $! $? $$ $- $0 $_
2023-02-12 11:51:41 -08:00
Bart Schaefer
3e55a135c1 51374: Expose named references in $parameters, fix substitution error. 2023-02-12 11:29:10 -08:00
Bart Schaefer
511e020c68 51360: Initial implementation of named references. 2023-02-12 11:21:23 -08:00
Peter Stephenson
03292bceec 51278: make (i) subscript flag for zero-length string consistent 2023-01-16 11:10:02 +00:00
Oliver Kiddle
a73c705b0c 51212: remove STOUC() macro
This served as a workaround for ancient compilers where casts to
unsigned char were broken.
2022-12-16 23:28:10 +01:00
Jun-ichi Takimoto
1be52186b4 51079: metafy sep in array subscript flag (s:sep:)
this enable sep to contain \0 etc.
2022-12-02 19:32:11 +09:00
Jun-ichi Takimoto
09ad15b986 50081: reset global mbstate_t variables when LC_CTYPE changes 2022-04-20 21:06:53 +09:00
Oliver Kiddle
926a1a7296 49602: only set LOGCHECK from the watch module 2021-11-28 20:51:41 +01:00
Oliver Kiddle
271cfc685b 49534, 49539: separate watch/log functionality out into a module 2021-11-02 21:41:53 +01:00
Bart Schaefer
fa4c88ca25 49456: clean up detection of private params in nested scopes, update doc 2021-10-04 09:02:27 -07:00
Jun-ichi Takimoto
dd51ffa5b4 49422: improve support of --disable-dynamic-nss
see also 49392 (Vincent) and 49412 (Axel)
2021-09-22 13:36:57 +09:00
Bart Schaefer
cf5c4828d1 48857: declare "volatile" all globals that may be modified by signal handlers 2021-05-16 19:51:11 -07:00