1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-19 03:31:14 +02:00
Commit graph

425 commits

Author SHA1 Message Date
Barton E. Schaefer
4375d7b905 36562: sanitize $PWD on import, per POSIX 2015-09-19 23:03:39 -07:00
Barton E. Schaefer
07796811b0 cf. 36554: remove unnecessary pointer dereference 2015-09-19 09:34:05 -07:00
Barton E. Schaefer
18130bed7f 36552 plus test: fix Nularg string in quotestring(QT_DOLLARS) 2015-09-17 21:44:14 -07:00
Mikael Magnusson
cbe00216fe 36380: Avoid gcc case syntax 2015-09-01 23:18:17 +02:00
Barton E. Schaefer
3747f6b6ab 36376: handle signals during read1char() so it is possible to interrupt correct/correctall prompts 2015-09-01 11:26:06 -07:00
Peter Stephenson
61afb8dc8d 36262: Replace fix for missing unmeta in chdir().
It was needed in the argument to one of a pair of lchdir()s rather
than within zchdir().

Add tests for the case of a character with 0x83 within it.
2015-08-21 10:04:13 +01:00
Peter Stephenson
f8164fb647 36227: attempt to fix metafication problem with ztrftime.
fmt is treated as metafied on entry; use returned length to ensure
we metafy or output the correct length if there are embedded nulls.
2015-08-18 16:20:48 +01:00
Jun-ichi Takimoto
d09dc4562a 35928: '%-m' should work even if not supported by strftime(3)
Also clarify document.
2015-08-08 03:39:51 +09:00
Peter Stephenson
dd8079e041 35809: fix $((...)) completion by _expand widget.
This changes internal quoting of the form still including tokens
not to add unnecessary internal backslashes.
2015-07-25 21:36:54 +01:00
Peter Stephenson
bbd4cae6ad 35872: protect against NULL pointers in unmeta 2015-07-23 10:04:09 +01:00
Barton E. Schaefer
a1f8d4ffc7 35826: add getsparam_u() to return unmetafied string, use it for a number of references to non-special params 2015-07-22 12:52:24 -07:00
Mikael Magnusson
e402747dd6 35745: ztrftime: Pass everything unhandled to the system strftime() 2015-07-09 15:32:55 +02: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
Peter Stephenson
2abba7243a 35386: expand tabs where useful in builtins outputing function.
Also add to zed -f.

Option is -x <numm>.
2015-06-05 11:21:22 +01:00
Peter Stephenson
93e72ed1e9 35353: print -x and print -X expand tabs 2015-06-02 09:17:04 +01:00
Peter Stephenson
6269db883a 35067: Add (b) parameter flag for pattern char backslashing.
Doc tweak from Daniel in 35071.

Includes test.
2015-05-10 19:19:34 +01:00
Jun-ichi Takimoto
a6db0b41ca 35064: rename ISPRINT to ZISPRINT to avoid conflict 2015-05-09 16:02:37 +09:00
Jun-ichi Takimoto
4bc554bb8b 34636: replace broken isprint() on Mac OS X 2015-03-05 01:48:34 +09:00
Peter Stephenson
b237ba0a8e 34587: ensure multibyte characters don't overflow.
They could start incorporating tokens, with bad karma.

Add test.
2015-02-20 16:25:54 +00:00
Mikael Magnusson
dfbb5e4853 34466: Fix double unmeta in rm verification 2015-02-09 05:13:34 +01:00
Barton E. Schaefer
5751de7975 34403: refine 34399 to avoid settyinfo() when the input descriptor is not a TTY 2015-01-26 18:48:25 -08:00
Barton E. Schaefer
494c251cb0 34399: fix polltty thinko from 34365
Also add missing ChangeLog entry for 34365.
2015-01-25 16:07:49 -08:00
Peter Stephenson
4688de1677 34365: History lockfile backoff: randomised time.
Time doubles on each lock failure.

