1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-23 04:51:12 +02:00
Commit graph

184 commits

Author SHA1 Message Date
Barton E. Schaefer
4414e54ea7 33116: followup to 32580 to prevent double-locking with shared or incremental history 2014-09-06 22:10:30 -07:00
Barton E. Schaefer
b63ff19dbf 32882 (cf. Augie Fackler 32879): correct reload of backslash-continuation lines from history, fix bad history write of events ending with backslashes 2014-07-17 19:53:11 -07:00
Peter Stephenson
7f6dc0fe8e 32682 with tweaks: Add INC_APPEND_HISTORY_TIME.
Revert INC_APPEND_HISTORY behaviour.
2014-06-06 21:56:47 +01:00
Barton E. Schaefer
979f72199f 32580: avoid indefinite wait in lockhistfile() by checking for lock file time stamp in the future
Also change behavior of HIST_FCNTL_LOCK to use only fcntl() locking, rather
than applying both kinds of lock.
2014-04-25 08:30:18 -07:00
Barton E. Schaefer
f61037a0b0 32531: fix memory leaks detected by valgrind 2014-04-06 09:55:49 -07:00
Barton E. Schaefer
ff520d1b79 31823: add HISTORY_IGNORE parameter
HISTORY_IGNORE defines a pattern to exclude matching lines in the internal
history from the HISTFILE at write time.
2013-10-17 07:28:52 -07:00
Peter Stephenson
73ececfd01 31830: New feature for zshaddhistory hooks.
If the first non-zero return status is 2, save the line on the
internal history list, but don't write it out.
2013-10-17 10:14:25 +01:00
Peter Stephenson
d0fe73c5fb 31815: another fix for INCAPPENDHISTORY change.
We need to save immediately if something is pushed on the history stack
to ensure we use the right file before popping.
2013-10-11 11:13:03 +01:00
Barton E. Schaefer
8ffdf161c7 31797: to match documentation, avoid expanding history when there is neither a
word nor an event designator

