| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
| |
With the previous (and now fallback) version of checkptycmd(), doing
this:
zpty foo 'while read; do echo hi; done'
zpty (or zpty -t foo)
would hang forever, which seems counterintuitive to the purpose of
listing processes (or testing if a process is running).
|
| | |
|
| |
|
|
| |
Some compilers warn if a label immediately precedes a variable declaration.
|
| |
|
|
| |
This lets us remove these mysterious braces too.
|
| |
|
|
| |
Combinations of options can remain invalid, though.
|
| | |
|
| |
|
|
|
|
|
|
| |
This one is complicated by the fact it's using fprintf. If the user
passed a nonprintable char as an option, we shouldn't print that, which
nicechar handles for us.
Fixes 54077.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A lot of places check option strings char by char, then send that char
to zwarn/zerr, instead of reading out the full multibyte character.
Doing so is quite easy with unmeta_one in most cases, so just go ahead
and do that. The print functions in fact expect a wchar_t for %c anyway.
Also renames "unknown option" to "bad option" because that's what every
other place calls it (also one place was missing the colon, added that).
To reproduce the math errors, since it's slightly less obvious (you need
a multibyte character that is also an invalid parameter name, otherwise
it actually works fine)
% zsh -c '(( ¯ ))'
zsh:1: bad math expression: illegal character: ^
% zsh -c 'zmodload zsh/mathfunc; (( sin(1¯) ))'
zsh:1: bad math expression: illegal character: ^
% zsh -c 'の=5; echo $(( の ))' # unchanged because it is working
5
Also adds some tests because B12 was looking very empty, not sure if
this is the correct way to handle the intersection of possibly not
compiled module with possibly not available UTF-8 locale, but X02 and
some others do a similar thing with ZSH_TEST_LANG, though in those cases
that's handled specially by comptest, not the test itself.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
% bindkey T foo
% zle -N foo
% foo() { emulate -L ksh; () { zle -M ${.sh.edchar} } }
% zmodload zsh/ksh93
% [press T twice]
\M-(\M-^Ak\M-<\M-G^?
or alternatively, emulate ksh in the main shell and just define this,
but then you have to make sure you're in a zsh -f shell so random things
aren't entering functions in the background.
% foo() { zle -M ${.sh.edchar} }
the code tries to restore sh_edchar = sh_unsetval; in the else branch,
but this doesn't ever run in the above scenario because we never enter
or leave a function with ksh emulation enabled (or indeed at all).
|
| |
|
|
|
| |
After 54475 changed deleteparamdef to use getnode2 instead, this
workaround isn't needed anymore.
|
| |
|
|
| |
Tweaked to account for workers/54328
|
| |
|
|
|
|
|
|
|
|
| |
I'm not sure how I messed this up in 54558, but now it should be
actually correct. I even tested it:
% [[ foo = (#m)(#b)f(o)o ]]
% zmodload -F zsh/ksh93 p:.sh.match
% () { setopt localoptions ksharrays; typeset -p .sh.match }
typeset -g -ar .sh.match=( foo o )
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When this is used, libraries only needed by specific modules will only
be linked to those modules (currently libgdbm and libpcre2). When
--enable-cap is used, the main shell also uses libcap functions so we
want to link that either way.
Speaking of the cap module, it did some weird thing where it always
compiles but creates useless builtins that only error, which means you
can't rely on zmodload to check if they'll work. I'm sure someone will
complain about me changing this but I'm going to at least try it and see
if someone has a good reason for it.
The gdbm module also has a big ifdef for the whole module, but instead
of dummy builtins it just does #error, so remove that. We won't try to
compile it if the user didn't ask for it, and if the user asked for it
and it wouldn't compile, configure won't create a Makefile. Using the
ac_cv_ cache variables in db_gdbm.mdd also doesn't actually work
properly, those will remain set and enable the module to be linked after
you pass --disable-gdbm and you will get the aforementioned #error. Use
the enable_gdbm variable instead, like pcre.mdd does (and also cap.mdd
now that I evilly made it conditional on --enable-cap).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While the documentation for the zsh/parameter module does state
The zsh/parameter module gives access to some of the internal hash tables
and
commands
This array gives access to the command hash table.
, the latter entry does *also* say
values are the pathnames of the files that would be executed when
the command would be invoked.
Change getpmcommand to always do a lookup via findcmd() if it the entry
is not found in the hash and HASHLISTALL is unset. This will indirectly
respect HASHCMDS and add the single entry if it is set, look it up in
the hash if it was added and then HASHCMDS was unset, etc.
|
| | |
|
| |
|
|
| |
the behaviour in the original patch was not actually desirable
|
| |
|
|
| |
+ NEWS update
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Not closing a %( would simply read garbage memory
% zformat -f result 'before%(a-after' 'a:hello' ; echo $result
beforeaftera:hello
% zformat -f result 'before%(a-after' 'a:hello' ; echo $result
beforeafter#
It was possible to overwrite the %% and %) sequences with arbitrary
text, and %% was also undocumented. Hopefully nobody relied on this
spacekey heater.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
zsh% zselect 2023
==2815== Syscall param select(exceptfds) points to uninitialised byte(s)
==2815== at 0x4DDA2D6: select (in /lib64/libc-2.32.so)
==2815== by 0x4885937: bin_zselect (zselect.c:175)
==2815== by 0x410C5E: execbuiltin (builtin.c:506)
==2815== by 0x43A5FC: execcmd_exec (exec.c:4259)
==2815== by 0x433BE1: execpline2 (exec.c:2040)
==2815== by 0x432824: execpline (exec.c:1765)
==2815== by 0x431A7D: execlist (exec.c:1515)
==2815== by 0x4310E3: execode (exec.c:1296)
==2815== by 0x457D15: loop (init.c:223)
==2815== by 0x45C151: zsh_main (init.c:1933)
==2815== by 0x40FD61: main (main.c:93)
==2815== Address 0x1ffeffe5b0 is on thread 1's stack
==2815== in frame #1, created by bin_zselect (zselect.c:66)
zselect: error on select: bad file descriptor
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
checkptycmd would sign extend a 0xff byte to -1, causing the byte to be
dropped, read into an unsigned char instead
the "last despairing effort" code read directly into the int, which
would probably not work on big endian. read into a temporary unsigned
char instead
the FIONREAD path used a totally undeclared variable "val", declare it,
and also initialize pollret to -1 for this path
the USE_CYGWIN_FIX path error message would always report -1 as the fd
it was unable to duplicate, report the original fd instead
initial read before the main loop in ptyread forgot to metafy the byte
avoid calling malloc with 0 length as this may be misinterpreted as oom
don't try to open sfd if opening mfd failed
|
| |
|
|
|
| |
And also make sure metafy won't write outside the buffer, it can in
theory become twice as long, so use half the buffer size at most.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ideally, these should just be unmetafy()d and passed to ncurses, but the
reality is that ncurses will just segfault if we do that when the user
passes a non-ascii value.
% echo $terminfo[らしりれ]
zsh: segmentation fault
% echotc れりの
zsh: segmentation fault
The tparm values do seem to work fine with multibyte strings, so do
unmetafy() for those.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
% echo $(( zrand_int(4294967295) ))
zsh: Upper bound (4294967295) out of range: 0-4294967295
3910196459
read loop had incorrect condition as well as passing negative status
codes on to the pointer arithmetic
clz64 shifted by 1 bit instead of 2
remove incorrect comment (it applies to the case where max is 1, which
is not very interesting)
and some minor stuff
|
| |
|
|
| |
behavior
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
use strtol, not strtod
use WEXITSTATUS on returned status, though I'm not sure when this path
can actually be taken?
don't abort getting group names just because one name is missing
storing ${(kv)parameters} in a copy and then reading that wouldn't say
what type a nameref pointed to
setting multiple options via options=( foo on ) didn't verify the option
name before trying to set it, reporting it as a failure to set it instead
|
| |
|
|
|
|
| |
Adding a test for this is not trivial since tccolours is set directly
from a termcap lookup, and is specifically documented in the code as
"may not be set".
|
| |
|
|
|
|
|
| |
If (#m) was not active, the getsparam("MATCH") is always NULL,
terminating the whole array. Copying zsh_match into *ap didn't advance
the pointer, NULL terminating the pointer again. The array length was
one short (MATCH in front and NULL terminator means it should be +2).
|
| |
|
|
|
| |
In practice, name is always ascii so this is all no-op anyway, but just
in case someone models code on this, make it less likely to confuse them.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
% typeset -A .zle.hlgroups
% zmodload -i zsh/hlgroup
% : ${.zle.hlgroups[select]}
% print ${(k).zle.esc}
zsh: segmentation fault
Also add check on !hlg too for paranoia, not sure if that can actually
happen, but getgroup has the same check.
|
| |
|
|
| |
This allows using more than 256 color pairs.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
mouseinterval returns the old mouse interval, not a ok/err status.
mousemask returns 0 on failure
zccmd_bg called wattron/off directly for attributes, instead of storing
them in the ch variable being passed to wbkgd so they weren't actually
applied to the background.
remove some extra 0 being passed to zwarnnam, and change one from
zerrnam.
fix a leak of w->children when deleting windows.
check return value from mbrtowc and wctomb correctly.
store attrs correctly in non-multibyte path.
return error from zcurses position when given an invalid parameter name.
if init_pair fails, retry with the same number next time.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
The flags parameter is always 0 so the precedence mistake doesn't
actually matter.
Attributes are quite unlikely to be over 2GB in length, but use the
correct types.
The module is load=no so the autofeatures isn't used, but be consistent
and list all builtins in the mdd file.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Coverity CID 1692322 in Src/glob.c:
i'm pretty sure this is a false positive so add a debug message just in case
Coverity CID 1500752 in Src/Zle/compresult.c:
remove unused assignment that also reads uninitialized pointer p
And two that were just near other things it complained about
Src/utils.c:
Warn if maildir disappeared from under us
Src/Modules/system.c:
stray \n in zwarn message
Src/subst.c:
Use DIGBUFSIZE for buf holding digits
This one would be a little hard to overflow in practice, you'd need a
parameter at least 100000000000000 characters long, which is 100TB.
|
| |
|
|
|
|
|
| |
This was originally marked as a false positive because the allocation
was done with PAT_STATIC; when that was later changed to PAT_ZDUP to
avoid problems with signal handlers stomping on the memory, apparently
this cleanup path was missed.
|
| | |
|
| |
|
|
|
|
|
|
| |
The freesession function randomly clearing the current session instead
of the passed section is probably not great.
The h_errno definition is repeated just above identically, which I would
assume is a compile time error for anyone who has USE_LOCAL_H_ERRNO set.
|
| |
|
|
|
| |
This lets you close tcp connections without losing data. Updating
zshtcpsys is left as an exercise for someone else.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the passed name was too long, it was silently truncated. If it was
exactly the max length, the string was not nul terminated.
% zsocket -l aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
==421== Syscall param socketcall.bind(my_addr.sun_path) points to uninitialised byte(s)
==421== at 0x4DD77D7: bind (in /lib64/libc-2.32.so)
==421== by 0x61FB31A: bin_zsocket (in /usr/local/lib64/zsh/5.9.0.3-test-mika/zsh/net/socket.so)
==421== by 0x4217BF: execbuiltin (in /usr/local/bin/zsh)
==421== by 0x433751: execcmd_exec (in /usr/local/bin/zsh)
==421== by 0x433D2B: execpline2 (in /usr/local/bin/zsh)
==421== by 0x434084: execpline (in /usr/local/bin/zsh)
==421== by 0x4359F8: execlist (in /usr/local/bin/zsh)
==421== by 0x4362A1: execode (in /usr/local/bin/zsh)
==421== by 0x44F7A1: loop (in /usr/local/bin/zsh)
==421== by 0x450AAD: zsh_main (in /usr/local/bin/zsh)
==421== by 0x4D01E69: (below main) (in /lib64/libc-2.32.so)
==421== Address 0x1ffeffd7ad is on thread 1's stack
==421== in frame #1, created by bin_zsocket (???:)
|
| | |
|