Oliver Kiddle
57248b8883
52750: remove ansi2knr support for old pre-ansi K&R compilers
2024-03-18 20:02:34 +01: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
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
41b402d36d
51080: allow multibyte chars in glob qualifier (u:uname:)
2022-12-02 19:34:55 +09:00
Bart Schaefer
ebad5f8164
49994: Single-byte equivalence of users/22601 and workers/40891
2022-04-05 09:10:45 -07:00
Bart Schaefer
b80d160039
49991: single-byte brace expansion handles $'\0' and control character output aligns with multibyte
2022-04-04 14:21:50 -07:00
Bart Schaefer
c77cdb27db
49955: Src/glob.c: fix bad free in incremental-pattern-search matching
2022-04-04 09:14:59 -07:00
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.
2022-03-30 08:07:39 +02:00
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.
2021-12-21 10:31:26 +00:00
Daniel Shahaf
edc04bd946
45291: A glob with a trailing slash will now match unreadable/unexecutable directories.
2020-01-15 19:20:33 -06:00
Daniel Shahaf
b591d43113
45181: Fix workers/45164: ${(S)%%} will now consider the empty string as a potential match.
2020-01-02 16:00:11 +00:00
Peter Stephenson
273d669a56
45001: Fix zero-length matches with ${...%...}
...
As the shortest match is preferred, zero-length matches beat any other.
2019-12-12 10:23:47 +00:00
Martijn Dekker
c578f0a08b
45004: Fix typos in comments
2019-12-11 02:37:39 +00:00
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.
2019-06-20 11:13:05 +01:00
Daniel Shahaf
3d7215cc82
43091: In the (u) glob qualifier, expand and correct "unknown user" error messages.
2018-06-25 11:18:41 +00:00
Dima Kogan
487489c522
stat() for glob qualifiers lost information in corner case
2017-11-20 09:59:51 +00:00
Peter Stephenson
a3b3f00575
41420: "{.." wasn't check for brace expansion properly
2017-07-13 17:20:24 +01:00
Peter Stephenson
e78ec8610d
40891: fix more zero-length matches.
...
This time at the end of the trial string.
2017-03-23 21:01:59 +00:00
Peter Stephenson
086656241c
22601: Fix for parameter substitution pattern matches.
...
It was not possible to math against a zero-length string in
some cases.
2017-03-23 09:35:20 +00:00
Peter Stephenson
adab02817f
40819: Fix IS_DASH test in BRACE_CCL handling
2017-03-10 10:43:25 +00: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
e51c9c17af
40453: signal handler safety for callers of patcompile(PAT_STATIC), which is not re-entrant.
2017-01-29 08:30:14 -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
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.
2016-11-17 19:49:17 +00:00
Peter Stephenson
39ae9cd10a
39723: metafy string passed to pattern in complist.
...
Also additional safety tokenizing a string with Meta characters.
2016-10-25 11:53:49 +01:00
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.
2016-07-28 09:51:19 +01:00
Peter Stephenson
317494e998
38853: use strchr()
2016-07-20 09:45:37 +01:00
Peter Stephenson
72e5fe7aab
38879: Unmetafy file names for glob sort.
...
Test using Polish UTF-8 collation sequence that'w known to
cause the problems.
2016-07-18 16:57:38 +01:00
Jun-ichi Takimoto
a4020e10a3
37868: add 'static' to file local variables
2016-02-03 01:25:33 +09:00
Peter Stephenson
c2b6bd51f9
37693: turn Dash into '-' in glob qualifiers
2016-01-19 17:38:59 +00:00
Peter Stephenson
ad16356e19
37689: ! and ^ need to be tokenised in character sets
2016-01-19 17:24:12 +00:00
Peter Stephenson
8eb9070d67
37678: Now possible to quote "-" in pattern range
2016-01-19 09:55:46 +00:00
Barton E. Schaefer
b4643fce2d
37483: save and possibly restore cshnullglob failure state around each evaluation of an (e:...:) glob qualifier.
2016-01-01 19:20:14 -08: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
58f4cccb1f
37022: add GLOB_STAR_SHORT option to abbreviate ** and ***
2015-10-30 12:28:07 +00:00
Peter Stephenson
5336587307
36711: Allocate unmetafied pattern trial string on the heap
2015-09-30 10:19:16 +01:00
Barton E. Schaefer
a5a6c58ff8
unposted: fix typo in comment.
2015-09-29 13:36:43 -07:00
Peter Stephenson
d07783628e
36700: unmetafy early for parameter match
2015-09-29 19:47:21 +01:00
Peter Stephenson
f9d7651c25
36682: expand pattern interface to optimise unmetafication
2015-09-28 20:31:51 +01:00
Mikael Magnusson
bd5806aa0a
36603: glob: fix dirfd leak during Y shortcut qualifier
2015-09-24 20:52:56 +02:00
Jun-ichi Takimoto
8b1676e3b7
36491: Multibyte support for parameter expansion flags B,E,N
2015-09-12 20:35:56 +09:00
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.
2015-08-21 15:17:18 +01:00
Barton E. Schaefer
45424e735d
36084: use zrealloc() consistently
2015-08-10 12:55:56 -07:00
Barton E. Schaefer
df5f825538
36033: a few more queue_signals() to protect global state changes
2015-08-09 17:37:23 -07:00
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.
2015-06-12 09:30:39 +01:00
Barton E. Schaefer
fae07f65a3
34965: consistent use of zalloc/zrealloc/zfree
2015-04-25 12:40:35 -07:00
Barton E. Schaefer
1fa68938dc
34837: avoid loss of original file path when applying colon-modifiers in glob qualifiers
2015-04-03 09:55:11 -07:00
Barton E. Schaefer
628d2f4f8a
34634: avoid infinite recursion on (/)# extendedglob
2015-02-27 10:10:19 -08:00
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.
2014-12-11 09:41:17 +00:00
Barton E. Schaefer
9ddd022ff0
33854: errors end recursion through scanner()
...
Makes **/ more easily interruptible
2014-12-07 11:20:01 -08:00