There are still a few cases where expansion is attempted even though the
documentation indicates it will not be, but in most of those cases the
expansion will fail.  The now-fixed case would fall back to default
expansion of the previous command.
2013-10-08 07:21:29 -07:00
Peter Stephenson
6f195241f3 31794: further refinement to INCAPPENDHISTORY change.
With SHAREHISTORY we should make sure the code behaves as it always
did, because it takes care about locking a file once for reading
and writing.
2013-10-07 13:01:26 +01:00
Peter Stephenson
9345e57859 31793: Fix problem with non-interactive history.
Modify 31789 so it doesn't try to save history from hbegin()
in that case.
2013-10-07 11:43:55 +01:00
Han Pingtian
16ff79a885 31789: Save history for INCAPPENDHISTORY later.
This improves the timing recorded in the history.
2013-10-05 22:03:43 +01:00
Barton E. Schaefer
98b0828c63 31770: memmove() instead of memcpy() for overlapping regions. 2013-09-26 21:24:58 -07:00
Peter Stephenson
0b185e3dcd users/17908: Keep history line in sync between ZLE and shell.
Update ZLE version if history is read, pushed or popped with ZLE active
2013-08-08 19:48:11 +01:00
Peter Stephenson
e282fd8ecb 31750: fix for HISTREDUCEBLANKS option.
Don't truncate line after marked words if there's more
non-white-space text, which is probably comments.
2013-07-24 15:54:55 +01:00
Peter Stephenson
7c56d77184 30789: Add CONTINUE_ON_ERROR for old behaviour.
New behaviour is for scripts to exit on error instead of returning
to top level and executing the next command.
2012-11-15 21:08:15 +00:00
Bart Schaefer
19fe2dcc03 30433: double backslash is not line continuation. 2012-04-21 18:42:56 +00:00
Peter Stephenson
fe7337447c Timothy Redaelli: file name manipulations
in history can return NULL if HAVE_CANONICALIZE_FILE_NAME
2012-02-08 09:35:17 +00:00
Bart Schaefer
f7111d3358 29694: avoid overwriting current history word when not expanding an alias
or history event in-place.
2011-08-18 02:24:10 +00:00
Mikael Magnusson
d0366e1960 unposted: fix a typo in a comment. 2011-08-14 14:16:45 +00:00
Peter Stephenson
5c3c825e5f users/16131: skip reading empty history file 2011-07-18 18:13:03 +00:00
Peter Stephenson
a05a51ce8a 29542: fix crash in hbegin(), remove bad test
29543: fix backslash-newline within words with histlexwords
2011-07-12 08:37:11 +00:00
Peter Stephenson
12e246495c 29413: "print -S" for saving to history with lexical word split 2011-06-03 19:54:43 +00:00
Peter Stephenson
31456074c8 histlexwords splitting of ";;" in case 2011-05-27 21:56:09 +00:00
Mikael Magnusson
72cb7cfc6f 29307, 29308 + replies: Fix some doubled words in docs and comments. 2011-05-19 16:10:46 +00:00
Peter Stephenson
ebcead7543 lexsave/lexrestore lexflags
add new LEXFLAGS_ZLE
2010-12-14 10:35:38 +00:00
Peter Stephenson
eab4f9a83c 28528: Rearrange zleparse to lexflags
Add (z+n+)
2010-12-14 09:59:04 +00:00
Peter Stephenson
0a5702457b 28510: add (z+c+) and (z+C+) parameter flags 2010-12-12 22:44:50 +00:00
Peter Stephenson
af5a85f363 28339: backslash-newline history without HIST_LEX_WORDS
28340: assignment to range of scalar variable with multibyte characters
2010-10-10 17:51:29 +00:00
Peter Stephenson
6fea7f0d3c 28332: backslash-newline with HIST_LEX_WORDS 2010-10-10 17:26:38 +00:00
Peter Stephenson
1cdaf8c459 28327: fix pseudolexical word splitting with RC_QUOTES 2010-10-07 16:49:50 +00:00
Peter Stephenson
92c826555d not yet posted: fix some more HIST_LEX_WORDS anomalies 2010-10-06 13:07:43 +00:00
Peter Stephenson
8aac69241f 28319: (z) splitting oddities 2010-10-06 08:27:09 +00:00
Peter Stephenson
66f32a80dc 28308/28310: HIST_LEX_WORDS, check for quick history read 2010-10-02 21:03:03 +00:00
Peter Stephenson
5ca08eccd0 28295 plus tweak: use lexer to split words from history file 2010-09-25 18:49:36 +00:00
Peter Stephenson
e3f764d1ef 28047: attempt to make locking with fc command more useful 2010-06-22 11:00:31 +00:00
Peter Stephenson
c2fdffa316 27823: fix memory access in 27822 2010-03-22 23:20:11 +00:00
Peter Stephenson
08dec290d4 Fix ZLE access to pushed history line 2010-03-22 16:22:13 +00:00
Wayne Davison
6e317e4b96 Add symlink-based hist-file locking. 2009-12-18 19:50:45 +00:00
Peter Stephenson
fff4f63b97 27216: set chwords to NULL when freed 2009-08-16 20:37:44 +00:00
Peter Stephenson
3e1e46e9d2 26748: c modifier to add command path 2009-03-23 12:17:32 +00:00
Peter Stephenson
06e22c9370 Bart: 26761: typo in realpath() check 2009-03-20 10:36:06 +00:00
Peter Stephenson
cb6856d115 26754: tweak zgetdir() and test for realpath() 2009-03-19 15:00:18 +00:00
Peter Stephenson
9e1a3e6d06 26752: fix ../ removal and metafication in :a and :A modifers 2009-03-18 19:38:38 +00:00
Peter Stephenson
7733ade831 Michael Hwang: 26731 with cosmetic changes: add "a" and "A" modifiers
26736: document the above
2009-03-15 01:17:05 +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
7c302e129f print message if we give up trying to crate a lock file with hard links 2009-03-10 14:23:15 +00:00
Peter Stephenson
3b88638729 26602: history substitution buffer could overflow with no test 2009-02-25 10:30:14 +00:00
Peter Stephenson
fed941ce24 26091: crash at end of history line if history not in use 2008-11-25 18:39:04 +00:00
Peter Stephenson
f559052cc2 Rocky Bernstein: 25696: fix crash on empty history. 2008-09-22 08:46:53 +00:00
Peter Stephenson
e4d3ee06b3 25682: terminate history line before passing to zshaddhistory hook 2008-09-18 09:42:44 +00:00
Clint Adams
b62584cbcd 25639: free ptr2 if hsubl is NULL. 2008-09-10 19:02:11 +00:00
Clint Adams
bd915064c3 25610: remove dead code. 2008-09-04 22:27:59 +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
Wayne Davison
c9006a06a3 Only call close(flock_fd) if flock_fd is >= 0. 2008-05-05 14:29:03 +00:00
Wayne Davison
f7b2570e15 Locking simplification and signed/unsigned fixes. 2008-05-05 01:14:04 +00:00
Peter Stephenson
c8b6d1a239 24872: revert to original patch 2008-04-26 19:45:54 +00:00
Peter Stephenson
31ca309299 Jun T. 24872 + 24873: capitalization with combining characters 2008-04-26 18:17:29 +00:00
Peter Stephenson
78ce07b49f 24818: add HIST_FCNTL_LOCK.
unposted: update NEWS with new features
2008-04-17 10:23:45 +00:00
Peter Stephenson
5eb7948f86 24814: suspicious handling of temporary history buffer 2008-04-14 13:42:51 +00:00
Peter Stephenson
e9b11fa9f0 unposted: make test for added space in 24699 safer 2008-03-11 10:00:38 +00:00
Peter Stephenson
25413054c1 24699: bug with ${(Q)...} on initial ">"
bug with ${(z)...} on string with unterminated "("
2008-03-08 01:20:49 +00:00
Wayne Davison
697d170928 History file-handling improvments. 2008-03-06 17:23:00 +00:00
Bart Schaefer
15e8fe245d 24324: do not set ftim when re-entering the history mechanism for string
substitution.
2007-12-31 23:14:17 +00:00
Peter Stephenson
3c75ea5de5 23736: status for file save wasn't initialised 2007-08-01 21:52:35 +00:00
Peter Stephenson
9534c89981 23585: handle errno properly in history save errors 2007-06-23 18:15:14 +00:00
Peter Stephenson
63eaea2238 23581: handle errors writing history file better 2007-06-22 20:32:19 +00:00
Peter Stephenson
9471bbcfa0 22934, modified, see 22937: add HIST_SUBST_PATTERN option
make ${.../#%...} anchor at both ends
2006-11-01 12:25:18 +00:00
Peter Stephenson
6157c14d06 22525: lengths and cases of multibyte strings in parameters and history 2006-06-28 13:12:55 +00:00
Peter Stephenson
dd5602f59b 22474: use variable argument lists to improve error message handling 2006-05-30 22:35:03 +00:00
Wayne Davison
4cb83571c4 Changed some structures to avoid gcc's type-punned warnings. 2006-03-07 21:30:36 +00:00
Wayne Davison
78168105de Two changes in the HIST_SAVE_BY_COPY code: (1) preserve the group
and permissions on the history file, and (2) fail if zsh's euid
differs from the file's uid (since that would change the history
file's owner).
2005-12-17 07:58:12 +00:00
Peter Stephenson
325f9c5dea users/9618, modified: :G for global substution modifier 2005-11-04 16:20:32 +00:00
Peter Stephenson
2a888b3d5a c.f. 21590: metafy_line()/unmetafy_line() now support wide characters 2005-08-10 10:56:40 +00:00
Wayne Davison
bb738368ba Honor the setting of the new HISTSAVEBYCOPY option when rewriting
the history file.
2005-03-18 22:40:28 +00:00
Clint Adams
0038b1a682 * 2073x: Src/Zle/zle_utils.c, Src/hist.c: modify zlegetline() and zlegetline
caller so that the octet-based and wide-character versions should return
   the same string.
2005-01-22 04:03:05 +00:00
Peter Stephenson
88a37cc187 c.f. 20675: improve zle as a basis for Unicode.
unposted: update version to 4.2.3-dev-1
2005-01-14 13:04:47 +00:00
Wayne Davison
3ccc3e4bdc Use the new gettempfile() function. 2004-10-21 00:33:50 +00:00
Wayne Davison
945a40f7e6 - Improved lockhistfile() to use the new gettempname() for a unique
filename instead of a .PID suffix.
- Use bicat() to build the $HISTFILE.LOCK filename.
- Put the $HOST value into $HISTFILE.LOCK in addition to the PID.
2004-10-18 19:07:30 +00:00
Wayne Davison
89eb92d8c2 - Added an arg to saveandpophiststack() to allow the caller to
specify what flags to send to savehistfile().
- Implemented the HFILE_NO_REWRITE support in savehistfile().
2004-10-01 19:48:53 +00:00
Peter Stephenson
6b1dc0f701 20331: Use internal zlong variables for consistency
20332: Add WIDGETSTYLE zle parameter
2004-09-09 10:12:42 +00:00
Wayne Davison
fb0937a69e Marked unused parameters with the new UNUSED() macro. 2004-06-02 22:14:25 +00:00
Wayne Davison
3e7b092bc7 - pushhiststack() now takes a level value and remembers it. If it was
the locallevel (instead of -1), the history list is marked to auto-pop
  on function exit.
- The saveandpophiststack() function now interprets a 0 arg as a request
  to do an auto-pop.
2004-05-21 20:05:12 +00:00
Wayne Davison
e8eca2ee4b - Added functions to push and pop the current history list, allowing
functions to more easily switch to their own private history.
- Changed the existing history push/pop code in savehistfile() (which
  uses a separate history buf to allow it to rewrite the on-disk
  version of the history file without disturbing the in-memory list).
2004-05-20 22:23:02 +00:00
Wayne Davison
319af86611 Added a comment to resizehistents() to explain why the function is
weirder than expected at first glance.
2004-05-18 18:45:05 +00:00
Wayne Davison
1ec2b5c096 Fix the potential for an infinite loop in lockhistfile() if the
link() calls fails for some other reason than EEXIST.
2004-05-11 21:45:36 +00:00
Peter Stephenson
815bc92148 a la 19209: zcalloc -> zshcalloc 2003-10-29 19:17:30 +00:00
Peter Stephenson
e65a811520 18941: history wrong after parse error during alias expansion 2003-08-11 13:19:48 +00:00
Peter Stephenson
98307b767c 17318: ${(z)...} added an extra space when the lexical analyser failed. 2002-06-14 17:52:05 +00:00
Wayne Davison
cbc7abb006 Added "savehistsiz" (for the new SAVEHIST special parameter), and used it
in place of getiparam("SAVEHIST").
2002-03-24 23:52:47 +00:00
Wayne Davison
663c6e794a In putoldhistentryontop(), ensure that we can't return with "next" set to
the value we just put on top.
2002-02-22 20:40:29 +00:00
Wayne Davison
cfcf7bda8d Yet another fix for prepnexthistent(). 2002-02-20 19:25:14 +00:00
Wayne Davison
3b3bafac80 Fixed a just-introduced bug in prepnexthistent() when curline is in
the list.
2002-02-18 19:25:25 +00:00
Wayne Davison
d35af383df When savehistfile() rewrites the history file, there was a potential for
losing the entire history file if we couldn't lock the file for reading
(it timed out) but we could lock the file for write (and wrote nothing).
2002-02-16 09:21:34 +00:00
Wayne Davison
e706f12937 Optimized putoldhistentryontop() so that when resizehistents() calls it
repeatedly while HIST_EXPIRE_DUPS_FIRST is set, it doesn't re-scan the
already-checked hist items (avoiding potentially slow operation).
2002-02-16 09:15:07 +00:00
Wayne Davison
c24a38cdaa Improved resizehistents() so that it honors HISTEXPIREDUPSFIRST. 2002-02-13 18:13:14 +00:00
Clint Adams
7dea9669bb 16577: don't return a single dot as the path head of a slash. 2002-02-06 16:48:28 +00:00
Wayne Davison
c1b837b152 Improved readhistline() to reject binary data better. (16184) 2001-10-26 23:47:10 +00:00
Wayne Davison
34c4e565d0 Fix HIST_NO_SPACE when INTERACTIVE_COMMENTS is set and we get a
comment.
2001-10-15 18:42:52 +00:00