Commit Graph

155 Commits (master)

Author SHA1 Message Date
Oliver Kiddle 57248b8883 52750: remove ansi2knr support for old pre-ansi K&R compilers 2 months ago
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
7 months ago
Oliver Kiddle a73c705b0c 51212: remove STOUC() macro
This served as a workaround for ancient compilers where casts to
unsigned char were broken.
1 year ago
Jun-ichi Takimoto 41b402d36d 51080: allow multibyte chars in glob qualifier (u:uname:) 1 year ago
Bart Schaefer ebad5f8164 49994: Single-byte equivalence of users/22601 and workers/40891 2 years ago
Bart Schaefer b80d160039 49991: single-byte brace expansion handles $'\0' and control character output aligns with multibyte 2 years ago
Bart Schaefer c77cdb27db 49955: Src/glob.c: fix bad free in incremental-pattern-search matching 2 years ago
Mikael Magnusson 3bf95b91f0 49870: Fix NULL reference in match code more
This reverts "49658: Fix NULL reference in match code." and adds a check
inside the block, as well as a failsafe check at the end.

The above commit (49658) causes a crash due to ll being calculated as
0 which leads to rr being an invalid pointer. Only adding a check for
when ll is 0 just leads to bck-i-search pattern not working at all (the
final hunk).  Restoring the condition and adding an explicit NULL check
for replstr seems to make matters work as intended.
2 years ago
Peter Stephenson 7f240e6aa9 49658: Fix NULL reference in match code.
A test when acquiring the replacement pattern match in the globbing
code erroneously allowed the use of a NULL pointer.  This appears to
be an unnecessary test case added alongside other surgery back in 2008.
2 years ago
Daniel Shahaf edc04bd946 45291: A glob with a trailing slash will now match unreadable/unexecutable directories. 4 years ago
Daniel Shahaf b591d43113 45181: Fix workers/45164: ${(S)%%} will now consider the empty string as a potential match. 4 years ago
Peter Stephenson 273d669a56 45001: Fix zero-length matches with ${...%...}
As the shortest match is preferred, zero-length matches beat any other.
5 years ago
Martijn Dekker c578f0a08b 45004: Fix typos in comments 5 years ago
Peter Stephenson b8dc5a7f6d 44435: Handling digita arguments for :h and :t.
Pick number of leading or trailing path components to substitute.
Active in history, brace parameters, glob qualifiers.

