Project

General

Profile

  • svn:executable: *

# Date Author Comment
12727 03/15/2014 05:13 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added log_hint(), whose msg is only displayed if not a benign error

12723 03/15/2014 04:31 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: log_err(): don't override verbosity manually, as this will not set log_level or PS4. instead, use new log! , which sets these correctly.

12722 03/15/2014 04:24 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added log! , which force-displays next log message

12721 03/15/2014 03:59 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: save_e: made it idempotent so that it also works if save_e was already called

12720 03/15/2014 03:57 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: save_e: made it idempotent so that it also works if save_e was already called

12719 03/15/2014 03:37 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: rethrow: documented why can't use `(exit "$e")` (bash bug that prevents errexit)

12710 03/14/2014 07:26 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added enter_top_dir and use it in in_top_dir

12709 03/14/2014 07:12 PM Aaron Marcuse-Kubitza

fix: lib/sh/util.sh: commands run inside $(...): need to run with log++ so that these aren't normally debug-printed

12708 03/14/2014 06:41 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added pv(), which debug-prints var(s)

12707 03/14/2014 06:40 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added wildcard.()

12706 03/14/2014 06:40 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added wildcard/()

12705 03/14/2014 06:40 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added esc_args()

12693 03/14/2014 03:32 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added is_callable()

12690 03/14/2014 07:32 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: stderr_matches(): inline the stderr_matches alias to avoid needing to quote stderr_matches as "stderr_matches" in the most common use case (with pattern as a prefix env var)

12689 03/14/2014 07:29 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: stderr_matches(): when passing `pattern=...` as a prefix env var, must be invoked as `"stderr_matches"` to avoid the env var applying to the prep_try portion of the stderr_matches alias

12217 02/14/2014 11:40 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: stderr_matches(): documented that the purpose of not redirecting fd 2 back to fd 2 is to allow log-filtering out an otherwise-confusing benign error

12216 02/14/2014 11:30 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: ignore_err_msg(): documented that unlike `|| true`, this suppresses only errors caused by a particular error message, rather than all error exit statuses

12211 02/14/2014 10:59 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: stdout_contains(): usage: documented that this requires a `{ ... } 41>&1` wrapper

12210 02/14/2014 10:57 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: stderr2stdout(): clarified that fd 2 is not redirected back to fd 2

12209 02/14/2014 10:55 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: stderr_matches(): need to avoid redirecting stderr and stdout to the same place, because this prevents redirecting stdout back to the original stdout after stderr has been filtered using |

12208 02/14/2014 10:23 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: local_export_array: renamed to just export_array because this was a replacement for export, not local_export

12207 02/14/2014 10:21 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: local_*array: don't need -a because that it's an array is autodetected by the ()

12206 02/14/2014 10:20 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: stderr_matches(): actually don't need to declare PIPESTATUS_ in a separate command, because local does support arrays

12205 02/14/2014 10:18 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added local_export_array

12204 02/14/2014 10:17 AM Aaron Marcuse-Kubitza

fix: lib/sh/util.sh: local_array: clarified that this is only needed for older versions of bash (the lack of support for arrays has apparently been fixed)

12203 02/14/2014 10:12 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added local_array

12202 02/14/2014 10:07 AM Aaron Marcuse-Kubitza

fix: lib/sh/util.sh: stderr_matches(): usage: documented that now need to manually rethrow any command error, if applicable

12201 02/14/2014 10:04 AM Aaron Marcuse-Kubitza

*{.sh,run}: stderr_matches calls: don't need to wrap the command in `"try"` because stderr_matches now does this

12200 02/14/2014 09:55 AM Aaron Marcuse-Kubitza

fix: lib/sh/util.sh: `shopt -s lastpipe`: suppress error message if not supported

12199 02/14/2014 09:50 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: ignore_err_msg(): use new stderr_matches alias, which includes prep_try (requires loading new aliases)

12198 02/14/2014 09:49 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: stderr_matches(): need to save PIPESTATUS and then use the saved var because it's reset after each cmd

12197 02/14/2014 09:39 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: stderr_matches(): place exit status of cmd in $e for use with exception handling

12196 02/14/2014 09:21 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: set `shopt -s lastpipe`, to allow setting vars in the last command of a pipeline

12195 02/14/2014 08:43 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: ignore_err_msg(): use `try` properly with prep_try and `"try"`

12194 02/14/2014 08:39 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added prep_try and use it in try alias. try: documented how to run it with a wrapper command.

12192 02/14/2014 08:20 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added ignore_err_msg()

12190 02/14/2014 07:31 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: stderr_matches(): usage: surrounded command in if statement to indicate what context it would usually be used in

