bugfix: lib/sh/util.sh: become_sudo don't continue running function after self_sudo finishes
lib/sh/util.sh: become_sudo: documented that this is for funcs that run multiple sudo commands
lib/sh/util.sh: $sudo_cmd_wrapper: use esc() so this does not need to be embedded with [@] array notation
bugfix: lib/sh/util.sh: sudo(): when don't need sudo: do need `command` to have effects of invoking external command
lib/sh/util.sh: sudo(): only run sudo if needed
lib/sh/util.sh: sudo(): factored PATH-preserving code out into separate wrapper var that can also be used separately, eg. with `sudo -u`
lib/sh/util.sh: sudo(): moved addition of -E (which should always happen) to separate, overridden sudo() function
lib/sh/util.sh: moved -E to is_callable section because it just applies to that
lib/sh/util.sh: added become_sudo alias
lib/sh/util.sh: added $is_root
lib/sh/util.sh: wildcard.(): clarified that it only removes . .. when at then beginning of the list
fix: lib/sh/util.sh: already_exists_msg(): changed calling convention to avoid it seeming like `return 0` is run if already_exists_msg() throws an error, when in fact already_exists_msg() is just a command that should be run before returning/errexiting
*{.sh,run}: use standard WARNING syntax for warning labels
fix: lib/sh/util.sh: verbosity_compat(): documented that this should not be run until right before executing an external command, so that it doesn't mess up the logging mechanism
bugfix: lib/sh/util.sh: functions called by pst(): commented out/removed logging calls that would have caused infinite recursion when pst()'ing a logging function
lib/sh/util.sh: echo_func(): get call context before wrapper(s), which is more useful for debugging. this uses skip_stack_frames()'s lookahead=1 mode.
fix: lib/sh/util.sh: skip_stack_frames() callers: updated for new skip_stack_frames rather than get_stack_frame behavior
lib/sh/util.sh: skip_stack_frames(): added lookahead support, which looks at entry after current to deterine whether to skip current. this is useful for skipping wrappers, by looking at the calling function's name.
fix: lib/sh/util.sh: skip_stack_frames(): for new skip_stack_frames rather than get_stack_frame behavior, stack frames must be skipped in the caller to preserve the stack frame pointer
lib/sh/util.sh: get_stack_frame_after(): renamed to skip_stack_frames() for clarity
lib/sh/util.sh: added skip_stack_frame_in_caller, unskip_stack_frame_in_caller
lib/sh/util.sh: added prev_stack_frame
lib/sh/util.sh: echo_func(): use new format_stack_frame, which adds call context information to what was provided by func_loc
fix: lib/sh/util.sh: format_stack_frame(): need to hide canon_rel_path() info using log+
lib/sh/util.sh: added get_stack_frame_after()
lib/sh/util.sh: added matches()
lib/sh/util.sh: next_stack_frame: documented usage
lib/sh/util.sh: format_stack_frame(): support including args
lib/sh/util.sh: debugging: added pst() (print_stack_trace)
lib/sh/util.sh: added stack_trace(), print_stack_trace()
lib/sh/util.sh: added format_stack_frame()
lib/sh/util.sh: added get_stack_frame() and helpers
lib/sh/util.sh: terminal: moved before errors so it can be used by it
lib/sh/util.sh: errors, debugging: moved after datatype sections so their functions can use these
bugfix: lib/sh/util.sh: canon_rel_path() stub: proper no-op requires passing through original path
lib/sh/util.sh: canon_rel_path(): fall back to original path if can't resolve, instead of errexiting
bugfix: lib/sh/util.sh: canon_rel_path(): don't re-localize $path because this clears it
lib/sh/util.sh: canon_rel_path(): import $1 to $path before function body, so that the function body can be moved to a nested function
lib/sh/util.sh: added canon_rel_path() stub for use by debugging functions
lib/sh/util.sh: moved func_loc() to before debugging section so it can be used by debugging functions
bugfix: lib/sh/util.sh: command__exec(): need to restore $verbosity before calling die_e
lib/sh/util.sh: echo_vars(): merge repeated flags so there aren't flags in between the vars (which is also not valid declare syntax)
lib/sh/util.sh: echo_vars(): put all the vars on the same line so they don't clutter up the call graph generated at the default verbosity
lib/sh/util.sh: cd(): use echo_run instead of a manual echo_cmd call
fix: lib/sh/util.sh: cd(): indent after running cd rather than before
lib/sh/util.sh: cd(): support rebasing path vars for the new dir
bugfix: lib/sh/util.sh: str2varname(): need to lowercase str because on case-insensitive filesystems, paths sometimes canonicalize to a different capitalization than the original
lib/sh/util.sh: added lowercase()
bugfix: lib/sh/util.sh: die(): need stub since this is invoked before it's defined
bugfix: lib/sh/util.sh: setup_log_fd(): don't change $log_fd to stdlog until stdlog is set up, to avoid "Bad file descriptor" errors
lib/sh/util.sh: func_override(), copy_func(): added echo_func to facilitate debugging
bugfix: lib/sh/util.sh: stubs: log++ alias also needs to be moved to stub section
lib/sh/util.sh: import_vars: documented that it's idempotent
bugfix: lib/sh/util.sh: stderr_matches(): support $benign_error properly, by handling exit status logging in this func instead
bugfix: lib/sh/util.sh: stderr_matches(): need to separately display errors that were incorrectly suppressed due to $benign_error
bugfix: lib/sh/util.sh: is_err(): rethrow must be inverted (rethrow->false if error)
lib/sh/util.sh: added is_err()
fix: lib/sh/util.sh: stderr_matches(): usage: documented that this may require benign_error=1
bugfix: lib/sh/util.sh: highlight_log_msg(): when not can_highlight_log_msg, need to remove any surrounding formatting
fix: lib/sh/util.sh: die_error_hidden(): always log local vars at same log_level as echo_func
lib/sh/util.sh: split_lines(): usage: matched up and synced different syntaxes
bugfix: lib/sh/util.sh: log_msg!(): split_lines does not support being invoked by wrapper; need to use `declare lines; wrapper "split_lines" str` instead
fix: lib/sh/util.sh: split_lines(): usage: documented different syntax for when using wrapper
bugfix: lib/sh/util.sh: die_error_hidden(): echo_func to assist debugging
bugfix: lib/sh/util.sh: split(): need to limit the effects of IFS to just the splitting, so it doesn't cause strange errors in other functions
bugfix: stderr2stdout(): fd 2 must be redirected back to fd 2, not log-filtered, in case there are other errors in addition to the benign error. this fixes a bug in pg_schema_exists(), where errors about the DB being down were not displayed because they were log-filtered out.
bugfix: lib/sh/util.sh: `type` calls: need -- before cmd in case it starts with -
lib/sh/util.sh: cmd2rel_path: use is_extern()
lib/sh/util.sh: try: usage: added location of finally block
bugfix: lib/sh/util.sh: type(): need to handle options before command name
lib/sh/util.sh: added 1st_non_opt()
lib/sh/util.sh: unalias(): use self_builtin, which is now defined before it
bugfix: lib/sh/util.sh: commands: `type` calls: need to account for the fact that any alias is already expanded
lib/sh/util.sh: functions: moved before commands since commands are more complex
fix: lib/sh/util.sh: try usage: documented that the split syntax with prep_try is meant to be used with vars before the cmd
fix: lib/sh/util.sh: echo_vars(): also need to print unset vars (including unset kw_params)
lib/sh/util.sh: echo_vars(): put loop var on same line as `for`
bugfix: lib/sh/util.sh: sudo(): need to preserve PATH separately because -E does not preserve this
lib/sh/util.sh: echo_redirs_cmd(): inline the function alias since it's only used in one place
bugfix: lib/sh/util.sh: redir(): need to load new aliases before it
lib/sh/util.sh: echo_redirs_cmd(): log $PATH to facilitate troubleshooting
lib/sh/util.sh: echo_redirs_cmd(): documented what the $(...) section does
lib/sh/util.sh: echo_redirs_cmd(): moved comment about <>file redirs to line that it applies to
lib/sh/util.sh: moved echo_redirs_cmd() to right before redir() which uses it
lib/sh/util.sh: catch(): log at higher log_level, since this is internal code
fix: lib/sh/util.sh: die_e(): treat SIGPIPE as benign error
lib/sh/util.sh: removed no longer used ignore_sig(). use ignore() instead, which now supports SIG*.
lib/sh/util.sh: piped_cmd(): use ignore, which now supports SIG*
lib/sh/util.sh: signals: catch(): added echo_func
lib/sh/util.sh: set_global_fds(): debug to global stderr in case stderr filtered
lib/sh/util.sh: debugging: use configurable debug_fd (set to $err_fd)
lib/sh/util.sh: signals: override catch() to support SIG* as exception type
lib/sh/util.sh: moved primitives sections before more complex sections that depend on them
lib/sh/util.sh: 2nd functions section: moved to 1st functions section
bugfix: lib/sh/util.sh: added workaround for bash bug where exit sometimes inxeplicably ignores $?
fix: lib/sh/util.sh: self_builtin: avoid $() so that $? isn't modified
lib/sh/util.sh: use new self_builtin
lib/sh/util.sh: added self_builtin