zsleep() provides microsecond resolution for sleep; uses nanosleep() if
available, else select via means of existing tty poll function.
2015-01-25 20:29:18 +00:00
Daniel Shahaf
f7a2fba534 34369: document error and warning codes 2015-01-25 18:08:29 +00:00
Peter Stephenson
ccd3663d4e 34383: ztrdup() should be dupstring() in new cd code 2015-01-25 18:03:20 +00:00
Peter Stephenson
12b813b589 34331: better handling of NULL in cd.
Problem was return from symbolic link expander in weird cases
where there file system isn't behaving itself properly.
2015-01-22 20:20:15 +00:00
Peter Stephenson
c6c9f5daf2 34322: bug with interface to parsestr() etc.
Was showing up in places like ${(e)...} where command substitution
could reallocate the token string, but actually there was never any
guarantee that the lexer wouldn't do that, so this was always
a bit iffy.
2015-01-18 22:38:57 +00:00
Mikael Magnusson
4701b05cf7 34138: wcs_nicechar: only deref widthp if it was given 2015-01-06 23:51:18 +01:00
Mikael Magnusson
c425cc9632 34108: Don't leak ifs stuff
Found by Coverity (Issue 1255785).
2015-01-06 23:51:00 +01:00
Peter Stephenson
98f465c09f 34092: fix miscount of symlink resolution for "..".
This caused problems with expanding a path with ".." in "whence -S".
2015-01-04 19:42:45 +00:00
Peter Stephenson
f9cba834cd 34091: typo with "whence -s" expansions 2015-01-04 19:05:39 +00:00
Peter Stephenson
33d1439fdb users/19667: whence -S shows intermediate steps in symlink expansion 2015-01-02 21:32:51 +00: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
Jun-ichi Takimoto
0a07ffd47c 33932: revise boundary check in unmeta() 2014-12-09 02:41:01 +09:00
Barton E. Schaefer
48cd1b6c3b 33894: boundary conditions in unmeta(), unmetafy()
Check that we aren't running off the end of the string when converting the
next byte after a Meta byte.  This is just defensive programming in case
of bad metafied strings coming through from gettokstr(), some repairs
there are likely still needed.
2014-12-07 11:20:01 -08:00
Oliver Kiddle
0d4b548d1e 33818: fix types passed to sizeof detected by coverity as being wrong 2014-11-30 23:19:55 +01:00
Peter Stephenson
a8927bf27b 33793: add 0b binary interpretation to integer constants 2014-11-26 17:26:58 +00:00
Peter Stephenson
c01a178ece Marc Finet: problems with working directory rationalisation.
Ensure the length of the directory is kept up to date.

Abort following symlinks as soon as there's an error.
2014-11-13 19:44:01 +00:00
Barton E. Schaefer
57252dc1e0 33320 (cf. PWS 33311): revert 33069, fix lexing of bangchar during completion
add typtab_flags bits (replaces specialcomma boolean) to record any unusual handling of typtab entries; signal safety; make bangchar non-special during completion lexing of the command line.
2014-10-02 08:39:43 -07:00
Barton E. Schaefer
4ba08eef7e Increase size of xbuf2 in xsymlinks to make gcc FORTIFY_SOURCE=2 happy. 2014-08-17 10:32:02 -07:00
Barton E. Schaefer
47d91c5fba 33012: add an error return value (-1) to xsymlinks() 2014-08-15 10:19:54 -07:00
Peter Stephenson
b79ef8caaf 32932: add hmkarray() and use to fix leak 2014-08-01 16:15:13 +01:00
Peter Stephenson
d3d0910293 32918: add %. to ztrftime for use in prompts 2014-07-30 12:10:15 +01:00
Nikolas Garofil
4f4d2b8247 32737, 32736 (32741), 32735, 32734, 32733, 32732 (32739): Strict compilation
fixes

	Src/utils.c: properly ifdef declarations
	Src/zsh_system.h: memmove() should return its dest argument
	Src/signals.c: define ret before use
	Src/mem.c: remove unused pointers
	Src/prototypes.h: use size_t in bcopy()
	Src/compat.c: fix const declaration inconsistency