11970 01/20/2014 11:33 AM Aaron Marcuse-Kubitza

moved everything into /trunk/ to create the standard svn layout, for use with tools that require this (eg. git-svn). IMPORTANT: do NOT do an `svn up`. instead, re-use your working copy's existing files with `svn switch` (http://svnbook.red-bean.com/en/1.6/svn.ref.svn.c.switch.html).

11914 12/16/2013 04:58 PM Aaron Marcuse-Kubitza

fix: lib/sh/util.sh: verbosity_min(): usage: clarified that '' is a special value that causes $verbosity to be overwritten to ''

11858 12/06/2013 05:37 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: stderr2stdout(): documented that this redirects fd 2->1 and log_fd (but not back to 2)

11857 12/06/2013 05:34 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: stderr2stdout() use `command` before tee, which re-filters log_fd so that stderr itself is also filtered. this allows log-filtering out an otherwise-confusing benign error when using e.g. stderr_matches().

11856 12/06/2013 04:31 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added not(), for use in prefixing wrapped commands

11854 12/06/2013 04:10 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added stderr_matches()

11853 12/06/2013 03:59 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: documented that fds 2x/3x should not be used because we use these, as opposed to 1x which is used by the shell internally

11852 12/06/2013 03:57 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added stdout_contains()

11851 12/06/2013 03:34 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added stderr2stdout()

11784 11/26/2013 10:58 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: import_vars: don't overwrite vars that are already defined, to allow the caller to specify their own values for the vars to create. this requires callers that rely on the overwriting functionality to reverse the order in which they run use_* commands, so that the higher-precedence use_* is applied first and the other one as the default values for the first.

11605 11/09/2013 02:02 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: already_exists_msg(): added instructions on how to force-remake when the file already exists (prepend `rm=1` to the command)

11432 10/24/2013 04:24 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added require_dot_script()

11431 10/24/2013 04:13 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: $top_script: use @BASH_SOURCE instead of $0, because this is also defined for .-scripts

