about summary refs log tree commit diff
path: root/Src
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'typesettounset' into declarednull declarednullBart Schaefer2021-04-133-1/+3
|\ | | | | | | Adds 'setopt typeset_to_unset', documentation, failure tests for POSIX incompatibilies, etc.
| * Change TYPESET_DOES_NOT_SET to TYPESET_TO_UNSET to avoid double-negativeBart Schaefer2021-04-123-3/+3
| |
| * Add TYPESET_DOES_NOT_SET option (cf. 48469)Bart Schaefer2021-04-103-1/+3
| |
| * Change DECLAREDNULL to DEFAULTEDBart Schaefer2021-04-103-12/+12
| |
| * Fix ${(t)var} output, add comparative test casesBart Schaefer2021-04-101-1/+2
| |
| * Missed files from POSXIBUILTINS commitBart Schaefer2021-04-101-2/+3
| |
| * Final repairs for declared state of tied arraysBart Schaefer2021-04-102-2/+7
| | | | | | | | Fixups still required in bin_typeset, but assignments to scalar work.
| * Additional tied-array cleanup when tied scalar had a previous valueBart Schaefer2021-04-101-3/+3
| |
| * Unset of a tied local scalar previously left it using tiedarr_gsuBart Schaefer2021-04-101-0/+2
| |
| * Partial fix for handling of tied arrays.Bart Schaefer2021-04-101-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | As of this commit when a tied array is declared but neither the scalar nor the array has an initializer, the array is initialized to empty. The scalar struct param of a tied pair stores a direct pointer to the internal array value of the array struct param, and upon assignment modifies it without referring to the containing struct. This means that there's no opportunity to clear the PM_DECLAREDNULL bits on both structs when the scalar is assigned. Conversely, assigning to the array does use the struct for the scalar.
| * Choose a better bit-value for PM_DECLAREDBart Schaefer2021-04-101-1/+1
| |
| * Add PM_DECLARED and PM_DECLAREDNULL parameter flags.Bart Schaefer2021-04-103-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This addresses the issue that "typeset foo" creates $foo set to an empty string, which differs from typeset handling in bash and ksh. It does this by concealing the internal value rather than alter the way internal values are defaulted. This imposes the following changes: A typeset variable with no assignment triggers NO_UNSET warnings when the name is used in parameter expansion or math. The typeset -AEFHLRTZailux options are applied upon the first assignment to the variable. Explicit unset before the first assignment discards all of those properties. If any option is applied to an existing name, historic behavior is unchanged. Consequent to the foregoing, the (t) parameter expansion flag prints nothing until after the first assignment, and the (i) and (I) subscript flags also print nothing. The bash behavior of "unset foo; typeset -p foo" is NOT used. This is called out as an emulation distinction, not a change. The test cases have not been updated, so several now fail. The test harness has been updated to declare default values.
* | Change DECLAREDNULL to DEFAULTEDBart Schaefer2021-04-133-12/+12
| |
* | Fix ${(t)var} output, add comparative test casesBart Schaefer2021-04-131-1/+2
| |
* | Missed files from POSXIBUILTINS commitBart Schaefer2021-04-131-2/+3
| |
* | Final repairs for declared state of tied arraysBart Schaefer2021-04-132-2/+7
| | | | | | | | Fixups still required in bin_typeset, but assignments to scalar work.
* | Additional tied-array cleanup when tied scalar had a previous valueBart Schaefer2021-04-131-3/+3
| |
* | Unset of a tied local scalar previously left it using tiedarr_gsuBart Schaefer2021-04-131-0/+2
| |
* | Partial fix for handling of tied arrays.Bart Schaefer2021-04-131-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | As of this commit when a tied array is declared but neither the scalar nor the array has an initializer, the array is initialized to empty. The scalar struct param of a tied pair stores a direct pointer to the internal array value of the array struct param, and upon assignment modifies it without referring to the containing struct. This means that there's no opportunity to clear the PM_DECLAREDNULL bits on both structs when the scalar is assigned. Conversely, assigning to the array does use the struct for the scalar.
* | Choose a better bit-value for PM_DECLAREDBart Schaefer2021-04-131-1/+1
| |
* | Add PM_DECLARED and PM_DECLAREDNULL parameter flags.Bart Schaefer2021-04-133-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This addresses the issue that "typeset foo" creates $foo set to an empty string, which differs from typeset handling in bash and ksh. It does this by concealing the internal value rather than alter the way internal values are defaulted. This imposes the following changes: A typeset variable with no assignment triggers NO_UNSET warnings when the name is used in parameter expansion or math. The typeset -AEFHLRTZailux options are applied upon the first assignment to the variable. Explicit unset before the first assignment discards all of those properties. If any option is applied to an existing name, historic behavior is unchanged. Consequent to the foregoing, the (t) parameter expansion flag prints nothing until after the first assignment, and the (i) and (I) subscript flags also print nothing. The bash behavior of "unset foo; typeset -p foo" is NOT used. This is called out as an emulation distinction, not a change. The test cases have not been updated, so several now fail. The test harness has been updated to declare default values.
* | 48439: remove macros that became unnecessary by df48cc8Jun-ichi Takimoto2021-04-121-26/+17
| |
* | 48504: use SEEK_ macros in fseek() callsOliver Kiddle2021-04-113-6/+6
| |
* | 45396: readhistfile: avoid thousands of lseek(2) syscalls via ftell()Michael Stapelberg2021-04-111-6/+10
| |
* | 47794: exec: run final pipeline command in a subshell in sh modebrian m. carlson2021-04-101-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | zsh typically runs the final command in a pipeline in the main shell instead of a subshell. However, POSIX specifies that all commands in a pipeline run in a subshell, but permits zsh's behavior as an extension. The default /bin/sh implementations on various Linux distros and the BSDs always use a subshell for all components of a pipeline. Since zsh may be used as /bin/sh in some cases (such as macOS Catalina), it makes sense to have the common sh behavior when emulating sh, so do that by checking for being the final item of a multi-item pipeline and creating a subshell in that case. From the comment above execpline(), we know the following: last1 is a flag that this command is the last command in a shell that is about to exit, so we can exec instead of forking. It gets passed all the way down to execcmd() which actually makes the decision. A 0 is always passed if the command is not the last in the pipeline. […] If last1 is zero but the command is at the end of a pipeline, we pass 2 down to execcmd(). So there are three cases to consider in this code: • last1 is 0, which means we are not at the end of a pipeline, in which case we should not change behavior. • last1 is 1, which means we are effectively running in a subshell, because nothing that happens due to the exec is going to affect the actual shell, since it will have been replaced. So there is nothing to do here. • last1 is 2, which means our command is at the end of the pipeline, so in sh mode we should create a subshell by forking. input is nonzero if the input to this process is a pipe that we've opened. At the end of a multi-stage pipeline, it will necessarily be nonzero. Note that several of the tests may appear bizarre, since most developers do not place useless variable assignments directly at the end of a pipeline. However, as the function tests demonstrate, there are cases where assignments may occur when a shell function is used at the end of a command. The remaining assignment tests simply test additional cases, such as the use of local, that would otherwise be untested.
* | 47913: implement CASE_PATHS option to make NO_CASE_GLOB more sensibleBart Schaefer2021-04-103-1/+10
|/
* 48432 and enable test: fix quotiing of zstyle -L for zstyle -ePeter Stephenson2021-04-091-1/+2
|
* 47785: remove deprecated autoconf functionsFelipe Contreras2021-04-093-37/+6
| | | | STDC_HEADERS and TIME_WITH_SYS_TIME are deprecated.
* 48379: Make the parameter expansion subscript flags parse error message, ↵Daniel Shahaf2021-04-081-3/+25
| | | | "error in flags", identify the location of the parse error.
* 48391: fix display problem in menu-completeJun-ichi Takimoto2021-04-061-1/+1
| | | | | Take account of the trailing file type character even when '-d disp' is given to compadd.
* 48389: getkeystring() should not return ptr to local varJun-ichi Takimoto2021-04-062-9/+31
| | | | | Now it returns NULL if called with GETKEY_SINGLE_CHAR and next character is not found. Caller must check the return value.
* 47784: silence a compiler waring from pattern.cFelipe Contreras2021-04-041-1/+1
|
* 47510: drop code that avoided termcap for named coloursOliver Kiddle2021-04-032-44/+13
| | | | | | The inconsistency caused test failures where TERM is e.g. rxvt-unicode. This also makes a couple of bits available in zattr by removing flags indicating whether to use termcap which is not an attribute as such.
* 48202 + 48366: Fix handling of NUL bytes in zexpandtabs multibyte versionMikael Magnusson2021-04-011-1/+4
|
* 47745: Fix [:IDENT:] vs posixidentifiersStephane Chazelas2021-03-231-1/+1
| | | | | wcsitype(c, IIDENT) should return false for non-ASCII characters when the POSIX_IDENTIFIERS option is on, not the other way round.
* users/26509: fix for r -LPeter Stephenson2021-02-181-2/+3
| | | | | fc with the -L option should ignore remote entires, rather than reading them and treating them as an error.
* 48073: Add fc -s as POSIX way of rerunning command without starting editorMartijn Dekker2021-02-171-2/+2
|
* Allow more scripts without #!Justine Tunney2021-02-161-4/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change modifies the zsh binary safety check surrounding execve() so it can run shell scripts having concatenated binary content. We're using the same safety check as FreeBSD /bin/sh [1]. POSIX was recently revised to require this behavior: "The input file may be of any type, but the initial portion of the file intended to be parsed according to the shell grammar (XREF to XSH 2.10.2 Shell Grammar Rules) shall consist of characters and shall not contain the NUL character. The shell shall not enforce any line length limits." "Earlier versions of this standard required that input files to the shell be text files except that line lengths were unlimited. However, that was overly restrictive in relation to the fact that shells can parse a script without a trailing newline, and in relation to a common practice of concatenating a shell script ending with an 'exit' or 'exec $command' with a binary data payload to form a single-file self-extracting archive." [2] [3] One example use case of such scripts, is the Cosmopolitan C Library [4] which configuse the GNU Linker to output a polyglot shell+binary format that runs on Linux / Mac / Windows / FreeBSD / OpenBSD. [1] https://github.com/freebsd/freebsd-src/commit/9a1cd363318b7e9e70ef6af27d1675b371c16b1a [2] http://austingroupbugs.net/view.php?id=1250 [3] http://austingroupbugs.net/view.php?id=1226#c4394 [4] https://justine.lol/cosmopolitan/index.html
* 47905: Add leading '-' to zparseopts option parsing errorsJoshua Krusell2021-02-131-4/+4
|
* 47997: Disable XTRACE around user-defined completion widgets.Bart Schaefer2021-02-111-0/+3
|
* 47895: Remove trailing spaces from "print -ac" output lines.Bart Schaefer2021-02-041-1/+1
|
* 47899: Improve error message from zparseopts.Joshua Krusell2021-02-031-1/+4
|
* 47744: Fix vi repeats with hooks in use.GammaFunction2021-01-271-0/+2
|
* 47840: make zpty module work on CygwinPeiyuan Song2021-01-201-0/+11
|
* 47704: fix scope for "private -p"Bart Schaefer2020-12-021-0/+4
|
* 47494, 47495: Add -n option to strftimeMikael Magnusson2020-10-251-2/+3
|
* 47301: Fix print -v metaficationJun-ichi Takimoto2020-10-251-1/+1
|
* Fix a race condition in zf_mkdir -pRoman Perepelitsa2020-10-231-9/+19
| | | | | | If ~/foo does not exist and `zf_mkdir -p zf_mkdir -p` is executed concurrently in multiple shells, it was possible prior to this patch for the command to fail with EEXIST.
* Unposted - fix commentBart Schaefer2020-09-131-1/+1
|
* 47364: Enable extendedglob in pattern with ${(*)name/pattern/replacement}Bart Schaefer2020-09-132-4/+16
| | | | Mikael Magnusson: 47382: Completion for 47364