mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-27 03:13:37 +08:00
Convert debug(0) calls to FLOG
This commit is contained in:
parent
6282ac5713
commit
ea9d1ad82f
|
@ -66,6 +66,7 @@
|
|||
#include "complete.h"
|
||||
#include "exec.h"
|
||||
#include "fallback.h" // IWYU pragma: keep
|
||||
#include "flog.h"
|
||||
#include "intern.h"
|
||||
#include "io.h"
|
||||
#include "parse_constants.h"
|
||||
|
@ -469,7 +470,7 @@ proc_status_t builtin_run(parser_t &parser, int job_pgid, wchar_t **argv, io_str
|
|||
return proc_status_t::from_exit_code(ret);
|
||||
}
|
||||
|
||||
debug(0, UNKNOWN_BUILTIN_ERR_MSG, argv[0]);
|
||||
FLOGF(error, UNKNOWN_BUILTIN_ERR_MSG, argv[0]);
|
||||
return proc_status_t::from_exit_code(STATUS_CMD_ERROR);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "env.h"
|
||||
#include "expand.h"
|
||||
#include "fallback.h" // IWYU pragma: keep
|
||||
#include "flog.h"
|
||||
#include "future_feature_flags.h"
|
||||
#include "global_safety.h"
|
||||
#include "proc.h"
|
||||
|
@ -2121,8 +2122,8 @@ int create_directory(const wcstring &d) {
|
|||
}
|
||||
|
||||
[[gnu::noinline]] void bugreport() {
|
||||
debug(0, _(L"This is a bug. Break on 'bugreport' to debug."));
|
||||
debug(0, _(L"If you can reproduce it, please report: %s."), PACKAGE_BUGREPORT);
|
||||
FLOG(error, _(L"This is a bug. Break on 'bugreport' to debug."));
|
||||
FLOG(error, _(L"If you can reproduce it, please report: "), PACKAGE_BUGREPORT, '.');
|
||||
}
|
||||
|
||||
wcstring format_size(long long sz) {
|
||||
|
@ -2314,24 +2315,24 @@ bool is_main_thread() {
|
|||
|
||||
void assert_is_main_thread(const char *who) {
|
||||
if (!is_main_thread() && !thread_asserts_cfg_for_testing) {
|
||||
debug(0, "%s called off of main thread.", who);
|
||||
debug(0, "Break on debug_thread_error to debug.");
|
||||
FLOGF(error, "%s called off of main thread.", who);
|
||||
FLOGF(error, "Break on debug_thread_error to debug.");
|
||||
debug_thread_error();
|
||||
}
|
||||
}
|
||||
|
||||
void assert_is_not_forked_child(const char *who) {
|
||||
if (is_forked_child()) {
|
||||
debug(0, "%s called in a forked child.", who);
|
||||
debug(0, "Break on debug_thread_error to debug.");
|
||||
FLOGF(error, "%s called in a forked child.", who);
|
||||
FLOGF(error, "Break on debug_thread_error to debug.");
|
||||
debug_thread_error();
|
||||
}
|
||||
}
|
||||
|
||||
void assert_is_background_thread(const char *who) {
|
||||
if (is_main_thread() && !thread_asserts_cfg_for_testing) {
|
||||
debug(0, "%s called on the main thread (may block!).", who);
|
||||
debug(0, "Break on debug_thread_error to debug.");
|
||||
FLOGF(error, "%s called on the main thread (may block!).", who);
|
||||
FLOGF(error, "Break on debug_thread_error to debug.");
|
||||
debug_thread_error();
|
||||
}
|
||||
}
|
||||
|
@ -2342,8 +2343,8 @@ void assert_is_locked(void *vmutex, const char *who, const char *caller) {
|
|||
// Note that std::mutex.try_lock() is allowed to return false when the mutex isn't
|
||||
// actually locked; fortunately we are checking the opposite so we're safe.
|
||||
if (mutex->try_lock()) {
|
||||
debug(0, "%s is not locked when it should be in '%s'", who, caller);
|
||||
debug(0, "Break on debug_thread_error to debug.");
|
||||
FLOGF(error, "%s is not locked when it should be in '%s'", who, caller);
|
||||
FLOGF(error, "Break on debug_thread_error to debug.");
|
||||
debug_thread_error();
|
||||
mutex->unlock();
|
||||
}
|
||||
|
@ -2436,10 +2437,10 @@ void redirect_tty_output() {
|
|||
/// Display a failed assertion message, dump a stack trace if possible, then die.
|
||||
[[noreturn]] void __fish_assert(const char *msg, const char *file, size_t line, int error) {
|
||||
if (error) {
|
||||
debug(0, L"%s:%zu: failed assertion: %s: errno %d (%s)", file, line, msg, error,
|
||||
std::strerror(error));
|
||||
FLOG(error, L"%s:%zu: failed assertion: %s: errno %d (%s)", file, line, msg, error,
|
||||
std::strerror(error));
|
||||
} else {
|
||||
debug(0, L"%s:%zu: failed assertion: %s", file, line, msg);
|
||||
FLOG(error, L"%s:%zu: failed assertion: %s", file, line, msg);
|
||||
}
|
||||
show_stackframe(L'E', 99, 1);
|
||||
abort();
|
||||
|
|
|
@ -904,7 +904,7 @@ bool completer_t::complete_param(const wcstring &cmd_orig, const wcstring &popt,
|
|||
}
|
||||
};
|
||||
|
||||
// debug(0, L"\nThinking about looking up completions for %ls\n", cmd.c_str());
|
||||
// FLOG(error, L"\nThinking about looking up completions for %ls\n", cmd.c_str());
|
||||
bool head_exists = builtin_exists(cmd);
|
||||
// Only reload environment variables if builtin_exists returned false, as an optimization
|
||||
if (head_exists == false) {
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "event.h"
|
||||
#include "fallback.h" // IWYU pragma: keep
|
||||
#include "fish_version.h"
|
||||
#include "flog.h"
|
||||
#include "global_safety.h"
|
||||
#include "history.h"
|
||||
#include "input.h"
|
||||
|
@ -139,7 +140,7 @@ void fix_colon_delimited_var(const wcstring &var_name, env_stack_t &vars) {
|
|||
std::replace(newstrs.begin(), newstrs.end(), empty, wcstring(L"."));
|
||||
int retval = vars.set(var_name, ENV_DEFAULT | ENV_USER, std::move(newstrs));
|
||||
if (retval != ENV_OK) {
|
||||
debug(0, L"fix_colon_delimited_var failed unexpectedly with retval %d", retval);
|
||||
FLOG(error, L"fix_colon_delimited_var failed unexpectedly with retval %d", retval);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1351,8 +1352,8 @@ wcstring env_get_runtime_path() {
|
|||
}
|
||||
|
||||
if (!uname || check_runtime_path(tmpdir.c_str()) != 0) {
|
||||
debug(0, L"Runtime path not available.");
|
||||
debug(0, L"Try deleting the directory %s and restarting fish.", tmpdir.c_str());
|
||||
FLOG(error, L"Runtime path not available.");
|
||||
FLOG(error, L"Try deleting the directory %s and restarting fish.", tmpdir.c_str());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "env.h"
|
||||
#include "env_universal_common.h"
|
||||
#include "fallback.h" // IWYU pragma: keep
|
||||
#include "flog.h"
|
||||
#include "path.h"
|
||||
#include "utf8.h"
|
||||
#include "util.h" // IWYU pragma: keep
|
||||
|
@ -195,11 +196,11 @@ static bool append_file_entry(env_var_t::env_var_flags_t flags, const wcstring &
|
|||
|
||||
// Append variable name like "fish_color_cwd".
|
||||
if (!valid_var_name(key_in)) {
|
||||
debug(0, L"Illegal variable name: '%ls'", key_in.c_str());
|
||||
FLOG(error, L"Illegal variable name: '%ls'", key_in.c_str());
|
||||
success = false;
|
||||
}
|
||||
if (success && !append_utf8(key_in, result, storage)) {
|
||||
debug(0, L"Could not convert %ls to narrow character string", key_in.c_str());
|
||||
FLOG(error, L"Could not convert %ls to narrow character string", key_in.c_str());
|
||||
success = false;
|
||||
}
|
||||
|
||||
|
@ -210,7 +211,7 @@ static bool append_file_entry(env_var_t::env_var_flags_t flags, const wcstring &
|
|||
|
||||
// Append value.
|
||||
if (success && !append_utf8(full_escape(val_in), result, storage)) {
|
||||
debug(0, L"Could not convert %ls to narrow character string", val_in.c_str());
|
||||
FLOG(error, L"Could not convert %ls to narrow character string", val_in.c_str());
|
||||
success = false;
|
||||
}
|
||||
|
||||
|
@ -447,7 +448,8 @@ bool env_universal_t::write_to_fd(int fd, const wcstring &path) {
|
|||
std::string contents = serialize_with_vars(vars);
|
||||
if (write_loop(fd, contents.data(), contents.size()) < 0) {
|
||||
const char *error = std::strerror(errno);
|
||||
debug(0, _(L"Unable to write to universal variables file '%ls': %s"), path.c_str(), error);
|
||||
FLOG(error, _(L"Unable to write to universal variables file '%ls': %s"), path.c_str(),
|
||||
error);
|
||||
success = false;
|
||||
}
|
||||
|
||||
|
@ -462,8 +464,8 @@ bool env_universal_t::move_new_vars_file_into_place(const wcstring &src, const w
|
|||
int ret = wrename(src, dst);
|
||||
if (ret != 0) {
|
||||
const char *error = std::strerror(errno);
|
||||
debug(0, _(L"Unable to rename file from '%ls' to '%ls': %s"), src.c_str(), dst.c_str(),
|
||||
error);
|
||||
FLOG(error, _(L"Unable to rename file from '%ls' to '%ls': %s"), src.c_str(), dst.c_str(),
|
||||
error);
|
||||
}
|
||||
return ret == 0;
|
||||
}
|
||||
|
@ -525,7 +527,7 @@ bool env_universal_t::open_temporary_file(const wcstring &directory, wcstring *o
|
|||
|
||||
if (!success) {
|
||||
const char *error = std::strerror(saved_errno);
|
||||
debug(0, _(L"Unable to open temporary file '%ls': %s"), out_path->c_str(), error);
|
||||
FLOG(error, _(L"Unable to open temporary file '%ls': %s"), out_path->c_str(), error);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
@ -587,7 +589,8 @@ bool env_universal_t::open_and_acquire_lock(const wcstring &path, int *out_fd) {
|
|||
}
|
||||
#endif
|
||||
const char *error = std::strerror(errno);
|
||||
debug(0, _(L"Unable to open universal variable file '%ls': %s"), path.c_str(), error);
|
||||
FLOG(error, _(L"Unable to open universal variable file '%ls': %s"), path.c_str(),
|
||||
error);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1058,7 +1061,7 @@ class universal_notifier_shmem_poller_t : public universal_notifier_t {
|
|||
int fd = shm_open(path, O_RDWR | O_CREAT, 0600);
|
||||
if (fd < 0) {
|
||||
const char *error = std::strerror(errno);
|
||||
debug(0, _(L"Unable to open shared memory with path '%s': %s"), path, error);
|
||||
FLOG(error, _(L"Unable to open shared memory with path '%s': %s"), path, error);
|
||||
errored = true;
|
||||
}
|
||||
|
||||
|
@ -1068,8 +1071,8 @@ class universal_notifier_shmem_poller_t : public universal_notifier_t {
|
|||
struct stat buf = {};
|
||||
if (fstat(fd, &buf) < 0) {
|
||||
const char *error = std::strerror(errno);
|
||||
debug(0, _(L"Unable to fstat shared memory object with path '%s': %s"), path,
|
||||
error);
|
||||
FLOG(error, _(L"Unable to fstat shared memory object with path '%s': %s"), path,
|
||||
error);
|
||||
errored = true;
|
||||
}
|
||||
size = buf.st_size;
|
||||
|
@ -1079,7 +1082,8 @@ class universal_notifier_shmem_poller_t : public universal_notifier_t {
|
|||
bool set_size = !errored && size < (off_t)sizeof(universal_notifier_shmem_t);
|
||||
if (set_size && ftruncate(fd, sizeof(universal_notifier_shmem_t)) < 0) {
|
||||
const char *error = std::strerror(errno);
|
||||
debug(0, _(L"Unable to truncate shared memory object with path '%s': %s"), path, error);
|
||||
FLOG(error, _(L"Unable to truncate shared memory object with path '%s': %s"), path,
|
||||
error);
|
||||
errored = true;
|
||||
}
|
||||
|
||||
|
@ -1089,8 +1093,8 @@ class universal_notifier_shmem_poller_t : public universal_notifier_t {
|
|||
MAP_SHARED, fd, 0);
|
||||
if (addr == MAP_FAILED) {
|
||||
const char *error = std::strerror(errno);
|
||||
debug(0, _(L"Unable to memory map shared memory object with path '%s': %s"), path,
|
||||
error);
|
||||
FLOG(error, _(L"Unable to memory map shared memory object with path '%s': %s"),
|
||||
path, error);
|
||||
this->region = NULL;
|
||||
} else {
|
||||
this->region = static_cast<universal_notifier_shmem_t *>(addr);
|
||||
|
@ -1495,7 +1499,7 @@ void universal_notifier_named_pipe_t::make_pipe(const wchar_t *test_path) {
|
|||
if (mkfifo_status == -1 && errno != EEXIST) {
|
||||
const char *error = std::strerror(errno);
|
||||
const wchar_t *errmsg = _(L"Unable to make a pipe for universal variables using '%ls': %s");
|
||||
debug(0, errmsg, vars_path.c_str(), error);
|
||||
FLOG(error, errmsg, vars_path.c_str(), error);
|
||||
pipe_fd = -1;
|
||||
return;
|
||||
}
|
||||
|
@ -1504,7 +1508,7 @@ void universal_notifier_named_pipe_t::make_pipe(const wchar_t *test_path) {
|
|||
if (fd < 0) {
|
||||
const char *error = std::strerror(errno);
|
||||
const wchar_t *errmsg = _(L"Unable to open a pipe for universal variables using '%ls': %s");
|
||||
debug(0, errmsg, vars_path.c_str(), error);
|
||||
FLOG(error, errmsg, vars_path.c_str(), error);
|
||||
pipe_fd = -1;
|
||||
return;
|
||||
}
|
||||
|
|
10
src/exec.cpp
10
src/exec.cpp
|
@ -62,7 +62,7 @@ void exec_close(int fd) {
|
|||
|
||||
// This may be called in a child of fork(), so don't allocate memory.
|
||||
if (fd < 0) {
|
||||
debug(0, L"Called close on invalid file descriptor ");
|
||||
FLOG(error, L"Called close on invalid file descriptor ");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -614,20 +614,20 @@ static bool handle_builtin_output(parser_t &parser, const std::shared_ptr<job_t>
|
|||
if (write_loop(STDOUT_FILENO, outbuff.data(), outbuff.size()) < 0) {
|
||||
if (errno != EPIPE) {
|
||||
did_err = true;
|
||||
debug(0, "Error while writing to stdout");
|
||||
FLOG(error, "Error while writing to stdout");
|
||||
wperror(L"write_loop");
|
||||
}
|
||||
}
|
||||
if (write_loop(STDERR_FILENO, errbuff.data(), errbuff.size()) < 0) {
|
||||
if (errno != EPIPE && !did_err) {
|
||||
did_err = true;
|
||||
debug(0, "Error while writing to stderr");
|
||||
FLOG(error, "Error while writing to stderr");
|
||||
wperror(L"write_loop");
|
||||
}
|
||||
}
|
||||
if (did_err) {
|
||||
redirect_tty_output(); // workaround glibc bug
|
||||
debug(0, "!builtin_io_done and errno != EPIPE");
|
||||
FLOG(error, "!builtin_io_done and errno != EPIPE");
|
||||
show_stackframe(L'E');
|
||||
}
|
||||
// Clear the buffers to indicate we finished.
|
||||
|
@ -789,7 +789,7 @@ static bool exec_block_or_func_process(parser_t &parser, std::shared_ptr<job_t>
|
|||
const wcstring func_name = p->argv0();
|
||||
auto props = function_get_properties(func_name);
|
||||
if (!props) {
|
||||
debug(0, _(L"Unknown function '%ls'"), p->argv0());
|
||||
FLOG(error, _(L"Unknown function '%ls'"), p->argv0());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -222,7 +222,7 @@ static size_t parse_slice(const wchar_t *in, wchar_t **end_ptr, std::vector<long
|
|||
}
|
||||
// debug( 0, L"Push range idx %d %d", i1, i2 );
|
||||
for (long jjj = i1; jjj * direction <= i2 * direction; jjj += direction) {
|
||||
// debug(0, L"Expand range [subst]: %i\n", jjj);
|
||||
// FLOG(error, L"Expand range [subst]: %i\n", jjj);
|
||||
idx.push_back(jjj);
|
||||
}
|
||||
continue;
|
||||
|
|
|
@ -1237,7 +1237,7 @@ bool history_t::rewrite_to_temporary_file(int existing_fd, int dst_fd) const {
|
|||
const history_item_t old_item = decode_item(*local_file, offset);
|
||||
|
||||
if (old_item.empty() || deleted_items.count(old_item.str()) > 0) {
|
||||
// debug(0, L"Item is deleted : %s\n", old_item.str().c_str());
|
||||
// FLOG(error, L"Item is deleted : %s\n", old_item.str().c_str());
|
||||
continue;
|
||||
}
|
||||
// Add this old item.
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <queue>
|
||||
|
||||
#include "common.h"
|
||||
#include "flog.h"
|
||||
#include "global_safety.h"
|
||||
#include "iothread.h"
|
||||
#include "wutil.h"
|
||||
|
@ -201,7 +202,7 @@ void iothread_service_completion() {
|
|||
} else if (wakeup_byte == IO_SERVICE_RESULT_QUEUE) {
|
||||
iothread_service_result_queue();
|
||||
} else {
|
||||
debug(0, "Unknown wakeup byte %02x in %s", wakeup_byte, __FUNCTION__);
|
||||
FLOG(error, "Unknown wakeup byte %02x in %s", wakeup_byte, __FUNCTION__);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "common.h"
|
||||
#include "env.h"
|
||||
#include "fallback.h" // IWYU pragma: keep
|
||||
#include "flog.h"
|
||||
#include "output.h"
|
||||
#include "wutil.h" // IWYU pragma: keep
|
||||
|
||||
|
@ -528,7 +529,7 @@ void writembs_check(outputter_t &outp, const char *mbs, const char *mbs_name, bo
|
|||
const wchar_t *fmt =
|
||||
_(L"Tried to use terminfo string %s on line %ld of %s, which is "
|
||||
L"undefined in terminal of type \"%ls\". Please report this error to %s");
|
||||
debug(0, fmt, mbs_name, line, file, term ? term->as_string().c_str() : L"",
|
||||
PACKAGE_BUGREPORT);
|
||||
FLOG(error, fmt, mbs_name, line, file, term ? term->as_string().c_str() : L"",
|
||||
PACKAGE_BUGREPORT);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#define PARSE_ASSERT(a) assert(a)
|
||||
#define PARSER_DIE() \
|
||||
do { \
|
||||
debug(0, "Parser dying!"); \
|
||||
FLOG(error, "Parser dying!"); \
|
||||
exit_without_destructors(-1); \
|
||||
} while (0)
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "event.h"
|
||||
#include "exec.h"
|
||||
#include "expand.h"
|
||||
#include "flog.h"
|
||||
#include "function.h"
|
||||
#include "io.h"
|
||||
#include "maybe.h"
|
||||
|
@ -358,7 +359,7 @@ parse_execution_result_t parse_execution_context_t::run_block_statement(
|
|||
} else if (auto header = bheader.try_get_child<g::begin_header, 0>()) {
|
||||
ret = run_begin_statement(contents);
|
||||
} else {
|
||||
debug(0, L"Unexpected block header: %ls\n", bheader.node()->describe().c_str());
|
||||
FLOG(error, L"Unexpected block header: %ls\n", bheader.node()->describe().c_str());
|
||||
PARSER_DIE();
|
||||
}
|
||||
return ret;
|
||||
|
@ -635,7 +636,7 @@ parse_execution_result_t parse_execution_context_t::report_errors(
|
|||
const parse_error_list_t &error_list) const {
|
||||
if (!parser->cancellation_requested) {
|
||||
if (error_list.empty()) {
|
||||
debug(0, "Error reported but no error text found.");
|
||||
FLOG(error, "Error reported but no error text found.");
|
||||
}
|
||||
|
||||
// Get a backtrace.
|
||||
|
@ -1076,8 +1077,8 @@ parse_execution_result_t parse_execution_context_t::populate_job_process(
|
|||
break;
|
||||
}
|
||||
default: {
|
||||
debug(0, L"'%ls' not handled by new parser yet.",
|
||||
specific_statement.describe().c_str());
|
||||
FLOG(error, L"'%ls' not handled by new parser yet.",
|
||||
specific_statement.describe().c_str());
|
||||
PARSER_DIE();
|
||||
break;
|
||||
}
|
||||
|
@ -1380,8 +1381,8 @@ parse_execution_result_t parse_execution_context_t::eval_node(tnode_t<g::stateme
|
|||
} else if (auto switchstat = statement.try_get_child<g::switch_statement, 0>()) {
|
||||
status = this->run_switch_statement(switchstat);
|
||||
} else {
|
||||
debug(0, "Unexpected node %ls found in %s", statement.node()->describe().c_str(),
|
||||
__FUNCTION__);
|
||||
FLOG(error, "Unexpected node %ls found in %s", statement.node()->describe().c_str(),
|
||||
__FUNCTION__);
|
||||
abort();
|
||||
}
|
||||
return status;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "flog.h"
|
||||
#include "parse_constants.h"
|
||||
#include "parse_grammar.h"
|
||||
#include "parse_productions.h"
|
||||
|
@ -402,21 +403,21 @@ const production_element_t *parse_productions::production_for_token(parse_token_
|
|||
case parse_token_type_oror:
|
||||
case parse_token_type_end:
|
||||
case parse_token_type_terminate: {
|
||||
debug(0, "Terminal token type %ls passed to %s", token_type_description(node_type),
|
||||
__FUNCTION__);
|
||||
FLOG(error, "Terminal token type %ls passed to %s", token_type_description(node_type),
|
||||
__FUNCTION__);
|
||||
PARSER_DIE();
|
||||
break;
|
||||
}
|
||||
case parse_special_type_parse_error:
|
||||
case parse_special_type_tokenizer_error:
|
||||
case parse_special_type_comment: {
|
||||
debug(0, "Special type %ls passed to %s\n", token_type_description(node_type),
|
||||
__FUNCTION__);
|
||||
FLOG(error, "Special type %ls passed to %s\n", token_type_description(node_type),
|
||||
__FUNCTION__);
|
||||
PARSER_DIE();
|
||||
break;
|
||||
}
|
||||
case token_type_invalid: {
|
||||
debug(0, "token_type_invalid passed to %s", __FUNCTION__);
|
||||
FLOG(error, "token_type_invalid passed to %s", __FUNCTION__);
|
||||
PARSER_DIE();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include "common.h"
|
||||
#include "fallback.h"
|
||||
#include "flog.h"
|
||||
#include "parse_constants.h"
|
||||
#include "parse_productions.h"
|
||||
#include "parse_tree.h"
|
||||
|
@ -256,7 +257,7 @@ static inline parse_token_type_t parse_token_type_from_tokenizer_token(
|
|||
case TOK_COMMENT:
|
||||
return parse_special_type_comment;
|
||||
}
|
||||
debug(0, "Bad token type %d passed to %s", (int)tokenizer_token_type, __FUNCTION__);
|
||||
FLOG(error, "Bad token type %d passed to %s", (int)tokenizer_token_type, __FUNCTION__);
|
||||
DIE("bad token type");
|
||||
return token_type_invalid;
|
||||
}
|
||||
|
|
17
src/path.cpp
17
src/path.cpp
|
@ -18,6 +18,7 @@
|
|||
#include "env.h"
|
||||
#include "expand.h"
|
||||
#include "fallback.h" // IWYU pragma: keep
|
||||
#include "flog.h"
|
||||
#include "path.h"
|
||||
#include "wutil.h" // IWYU pragma: keep
|
||||
|
||||
|
@ -267,17 +268,17 @@ static void maybe_issue_path_warning(const wcstring &which_dir, const wcstring &
|
|||
}
|
||||
vars.set_one(warning_var_name, ENV_GLOBAL | ENV_EXPORT, L"1");
|
||||
|
||||
debug(0, custom_error_msg.c_str());
|
||||
FLOG(error, custom_error_msg.c_str());
|
||||
if (path.empty()) {
|
||||
debug(0, _(L"Unable to locate the %ls directory."), which_dir.c_str());
|
||||
debug(0, _(L"Please set the %ls or HOME environment variable before starting fish."),
|
||||
xdg_var.c_str());
|
||||
FLOG(error, _(L"Unable to locate the %ls directory."), which_dir.c_str());
|
||||
FLOG(error, _(L"Please set the %ls or HOME environment variable before starting fish."),
|
||||
xdg_var.c_str());
|
||||
} else {
|
||||
const wchar_t *env_var = using_xdg ? xdg_var.c_str() : L"HOME";
|
||||
debug(0, _(L"Unable to locate %ls directory derived from $%ls: '%ls'."), which_dir.c_str(),
|
||||
env_var, path.c_str());
|
||||
debug(0, _(L"The error was '%s'."), std::strerror(saved_errno));
|
||||
debug(0, _(L"Please set $%ls to a directory where you have write access."), env_var);
|
||||
FLOG(error, _(L"Unable to locate %ls directory derived from $%ls: '%ls'."),
|
||||
which_dir.c_str(), env_var, path.c_str());
|
||||
FLOG(error, _(L"The error was '%s'."), std::strerror(saved_errno));
|
||||
FLOG(error, _(L"Please set $%ls to a directory where you have write access."), env_var);
|
||||
}
|
||||
ignore_result(write(STDERR_FILENO, "\n", 1));
|
||||
}
|
||||
|
|
|
@ -374,7 +374,7 @@ void safe_report_exec_error(int err, const char *actual_cmd, const char *const *
|
|||
const char *err = safe_strerror(errno);
|
||||
debug_safe(0, "exec: %s", err);
|
||||
|
||||
// debug(0, L"The file '%ls' is marked as an executable but could not be run by the
|
||||
// FLOG(error, L"The file '%ls' is marked as an executable but could not be run by the
|
||||
// operating system.", p->actual_cmd);
|
||||
break;
|
||||
}
|
||||
|
|
12
src/proc.cpp
12
src/proc.cpp
|
@ -914,8 +914,8 @@ void proc_sanity_check(const parser_t &parser) {
|
|||
// More than one foreground job?
|
||||
if (j->is_foreground() && !(j->is_stopped() || j->is_completed())) {
|
||||
if (fg_job) {
|
||||
debug(0, _(L"More than one job in foreground: job 1: '%ls' job 2: '%ls'"),
|
||||
fg_job->command_wcstr(), j->command_wcstr());
|
||||
FLOG(error, _(L"More than one job in foreground: job 1: '%ls' job 2: '%ls'"),
|
||||
fg_job->command_wcstr(), j->command_wcstr());
|
||||
sanity_lose();
|
||||
}
|
||||
fg_job = j.get();
|
||||
|
@ -928,14 +928,14 @@ void proc_sanity_check(const parser_t &parser) {
|
|||
validate_pointer(p->argv0(), _(L"Process name"), null_ok);
|
||||
|
||||
if ((p->stopped & (~0x00000001)) != 0) {
|
||||
debug(0, _(L"Job '%ls', process '%ls' has inconsistent state \'stopped\'=%d"),
|
||||
j->command_wcstr(), p->argv0(), p->stopped);
|
||||
FLOG(error, _(L"Job '%ls', process '%ls' has inconsistent state \'stopped\'=%d"),
|
||||
j->command_wcstr(), p->argv0(), p->stopped);
|
||||
sanity_lose();
|
||||
}
|
||||
|
||||
if ((p->completed & (~0x00000001)) != 0) {
|
||||
debug(0, _(L"Job '%ls', process '%ls' has inconsistent state \'completed\'=%d"),
|
||||
j->command_wcstr(), p->argv0(), p->completed);
|
||||
FLOG(error, _(L"Job '%ls', process '%ls' has inconsistent state \'completed\'=%d"),
|
||||
j->command_wcstr(), p->argv0(), p->completed);
|
||||
sanity_lose();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "exec.h"
|
||||
#include "expand.h"
|
||||
#include "fallback.h" // IWYU pragma: keep
|
||||
#include "flog.h"
|
||||
#include "function.h"
|
||||
#include "global_safety.h"
|
||||
#include "highlight.h"
|
||||
|
@ -1749,7 +1750,7 @@ static void reader_interactive_init() {
|
|||
if (shell_pgid == 0) {
|
||||
shell_pgid = getpid();
|
||||
if (setpgid(shell_pgid, shell_pgid) < 0) {
|
||||
debug(0, _(L"Failed to assign shell to its own process group"));
|
||||
FLOG(error, _(L"Failed to assign shell to its own process group"));
|
||||
wperror(L"setpgid");
|
||||
exit_without_destructors(1);
|
||||
}
|
||||
|
@ -1759,7 +1760,7 @@ static void reader_interactive_init() {
|
|||
if (errno == ENOTTY) {
|
||||
redirect_tty_output();
|
||||
}
|
||||
debug(0, _(L"Failed to take control of the terminal"));
|
||||
FLOG(error, _(L"Failed to take control of the terminal"));
|
||||
wperror(L"tcsetpgrp");
|
||||
exit_without_destructors(1);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "common.h"
|
||||
#include "fallback.h" // IWYU pragma: keep
|
||||
#include "flog.h"
|
||||
#include "global_safety.h"
|
||||
#include "history.h"
|
||||
#include "kill.h"
|
||||
|
@ -16,19 +17,19 @@
|
|||
static relaxed_atomic_bool_t insane{false};
|
||||
|
||||
void sanity_lose() {
|
||||
debug(0, _(L"Errors detected, shutting down. Break on sanity_lose() to debug."));
|
||||
FLOG(error, _(L"Errors detected, shutting down. Break on sanity_lose() to debug."));
|
||||
insane = true;
|
||||
}
|
||||
|
||||
void validate_pointer(const void *ptr, const wchar_t *err, int null_ok) {
|
||||
// Test if the pointer data crosses a segment boundary.
|
||||
if ((0x00000003l & (intptr_t)ptr) != 0) {
|
||||
debug(0, _(L"The pointer '%ls' is invalid"), err);
|
||||
FLOG(error, _(L"The pointer '%ls' is invalid"), err);
|
||||
sanity_lose();
|
||||
}
|
||||
|
||||
if ((!null_ok) && (ptr == 0)) {
|
||||
debug(0, _(L"The pointer '%ls' is null"), err);
|
||||
FLOG(error, _(L"The pointer '%ls' is null"), err);
|
||||
sanity_lose();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -243,7 +243,7 @@ tok_t tokenizer_t::read_string() {
|
|||
} else {
|
||||
msg.push_back(L'\n');
|
||||
}
|
||||
debug(0, msg.c_str(), c, c, int(mode_begin), int(mode));
|
||||
FLOG(error, msg.c_str(), c, c, int(mode_begin), int(mode));
|
||||
#endif
|
||||
|
||||
this->buff++;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "common.h"
|
||||
#include "fallback.h" // IWYU pragma: keep
|
||||
#include "flog.h"
|
||||
#include "wutil.h" // IWYU pragma: keep
|
||||
|
||||
typedef std::string cstring;
|
||||
|
@ -130,7 +131,7 @@ const wcstring wgetcwd() {
|
|||
return str2wcstring(res);
|
||||
}
|
||||
|
||||
debug(0, _(L"getcwd() failed with errno %d/%s"), errno, std::strerror(errno));
|
||||
FLOG(error, _(L"getcwd() failed with errno %d/%s"), errno, std::strerror(errno));
|
||||
return wcstring();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user