bugfix: lib/sh/sync.sh, db.sh: *_snapshot() commands that run multiple sudo commands: use become_sudo so that the program won't hang at later sudo prompts. for pg_snapshot() with pg_start_backup(), this also prevents the backup from staying open at the end waiting on a sudo prompt, causing excess WAL logs to accrue.
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
fix: lib/sh/db.sh: pg_snapshot(): first need to run pg_stop_backup() in case a backup was not stopped cleanly
fix: lib/sh/db.sh: pg_stop_backup(): ignore benign "a backup is not in progress" error
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
lib/sh/make.sh: make(): added support for $output_data mode which uses --silent
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
bugfix: lib/sh/local.sh: $sync_remote_url: jupiter user is always aaronmk, not the local user
*{.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
fix: lib/sh/local.sh: $sync_remote_url: need $USER so user can be overridden when running as root
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/db.sh: pg_cmd(): log vars on same line to avoid clutter
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
bugfix: lib/sh/archives.sh: compress(): don't include dir prefix in zip archive
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/archives.sh: compress(): need to use zip's path syntax to avoid the file in the archive being named "-"
lib/sh/archives.sh: added compress(), expand(), which handle compression of individual files
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/sync.sh: db_snapshot(): before backing up, trim bloated temp files (eg. from rolled back changes)
bugfix: lib/sh/db.sh: pg_dump(): need use_pg to import $pg_database before checking for existence of $database
lib/sh/util.sh: import_vars: documented that it's idempotent
bugfix: benign_does_not_exist_error(): removed ignore_e=3, because this exit status is also used for other errors
fix: lib/sh/db.sh: benign_does_not_exist_error(): use benign_error=1, which is now supported properly by stderr_matches()
bugfix: lib/sh/util.sh: stderr_matches(): support $benign_error properly, by handling exit status logging in this func instead
bugfix: lib/sh/db.sh: pg_schema_exists(): also need to benignify "does not exist" error if returns false
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()
lib/sh/local.sh: public_schema_exists(): moved to lib/sh/db.sh since this no longer depends on BIEN-specific configurations
bugfix: lib/sh/db.sh: public_schema_exists(): don't hide the function call tree so it's clear which function is running the psql commands
fix: *{.sh,run}: stderr_matches() callers: usage: documented that they may require benign_error=1
fix: lib/sh/util.sh: stderr_matches(): usage: documented that this may require benign_error=1
bugfix: lib/sh/db.sh: pg_cmd(): updated for new echo_vars log_level
fix: lib/sh/db.sh: pg_schema_exists(): display the function name so it's clear which function is running the psql commands
fix: lib/sh/db.sh: pg_schema_exists(): don't use log++ because it hides the command that produces the benign error
fix: lib/sh/db.sh: psql(): removed debugging changes
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
fix: *{.sh,run}: always log kw_params 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.
lib/sh/make.sh: set_make_vars: don't display make vars at verbosity 2 to avoid clutter
bugfix: lib/sh/make.sh: begin_target: don't echo_func twice
lib/sh/db.sh: pg_snapshot(): perform online backup if possible, to avoid needing to restart the server
lib/sh/db.sh: added pg_start_backup(), pg_stop_backup()
lib/sh/db.sh: psql(): only set redirs if can redirect
bugfix: psql(): when as_root is on, need to avoid redirections as these are not passed through by sudo
bugfix: lib/sh/db.sh: psql(): don't use `--file /dev/fd/40` when can't redirect
fix: lib/sh/db.sh: psql(): when using sudo with custom $stdin, raise error that this is not supported
lib/sh/db.sh: psql(): $data_bypasses_filter: renamed to $data2stdout for clarity
lib/sh/db.sh: psql(): $bypass_ok: renamed to $can_redir for clarity