11426 10/24/2013 03:17 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: is_dot_script(): need to subtract 1 from ${#BASH_LINENO[@]}, because this is the array length rather than the index of the last element as in Perl

11425 10/24/2013 02:58 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added is_dot_script()

11413 10/23/2013 09:11 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: alias_append(): need to enclose $(alias) call in "" because its result may contain separator chars (i.e. whitespace) that will be parsed incorrectly. this appears to only be a bug when runscripts are run as shell-includes, with a leading ".".

11250 10/12/2013 12:08 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added instructions for making an export only visible locally

10921 09/12/2013 12:35 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: set_fds(): don't add surrounding quotes to empty redirect dest

10920 09/12/2013 12:31 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: set_fds(): need to check if redirect is empty before escaping it with `printf %q`, which may add surrounding quotes to an empty string

10890 09/07/2013 08:14 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: set_fds(): need to escape redirect destinations which are files, because they may contain special shell characters

10889 09/07/2013 08:10 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added rm_prefix()

10822 08/30/2013 02:18 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: is_array(): handle unset vars (=false). this fixes a bug in pg_export_table_no_header, which produced the error "lib/sh/util.sh: line 290: declare: cols: not found".

10821 08/30/2013 02:06 PM Aaron Marcuse-Kubitza

fix: lib/sh/util.sh: join(): documented that delim must be a single char

10773 08/27/2013 08:59 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: set_fds(): remove empty redirects resulting from using `redirs= cmd...` to clear the redirs and then using $redirs as an array

10772 08/27/2013 08:47 PM Aaron Marcuse-Kubitza

fix: lib/sh/util.sh: set_fds(): documented that it does not currently support redirecting an fd to itself (due to bash bugs that require the dest fd to be closed before it can be reopened)

10771 08/27/2013 08:44 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: stdout2fd(): don't add >&$fd redirect if the fd is 1, because redir does not currently support redirecting an fd to itself (due to bash bugs that require the dest fd to be closed before it can be reopened)

10770 08/27/2013 08:40 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: filter_fd(): factored out >() subshell command into stdout2fd() for clarity

10769 08/27/2013 08:33 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: redir(): unset redirs so that you don't redirect again in the invoked command

10768 08/27/2013 08:29 PM Aaron Marcuse-Kubitza

fix: lib/sh/util.sh: filter_fd(): documented that ${redirs[@]} must not be set to an outer value

10648 08/08/2013 07:15 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: pf(): echo func decl to stderr instead of stdout

10647 08/08/2013 07:10 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: echo_vars(): documented that it only prints vars that are defined

10646 08/08/2013 07:10 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: local_inv: also echo_vars the new var

10506 07/30/2013 10:07 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: $sed_cmd: added usage

10440 07/26/2013 05:16 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: $sed_cmd: make output unbuffered, so that running e.g. bin/my2pg at the command line produces output as each line is read

10400 07/24/2013 05:10 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added is_array()

10271 07/14/2013 01:39 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: moved runscript-related commands to lib/runscripts/util.run because these only apply to runscripts

10217 07/10/2013 03:41 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: sed: must use alias instead of function because function causes segfault in redir() subshell when used with make.sh make() filter (may be bug in bash?). this involves translating `unset LANG` to `env LANG=` (`env -u` to unset a var isn't supported on Mac, but fortunately sed treats LANG="" the same as unset LANG).

10214 07/10/2013 02:42 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: sed: unset LANG to avoid "illegal byte sequence" errors on invalid UTF-8 for LANG=*.UTF-8. these occur e.g. with MySQL data that is in Latin-1.

10213 07/10/2013 02:36 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: sed: use function instead of alias so that env can be set up before calling sed

10154 07/03/2013 05:15 PM Aaron Marcuse-Kubitza

*{.sh,run}: use new log-() instead of log+() with a negative #

10153 07/03/2013 05:14 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added log-() because it's non-obvious that you would otherwise have to invoke log+() with a negative #

10143 07/02/2013 05:40 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added canon_dir_rel_path(), which canonicalizes just the parent dir if the path is a symlink, to leave the symlink itself untouched

10064 06/26/2013 02:19 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added self_name alias and use it in self/self_sys

10063 06/26/2013 02:18 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added sys_cmd_path() and use it in cmd2sys

10059 06/26/2013 12:19 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: .rel(): first use realpath() on BASH_SOURCE1 in case it's a symlink (as it is for bin/make)

10046 06/26/2013 12:23 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: self_sys alias: use new sys_cmd() instead of `command -p` so that only the command path resolution is performed with a limited PATH, and the invoked command itself inherits the full PATH

10045 06/26/2013 12:22 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added sys_cmd(), which runs a system command and allows running a system command of the same name as the script

10044 06/26/2013 12:20 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added echo_builtin()

10022 06/25/2013 12:18 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: command(): added nonrecursive=1 flag, which uses cmd2abs_path to run an external command nonrecursively

10021 06/25/2013 12:16 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added cmd2abs_path, which makes the command in $1 nonrecursive

10020 06/25/2013 11:37 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: PATH_rm(): also need to remove adjacent occurrences of the same path (or occurrences which become adjacent when other paths are removed), which :...: matching wasn't doing because the trailing : is consumed, preventing it from being matched at the beginning of the next path. since unlike filesystem paths with /, it is not necessary for a match to span multiple :-separated sections, we can just use new split() to split apart the PATH into an array of paths, filter each path, and join() them back together.

10019 06/25/2013 11:33 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: added split()

10018 06/25/2013 10:32 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: auto-echo common external commands: added `which`

10017 06/25/2013 10:32 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: auto-echo common external commands: use simpler echo_run instead of command since logging handling is not needed

9945 06/19/2013 08:18 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added in_top_dir()

9939 06/19/2013 06:37 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added wildcard1 alias

9938 06/19/2013 06:37 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: added echo1()

9900 06/17/2013 07:59 PM Aaron Marcuse-Kubitza

lib/sh/util.sh: command-specific alternate stdin/stdout/stderr: choice of 40/41/42: added mnemonic that 4 looks like A for Alternate

9878 06/12/2013 10:28 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/util.sh: verbosity_compat(): always use default verbosity (`unset verbosity`) when verbosity == 1, regardless of whether the caller has set $verbosity to the special value "", because $verbosity is supposed to be an integer field and "" is not supported by most functions that use $verbosity. in cases where a util.sh script is invoked, it will set $verbosity back to the default value 1, so this will function as before for util.sh scripts and fix $verbosity for scripts that use a different verbosity system.

9872 06/12/2013 08:16 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: echo_func(): check can_log at beginning of function, so that the resource-intensive func_loc (which calls `readlink -f`) does not need to be called if echo_cmd would not log anything at the current verbosity

9871 06/12/2013 08:02 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: echo_func(): removed no longer used $minor flag. use `clog++... echo_func` instead.

9870 06/12/2013 07:25 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: verbosity_compat(): don't make $verbosity a local var of this function, because then the changes will not be visible to the caller

9868 06/12/2013 07:10 AM Aaron Marcuse-Kubitza

lib/sh/util.sh: command(): command__exec(): use verbosity_compat to support commands that don't support verbosity=""