fish-shell/src
ridiculousfish 162053ed8d Make history file rewriting be more lock savvy
We now are stingier with taking history file locks - if the lock
is held too long we may just break it. But the current file save
architecture holds the lock for the duration of the save. It also
has some not-quite-right checks that can cause spurious failures in
the history stress test.

Reimplement the history save to retry. Rather than holding the lock,
rewrite the file to a temporary location and then take the lock. If
the history file has changed, start all over.

This is going to be slower under contention, but the advantage is that
the lock is only held for a brief period (stat + rename) rather than
across calls to write().

Some updated logic also fixes spurious failures that were easy to observe
when tsan was enabled. These failures were due to failing to check if the
file at the path was the same file we opened.

The next step is to move the history file saving to a background thread
to reduce the chances of it impacting user's typing.
2017-02-06 11:04:07 -08:00
..
autoload.cpp Remove support for the builtin_script_t feature 2017-01-29 21:34:30 -08:00
autoload.h Remove support for the builtin_script_t feature 2017-01-29 21:34:30 -08:00
builtin_commandline.cpp Adopt owning_lock in builtin_commandline 2017-01-29 18:15:38 -08:00
builtin_commandline.h restyle builtin modules to match project style 2016-04-26 21:58:59 -07:00
builtin_complete.cpp don't warn about using obsolete complete options 2017-01-09 11:21:34 -08:00
builtin_complete.h restyle builtin modules to match project style 2016-04-26 21:58:59 -07:00
builtin_jobs.cpp Switch a job's process list from a linked list to a vector of pointers 2017-01-23 09:28:34 -08:00
builtin_jobs.h restyle builtin modules to match project style 2016-04-26 21:58:59 -07:00
builtin_printf.cpp switch from \1xb to \e in the code 2016-12-24 12:15:28 -08:00
builtin_printf.h restyle builtin modules to match project style 2016-04-26 21:58:59 -07:00
builtin_set_color.cpp time for another make style-all 2017-01-26 20:05:46 -08:00
builtin_set_color.h restyle builtin modules to match project style 2016-04-26 21:58:59 -07:00
builtin_set.cpp improve converting strings to ints/longs 2016-11-25 18:52:15 -08:00
builtin_set.h restyle builtin modules to match project style 2016-04-26 21:58:59 -07:00
builtin_string.cpp Use unique_ptr in string_replace() 2017-01-21 15:47:12 -08:00
builtin_string.h restyle builtin modules to match project style 2016-04-26 21:58:59 -07:00
builtin_test.cpp time for another make style-all 2017-01-26 20:05:46 -08:00
builtin_test.h restyle builtin modules to match project style 2016-04-26 21:58:59 -07:00
builtin_ulimit.cpp improve converting strings to ints/longs 2016-11-25 18:52:15 -08:00
builtin_ulimit.h restyle builtin modules to match project style 2016-04-26 21:58:59 -07:00
builtin.cpp Make a missing --sets-mode property for a key binding do nothing 2017-02-05 02:49:45 -08:00
builtin.h use consistent mechanism to validate var names 2016-11-22 16:18:20 -08:00
color.cpp Improve compatibility with 0-16 color terminals. 2016-07-24 17:02:29 -07:00
color.h time for another make style-all 2017-01-26 20:05:46 -08:00
common.cpp Revert "Adopt owning_lock and some cleanup of termsize storage in common.cpp" 2017-01-29 19:33:30 -08:00
common.h Introduce owning_lock template 2017-01-29 18:15:38 -08:00
complete.cpp Make autoload_t no longer virtual 2017-01-29 18:56:55 -08:00
complete.h Remove --authoritative leftovers from complete 2016-12-20 17:16:08 -08:00
env_universal_common.cpp Add #include<atomic> to env_universal_common.cpp 2017-01-30 13:41:17 -08:00
env_universal_common.h time for another make style-all 2017-01-26 20:05:46 -08:00
env.cpp cache prompts and escape sequences we've seen 2017-02-05 18:31:14 -08:00
env.h time for another make style-all 2017-01-26 20:05:46 -08:00
event.cpp time for another make style-all 2017-01-26 20:05:46 -08:00
event.h Clean up event_t handling 2017-01-21 16:48:07 -08:00
exec.cpp time for another make style-all 2017-01-26 20:05:46 -08:00
exec.h Make IWYU output in lint.cpp less messy 2016-06-23 17:26:08 -07:00
expand.cpp time for another make style-all 2017-01-26 20:05:46 -08:00
expand.h Make IWYU output in lint.cpp less messy 2016-06-23 17:26:08 -07:00
fallback.cpp time for another make style-all 2017-01-26 20:05:46 -08:00
fallback.h Enable mkostemp to be weak-linked 2017-01-08 22:18:27 -08:00
fish_indent.cpp convert narrow stderr output to wide forms 2017-01-03 16:14:42 -08:00
fish_key_reader.cpp normalize use of stdio functions taking a stream 2017-01-13 20:48:55 -08:00
fish_tests.cpp Make history file rewriting be more lock savvy 2017-02-06 11:04:07 -08:00
fish_version.cpp restyle fish modules to match project style 2016-04-30 19:52:13 -07:00
fish_version.h restyle fish modules to match project style 2016-04-30 19:52:13 -07:00
fish.cpp remove unnecessary signal management 2017-01-14 20:51:54 -08:00
function.cpp Make autoload_t no longer virtual 2017-01-29 18:56:55 -08:00
function.h implement means to learn about a functions source 2017-01-20 21:48:41 -08:00
highlight.cpp Use std::move instead of swap in a few places where it improves clarity 2017-01-26 16:14:50 -08:00
highlight.h Change clients of file_detection_context_t to use lambdas 2017-01-26 09:40:17 -08:00
history.cpp Make history file rewriting be more lock savvy 2017-02-06 11:04:07 -08:00
history.h Make history file rewriting be more lock savvy 2017-02-06 11:04:07 -08:00
input_common.cpp Make fire_event_callback take a std::function instead of function pointer 2017-01-21 17:15:45 -08:00
input_common.h time for another make style-all 2017-01-26 20:05:46 -08:00
input.cpp Make a missing --sets-mode property for a key binding do nothing 2017-02-05 02:49:45 -08:00
input.h Make IWYU output in lint.cpp less messy 2016-06-23 17:26:08 -07:00
intern.cpp Clean up and adopt owning_lock in intern.cpp 2017-01-29 21:19:39 -08:00
intern.h restyle intern module to match project style 2016-05-01 20:28:46 -07:00
io.cpp Make io_buffer_t::create return a shared_ptr 2017-01-22 00:44:04 -08:00
io.h Make io_buffer_t::create return a shared_ptr 2017-01-22 00:44:04 -08:00
iothread.cpp Adopt owning_lock in iothread.cpp 2017-01-29 21:06:46 -08:00
iothread.h time for another make style-all 2017-01-26 20:05:46 -08:00
kill.cpp fix random lint issues 2016-05-29 22:24:29 -07:00
kill.h restyle kill module to match project style 2016-05-01 22:18:59 -07:00
lru.h Add sanity checking to LRU cache 2017-01-30 12:59:01 -08:00
output.cpp time for another make style-all 2017-01-26 20:05:46 -08:00
output.h Stop swallowing the cartesian product 2016-07-24 17:56:34 -07:00
pager.cpp Defeat some miscellaneous warnings in the g++ build 2017-01-26 17:33:48 -08:00
pager.h time for another make style-all 2016-12-03 20:12:53 -08:00
parse_constants.h convert narrow stderr output to wide forms 2017-01-03 16:14:42 -08:00
parse_execution.cpp time for another make style-all 2017-01-26 20:05:46 -08:00
parse_execution.h Eliminate moved_ref 2017-01-26 15:43:46 -08:00
parse_productions.cpp convert narrow stderr output to wide forms 2017-01-03 16:14:42 -08:00
parse_productions.h use enum_map for parser enums 2016-11-11 18:56:56 -08:00
parse_tree.cpp time for another make style-all 2017-01-26 20:05:46 -08:00
parse_tree.h time for another make style-all 2017-01-26 20:05:46 -08:00
parse_util.cpp Defeat some miscellaneous warnings in the g++ build 2017-01-26 17:33:48 -08:00
parse_util.h Make IWYU output in lint.cpp less messy 2016-06-23 17:26:08 -07:00
parser_keywords.cpp fix some style bogosities that crept in 2016-05-27 14:44:30 -07:00
parser_keywords.h Make IWYU output in lint.cpp less messy 2016-06-23 17:26:08 -07:00
parser.cpp time for another make style-all 2017-01-26 20:05:46 -08:00
parser.h time for another make style-all 2017-01-26 20:05:46 -08:00
path.cpp Use std::move instead of swap in a few places where it improves clarity 2017-01-26 16:14:50 -08:00
path.h Make IWYU output in lint.cpp less messy 2016-06-23 17:26:08 -07:00
postfork.cpp Make job_get_flag and job_set_flag instance methods of jobs 2017-01-26 15:06:58 -08:00
postfork.h workaround glibc bug that can corrupt malloc arena 2016-12-14 20:12:37 -08:00
print_help.cpp lint: "collapsible if statements" warnings 2016-10-22 19:09:40 -07:00
print_help.h restyle proc module to match project style 2016-05-02 22:07:58 -07:00
proc.cpp Adopt owning_lock for job_ids 2017-01-29 18:15:38 -08:00
proc.h Make job_get_flag and job_set_flag instance methods of jobs 2017-01-26 15:06:58 -08:00
reader.cpp time for another make style-all 2017-01-26 20:05:46 -08:00
reader.h correct handling of SIGHUP by interactive fish 2017-01-24 15:24:13 -08:00
sanity.cpp improve sanity check code 2017-01-24 15:24:13 -08:00
sanity.h improve sanity check code 2017-01-24 15:24:13 -08:00
screen.cpp cache prompts and escape sequences we've seen 2017-02-05 18:31:14 -08:00
screen.h cache prompts and escape sequences we've seen 2017-02-05 18:31:14 -08:00
signal.cpp Add a SIGALRM handler that does nothing 2017-01-21 14:07:54 -08:00
signal.h remove unnecessary signal management 2017-01-14 20:51:54 -08:00
tokenizer.cpp Use std::move instead of swap in a few places where it improves clarity 2017-01-26 16:14:50 -08:00
tokenizer.h Make IWYU output in lint.cpp less messy 2016-06-23 17:26:08 -07:00
utf8.cpp lint: constant if expression 2016-10-29 19:01:19 -07:00
utf8.h Fix wide char related tests on Cygwin 2016-05-26 20:24:03 -07:00
util.cpp improve converting strings to ints/longs 2016-11-25 18:52:15 -08:00
util.h restyle remaining modules to match project style 2016-05-03 16:09:45 -07:00
wcstringutil.cpp fix some style bogosities that crept in 2016-05-27 14:44:30 -07:00
wcstringutil.h Be a bit more consistent and proper. 2016-06-05 21:32:57 -07:00
wgetopt.cpp lint: Use early exit/continue 2016-10-31 13:29:10 -07:00
wgetopt.h Restyle touched .cpp files 2016-06-12 11:34:35 -07:00
wildcard.cpp time for another make style-all 2016-12-03 20:12:53 -08:00
wildcard.h Make IWYU output in lint.cpp less messy 2016-06-23 17:26:08 -07:00
wutil.cpp Make file_id_for_fd return kInvalidFiledID when passed a negative fd 2017-02-06 10:01:33 -08:00
wutil.h add unsigned long long variant to fish_wcsto* 2016-12-20 16:40:12 -08:00