Add tests for all three environments.
5 years ago
Daniel Shahaf 3d7215cc82 43091: In the (u) glob qualifier, expand and correct "unknown user" error messages. 6 years ago
Dima Kogan 487489c522 stat() for glob qualifiers lost information in corner case 7 years ago
Peter Stephenson a3b3f00575 41420: "{.." wasn't check for brace expansion properly 7 years ago
Peter Stephenson e78ec8610d 40891: fix more zero-length matches.
This time at the end of the trial string.
7 years ago
Peter Stephenson 086656241c 22601: Fix for parameter substitution pattern matches.
It was not possible to math against a zero-length string in
some cases.
7 years ago
Peter Stephenson adab02817f 40819: Fix IS_DASH test in BRACE_CCL handling 7 years ago
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.
7 years ago
Barton E. Schaefer e51c9c17af 40453: signal handler safety for callers of patcompile(PAT_STATIC), which is not re-entrant. 7 years ago
Eitan Adler 110ffae9fe 40035: Cosmetic fixes for comments and documentation.
Mostly fixes to doubled words.
8 years ago
Peter Stephenson a62e1640bc 39958: Add extra byte to PATH_MAX allocations.
This ensures we've got enough space for a null, although this
isn't always needed.
8 years ago
Peter Stephenson 39ae9cd10a 39723: metafy string passed to pattern in complist.
Also additional safety tokenizing a string with Meta characters.
8 years ago
Peter Stephenson 895e9beb29 users/21793: Remove raw integers as glob qualifiers.
There was an ancient undocumented feature that these were treated
as a file mode to "or" with that of the file under test.  The
only documented way of doing this has always been the "f" qualifier,
so removed the effect of raw integers to make errors more obvious.
8 years ago
Peter Stephenson 317494e998 38853: use strchr() 8 years ago
Peter Stephenson 72e5fe7aab 38879: Unmetafy file names for glob sort.
Test using Polish UTF-8 collation sequence that'w known to
cause the problems.
8 years ago
Jun-ichi Takimoto a4020e10a3 37868: add 'static' to file local variables 8 years ago
Peter Stephenson c2b6bd51f9 37693: turn Dash into '-' in glob qualifiers 8 years ago
Peter Stephenson ad16356e19 37689: ! and ^ need to be tokenised in character sets 8 years ago
Peter Stephenson 8eb9070d67 37678: Now possible to quote "-" in pattern range 8 years ago
Barton E. Schaefer b4643fce2d 37483: save and possibly restore cshnullglob failure state around each evaluation of an (e:...:) glob qualifier. 9 years ago
Peter Stephenson 830d54e629 37092: make nested ${(P)name} properly refer to parameter on return 9 years ago
Peter Stephenson 58f4cccb1f 37022: add GLOB_STAR_SHORT option to abbreviate ** and *** 9 years ago
Peter Stephenson 5336587307 36711: Allocate unmetafied pattern trial string on the heap 9 years ago
Barton E. Schaefer a5a6c58ff8 unposted: fix typo in comment. 9 years ago
Peter Stephenson d07783628e 36700: unmetafy early for parameter match 9 years ago
Peter Stephenson f9d7651c25 36682: expand pattern interface to optimise unmetafication 9 years ago
Mikael Magnusson bd5806aa0a 36603: glob: fix dirfd leak during Y shortcut qualifier 9 years ago
Jun-ichi Takimoto 8b1676e3b7 36491: Multibyte support for parameter expansion flags B,E,N 9 years ago
Peter Stephenson c0df3440a4 36264: glob and pattern variable pathbuf is metafied.
Document this and unmetafy it when passing to system calls, including
lchdir() which is a system-level interface.
9 years ago
Barton E. Schaefer 45424e735d 36084: use zrealloc() consistently 9 years ago
Barton E. Schaefer df5f825538 36033: a few more queue_signals() to protect global state changes 9 years ago
Peter Stephenson f1923bdfa6 Add non-metafied character length handling.
Use this in regex module and add test using $'\ua0'.

Rename mb_metacharinit() to mb_charinit() as it does not involve
metafied characters.
9 years ago
Barton E. Schaefer fae07f65a3 34965: consistent use of zalloc/zrealloc/zfree 9 years ago
Barton E. Schaefer 1fa68938dc 34837: avoid loss of original file path when applying colon-modifiers in glob qualifiers 9 years ago
Barton E. Schaefer 628d2f4f8a 34634: avoid infinite recursion on (/)# extendedglob 9 years ago
Peter Stephenson d067ebcacd 33876: etc.: Separate errors and keyboards interrupts
Combination of 12 commits from interrupt_abort branch.

Basic strategy is to introduce bits to errflag and to set and
reset them separately.

Remove interrupt status on return to main keymap.

Turn off ERRFLAG_INT for always block.

Restore bit thereafter: we probably need a new variable in order
to allow user interrupts to be reset in the always block.

Add TRY_BLOCK_INTERRUPT

This works the same as TRY_BLOCK_ERROR, but for a SIGINT, too.

Ensure propagation of SIGINT from exited job.

If received by foreground job, shell uses ERRFLAG_INT, not
ERRFLAG_ERROR, to set the new state.

Reset errflag before precmd()

Add always block in _main_completion to fix ZLS_COLORS

Ensures we get the right state of $ZLS_COLORS at the end of _main_complete
even if there's an interrupt.  However, the "right state" is a bit messy
as it depends on styles.
10 years ago
Barton E. Schaefer 9ddd022ff0 33854: errors end recursion through scanner()
Makes **/ more easily interruptible
10 years ago