2014-06-07 13:48:40 -07:00
Barton E. Schaefer
c41287b318 32716: properly test iconv return values for error conditions 2014-06-05 08:57:40 -07:00
Barton E. Schaefer
b3e5284f13 36526: when __APPLE__ is defined at compile, normalize Unicode filenames in zreaddir() 2014-06-02 07:26:50 -07:00
Tomoki Sekiyama
0da28f323d 32592: add CORRECT_IGNORE_FILE variable 2014-04-29 10:44:09 +01:00
Barton E. Schaefer
3e06aeabd8 32294: prevent buffer overflow when scanning very long directory paths for symbolic links 2014-01-19 19:39:31 -08:00
Barton E. Schaefer
5618116020 32061: Fix "use of uninitialized memory" in metafy 2013-11-27 22:09:48 -08:00
Barton E. Schaefer
b514fbe110 32023: better interrupt handling at RM_STAR_WAIT 2013-11-19 08:30:10 -08:00
Peter Stephenson
40a881569f 31650: use zlong for mailcheck parameters to ensure range 2013-08-11 20:19:53 +01:00
joe M
b9e16ac818 31648: fix timing errors in mailcheck 2013-08-10 19:48:13 +01:00
Bart Schaefer
d19e18c68d 31350: block SIGWINCH nearly all the time, except
when about to calculate prompts or do synchronous read, so
syscalls are not interrupted by window size changes.
2013-04-30 00:08:49 -07:00
Peter Stephenson
f73d92f5dc add missing mod_export 2012-12-16 18:43:24 +00:00
Peter Stephenson
e550c98d69 30647, 30649: allow underscores in numeric constants 2012-09-11 16:02:41 +00:00
Bart Schaefer
9af1cd4722 30530,30533: fix problems with COLUMNS or LINES < 1, and related issues 2012-06-27 07:10:29 +00:00
Peter Stephenson
cd1b5d86e0 users/17046: don't count too many elements when splitting quoted parameter
substitution on null parameter
2012-05-01 19:43:44 +00:00
Peter Stephenson
4f142f2794 30413: (q-) parameter flag should quote null string
(q-q) etc. should be treated as errors
2012-04-16 11:26:09 +00:00
Peter Stephenson
a76c8de44c 30351 + 30352: metafy strings on import into zsh variables 2012-03-13 09:47:01 +00:00
Peter Stephenson
86f8e8de69 30307 plus tweak suggsted by Wayne: use %lld for zlong when long long 2012-03-05 10:06:28 +00:00
Peter Stephenson
74eed99c31 29940: metafy() added null termination even if buffer was not modifiable 2011-12-03 23:15:37 +00:00
Bart Schaefer
7c5173ba0f users/16581: skip correction shortcut based on command table search when
the word is not in command position; on rejected command correction,
reset incremental path hashing.
2011-11-15 15:08:56 +00:00
Bart Schaefer
188abdd708 29799: swap order of RESET_PROMPT / REFRESH in adjustwinsize(). 2011-10-02 01:10:11 +00:00
Peter Stephenson
815e52cdbf users/16253, users/16255: a nulstring should be split like an empty string 2011-08-17 19:00:08 +00:00
Peter Stephenson
a3ae9f5d12 29643: set incompfunc to zero when executing hook or trap function 2011-08-04 08:30:50 +00:00
Peter Stephenson
45913f43e5 29561: Allow closing of fd's not recorded by the shell 2011-07-25 10:20:09 +00:00
Peter Stephenson
962624e8c3 29491: remove some variables set but not used 2011-06-19 16:26:10 +00:00
Peter Stephenson
d89361739a 29165: use term.h globally if needed at all. 2011-05-09 09:49:08 +00:00
Wayne Davison
9e0b7684e5 28977: fix copying of uninitialized memory when trying to
spell-correct a really long string.
2011-04-06 00:04:06 +00:00
Peter Stephenson
f2dca9e155 users/15864: turn zsh_directory_name into a hook 2011-03-11 16:32:07 +00:00
Peter Stephenson
6318e041d1 unposted: fix argument type for write_loop() 2011-01-06 21:31:06 +00:00
Bart Schaefer
87d6527628 28578: fix handling of numeric escapes that expand to "%" in printf
format strings, so they are not treated as format introducers.
2011-01-06 16:49:25 +00:00
Peter Stephenson
dd0ad1ac23 28568: buffer overflow examining paths 2011-01-05 18:22:08 +00:00
Peter Stephenson
a7bc22ca00 Paul 28538 / me 28540 / couple of unposted casts:
use char * for pointer arithmetic rather than void *
2010-12-20 10:28:43 +00:00
Peter Stephenson
c66f52bad9 Mikael: 28480: allow PROMPT_EOL_MARK to be an empty string 2010-12-06 19:34:32 +00:00
Peter Stephenson
2e37fda925 28559: flush shell output in PROMPT_SP handling 2010-11-27 17:13:29 +00:00
Wayne Davison
3f42b0a617 Use newer PROMPT_SP behavior for hasxn terms too. 2010-11-26 18:50:22 +00:00
Wayne Davison
d89e55fe0e Overwrite PROMPT_SP string if it should remain invisible,
even with an upcoming newline.
2010-11-25 17:16:27 +00:00
Peter Stephenson
cc9bc2dd0b 28424: new POSIX_STRINGS option 2010-11-22 11:42:47 +00:00
Peter Stephenson
bdb38058e4 28345: make ${(D)...} return a fully usable command line argument 2010-10-15 18:56:16 +00:00
Peter Stephenson
76aef28b31 28073: allow #! scripts to search path if interpreter not found 2010-07-15 18:44:12 +00:00
Peter Stephenson
64d431d98b 28025: (D) parameter flag 2010-06-11 20:08:01 +00:00
Peter Stephenson
147cedfb6f 27965, 27966: Improve ${(q)...}: newline appears as $'\n;, 2010-05-27 18:57:34 +00:00
Peter Stephenson
815cc9fc0d rationalise widths of non-printing characters to zero. 2010-03-27 19:04:35 +00:00
Peter Stephenson
43df0a21c0 27785: IFS doesn't have a null in it in POSIX
unposted: note & needs quoting in :s in glob qualifier
2010-03-11 22:38:58 +00:00
Peter Stephenson
bec3de98df 27754 plus NEWS change: add "zsystem flock" 2010-02-24 21:37:24 +00:00
Peter Stephenson
48315b019b unposted: add debug code to zclose() 2010-02-22 11:35:13 +00:00
Peter Stephenson
7977ce0747 27721: rationalise initialisation of file descriptors 2010-02-22 10:12:22 +00:00
Peter Stephenson
192c4f6ac1 27693: Missed this. 2010-02-09 14:24:01 +00:00
Wayne Davison
74d17bc282 Get rid of some "ignoring return value" compiler warnings
and provide read_loop() and write_loop() functions.
2009-12-16 18:38:44 +00:00
Peter Stephenson
512c62fc03 27503: fix crash with hook functions 2009-12-11 22:21:26 +00:00
Peter Stephenson
a92507d2b8 Mikael: 27337: fix bug searching for / when
scanning symlinks in cd
2009-11-03 10:00:34 +00:00
Peter Stephenson
500431077b Apple opensource patches suggested by Jun T. in 27300 2009-09-30 20:32:18 +00:00
Wayne Davison
2f8aaaf5e4 27286: Made movefd() return the targetfd on success. Added
a little more error checking in the callers of movefd().
2009-09-22 16:04:13 +00:00
Peter Stephenson
51409732d0 27284: better use of movefd() 2009-09-22 09:17:05 +00:00
Peter Stephenson
997eafdcad 27283: failure to dup fd caused mayhem 2009-09-21 20:49:21 +00:00
Peter Stephenson
ce4137c858 Eric Blake: 27109: don't attachtty() if not interactive 2009-07-09 20:20:53 +00:00
Peter Stephenson
2d628b0bce Eric Blake: 27109: don't attachtty() if not interactive 2009-07-09 20:20:30 +00:00
Peter Stephenson
aabd747d4f Eric Blake: 27109: don't attachtty() if not interactive 2009-07-09 19:50:58 +00:00
Peter Stephenson
506c845b25 Greg Klanderman: 27057: %e and %f time formats were swapped 2009-06-26 21:10:04 +00:00
Peter Stephenson
72529e4fa6 27304: add ${(q-)..} flag 2009-06-05 11:15:48 +00:00
Peter Stephenson
feb29659f1 users/14143 plus tweak in padding code:
use default IFS if IFS is unset
2009-05-20 09:04:39 +00:00
Peter Stephenson
1134e72a7a Greg Klanderman: 26972: fix problem ni 26964. 2009-05-19 08:41:16 +00:00
Peter Stephenson
a4106e0523 Greg Klanderman: 26964 (modified): PROMPT_EOL_MARK 2009-05-17 18:23:09 +00:00
Peter Stephenson
b148a56869 26806 (doc tweaked): Add CORRECT_IGNORE variable 2009-04-06 09:06:35 +00:00
Peter Stephenson
89d979e1bc 26774: cd to $HOME on failure in preference to / 2009-03-24 16:13:12 +00:00
Peter Stephenson
9defc9850d 26772: better error handling and fix runaway chdir on failed cd 2009-03-24 12:52:07 +00:00
Peter Stephenson
ee71aa006e 26769: fix finger trouble in 26767 2009-03-24 12:14:19 +00:00
Peter Stephenson
4b2ad07d39 26767: fix file descriptor leak in 26763 2009-03-23 10:58:56 +00:00
Peter Stephenson
28a809886d 26763: fix problem on failed cd -s to relative path 2009-03-20 22:52:56 +00:00
Peter Stephenson
249148d765 tidy up from 26625 2009-03-20 20:52:13 +00:00
Wayne Davison
bf25c3a43f 26735: Check some function return values for failures. Gets rid of
some compiler warnings, and improves error handling/notification.
2009-03-15 01:04:50 +00:00
Peter Stephenson
d60f73f708 26686: problem storing long $_ using VARARR() 2009-03-03 22:11:37 +00:00
Bart Schaefer
daa22bc46b 26665: Src/utils.c: fix one incorrect test in 26614. 2009-03-03 05:22:57 +00:00
Peter Stephenson
4dbe63360d Lionel Flandrin: 26625: inopportune interrupt wrecked terminal set up 2009-03-02 10:21:37 +00:00
Peter Stephenson
535afe3b2a 26614 + 26615: history -t <fmt> plus ztrftime "-" format modifier 2009-03-02 10:11:45 +00:00
Peter Stephenson
64d011185a 26583: use HOOK_FUNCTIONS more widely 2009-02-19 10:12:37 +00:00
Peter Stephenson
d388995eed 26249: remove arbitrary string length limit in unmeta() 2009-01-05 21:56:53 +00:00
Peter Stephenson
94b39fe195 26095: compilation error if TIOCGWINSZ not defined 2008-11-27 17:05:42 +00:00
Peter Stephenson
25833cc89e 25969: two bugs with metafication plus a test for one 2008-10-30 15:34:18 +00:00
Peter Stephenson
176e0dc821 25963: Interrupt at spell check prompt output garbage 2008-10-30 14:04:30 +00:00
Peter Stephenson
337530b4d6 25930: dynamic directory expansion memory handling was screwy 2008-10-24 10:27:25 +00:00
Peter Stephenson
28cf4041b4 25771: shell function context for substitution functions 2008-09-29 15:18:49 +00:00
Peter Stephenson
e6dec182d0 25761: Mikael Magnusson: newline in getquery() 2008-09-27 23:14:58 +00:00
Peter Stephenson
b2d08a2155 25744: dynamic named directories and further doshfunc() simplification 2008-09-26 09:11:27 +00:00
Peter Stephenson
2920c227d3 25677: add %x and %I prompt escapes for shell source code debugging
tidy up interface to doshfunc()
2008-09-16 15:02:01 +00:00
Peter Stephenson
2853ca830a 25247 with further modifications: add $funcsourcetrace 2008-08-11 19:22:54 +00:00
Peter Stephenson
0c9830d23c 25345, 25347: neaten interface from main shell to zle 2008-07-31 08:44:16 +00:00
Peter Stephenson
0409391c7d 25272: add zshaddhistory hook 2008-07-17 11:27:55 +00:00
Peter Stephenson
4f7cf022b6 users/13036: "." is a valid character in a user name 2008-07-15 15:23:10 +00:00
Peter Stephenson
7453337589 25259: improve getquery() handling of unhandled characters 2008-07-01 08:36:01 +00:00
Peter Stephenson
1c29f641c6 Mikael: 25143: spelling corrections
25144: report supported bases
25139: fix number
2008-06-10 08:50:35 +00:00
Peter Stephenson
c894f695cc 25095: thorough modernization of prompt theme system 2008-05-17 22:42:16 +00:00
Peter Stephenson
8ab895baf0 25057: better debug error on memory failure 2008-05-17 17:55:37 +00:00
Peter Stephenson
02e0a4755f 25040: zpty should display context information more like eval 2008-05-15 15:50:57 +00:00
Peter Stephenson
b86c191af5 25025: check radix for integer constants is between 2 and 36 inclusive 2008-05-14 10:48:26 +00:00
Peter Stephenson
bd70d684fc 25002: only ZLE should update attributes resulting from prompt expansion 2008-05-12 13:50:42 +00:00
Peter Stephenson
2cec7aae44 24861 (with tweaks): logic to use alternative wcwidth() if needed;
slightly improve test for overwriting with combining characters.
2008-04-22 15:08:04 +00:00
Peter Stephenson
5a0c547e91 24856: add IS_COMBINING() and IS_BASECHAR() and widen tests 2008-04-21 11:49:55 +00:00
Peter Stephenson
b8ec06c870 24853: use metafied strings for inner loops over history 2008-04-20 21:17:29 +00:00
Peter Stephenson
72bd9ee6d9 24825: fix internal word-boundary widgets 2008-04-17 12:52:13 +00:00
Peter Stephenson
97dcf15556 24808: initial support for combining characters in zle 2008-04-13 16:58:42 +00:00
Peter Stephenson
567a8e1d50 24712: handling of backticks being requoted for double quotes 2008-03-14 12:14:04 +00:00
Peter Stephenson
4ff6e11df2 24609: try to be safe about using libiconv 2008-02-27 11:46:26 +00:00
Peter Stephenson
e21bd541a2 24600: yet another typo
24602: fix test when not run
2008-02-26 20:50:11 +00:00
Geoff Wing
3934b6d621 another fatfinger: change comparison to asignment 2008-02-26 17:53:31 +00:00
Geoff Wing
a1cca48d0f pws fatfingered the last change in utils.c 2008-02-26 17:49:31 +00:00
Peter Stephenson
4c7bb13f63 24596: use "US-ASCII" as charset if nl_langinfo(CODESET) returns "" or "646" 2008-02-26 16:19:33 +00:00
Peter Stephenson
f674ea76d2 24592: make types of charset conversion failure more explicit 2008-02-26 14:50:00 +00:00
Peter Stephenson
b5570971ef 24460: make zpty -rt more consistent by polling before every byte 2008-01-25 16:48:22 +00:00