Project

General

Profile

Statistics
| Revision:

# Date Author Comment
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.

12193 02/14/2014 08:21 AM Aaron Marcuse-Kubitza

lib/sh/db.sh: pg_dump(): ignore "No matching tables were found" error, using new ignore_err_msg()

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

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

12191 02/14/2014 07:34 AM Aaron Marcuse-Kubitza

lib/sh/db.sh: pg_schema_exists(): documented that `try` is used to suppress the error exit status

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

11976 01/20/2014 07:15 PM Aaron Marcuse-Kubitza

lib/sh/make.sh: remaking alias: documented that you MUST use set_make_vars at the beginning of any function that uses this, so that $_remake is properly set to $remake and not left at its previous value

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 ''

11861 12/06/2013 05:52 AM Aaron Marcuse-Kubitza

lib/sh/local.sh: public_schema_exists(): use a higher log_level for pg_schema_exists, to avoid all the verbose output involved in running the query

11860 12/06/2013 05:44 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/local.sh: public_schema_exists(): can no longer use psql_script_vegbien for this, because using `SET search_path` (called by psql_script_vegbien) with a schema that does not exist no longer produces an error. instead, use new pg_schema_exists(), which uses a different command that does produce an error if the schema does not exist.

11859 12/06/2013 05:38 AM Aaron Marcuse-Kubitza

lib/sh/db.sh: added pg_require_schema()

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

11855 12/06/2013 04:14 AM Aaron Marcuse-Kubitza

lib/sh/db.sh: added pg_schema_exists()

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()

11850 12/06/2013 02:52 AM Aaron Marcuse-Kubitza

fix: lib/sh/db.sh: pg_table_exists(): usage: documented that $table is actually required for this function

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.

11771 11/26/2013 01:22 PM Aaron Marcuse-Kubitza

lib/sh/db.sh: pg_table_exists(): use `SELECT NULL` instead of `SELECT *` to avoid a long column list cluttering up the log output

11768 11/26/2013 12:01 PM Aaron Marcuse-Kubitza

lib/sh/db.sh: added pg_table_exists()

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)

11588 11/06/2013 02:39 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/make.sh: $remake: need to explicitly propagate this to invoked commands if it was set from $rm

11579 11/05/2013 11:13 PM Aaron Marcuse-Kubitza

lib/sh/db.sh: mk_select(): usage: documented that this also takes a $limit/$n param

11578 11/05/2013 11:12 PM Aaron Marcuse-Kubitza

lib/sh/db.sh: limit(): also support using $n as the limit param, since this var name is used by other parts of the import process

11576 11/05/2013 11:07 PM Aaron Marcuse-Kubitza

lib/sh/db.sh: limit(): usage: documented that this also need a $limit param

11433 10/24/2013 05:06 PM Aaron Marcuse-Kubitza

lib/sh/local.sh: psql(): also accept $public as the $schema param, since this is used by a lot of import scripts

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 ".".

11365 10/19/2013 12:52 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/local.sh: psql(): $is_root: use `` around case statement instead of $(), because it contains an embedded unbalanced )

11362 10/18/2013 10:32 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/local.sh: psql(): don't default the connection vars using use_local if running as the postgres user. in that case, connection must happen via a socket, with server="", and as the user running the command (postgres), with user="".

11360 10/18/2013 09:54 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/db.sh: avoid outputting to /dev/fd/# when running as sudo on Linux, because this causes a "Permission denied" error (due to the /dev/fd/# file being owned by a different user). this is not a problem with normal redirects (>&#), because they do not use /dev/fd/# files which can have access permissions.

11357 10/18/2013 07:50 PM Aaron Marcuse-Kubitza

lib/sh/db.sh: pg_as_root(): run sudo with echo_run to help debug

11356 10/18/2013 06:29 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/db.sh: pg_cmd(): only set PG* connection/login env vars when the corresponding var is non-empty. there are some situations in which these must be unset (in order to use the default value), and other situations when the var must be set to something (i.e. "") to avoid it being defaulted to a value in local.sh > connection vars.

11353 10/18/2013 06:11 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/local.sh: pg_as_root(): need to use -E (preserve environment) option to sudo, so that $schema, $table get passed through

11352 10/18/2013 06:05 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/local.sh: psql(): only \set schema, table if $schema, $table are non-empty, because otherwise, you will get a "zero-length delimited identifier" error

11350 10/18/2013 05:29 PM Aaron Marcuse-Kubitza

lib/sh/local.sh: added require_remote()

11349 10/18/2013 05:29 PM Aaron Marcuse-Kubitza

lib/sh/db.sh: added pg_as_root()

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

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

10996 09/16/2013 12:13 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/make.sh: don't allow rm to override remake if an invoked script uses this file. this fixes a bug in `rm=1 inputs/.../.../run` where the remake action would be invoked on the map_table command even though it had been suppressed, because it was run externally (i.e. make.sh was reloaded) and the rm=1 flag was still active

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()

10888 09/07/2013 07:11 PM Aaron Marcuse-Kubitza

lib/sh/db.sh: mysql_cmd(): added caller usage with connection/login opts

10887 09/07/2013 07:08 PM Aaron Marcuse-Kubitza

lib/sh/db.sh: mysql(), mysql_export(): usage: added database=...

10827 08/30/2013 03:36 PM Aaron Marcuse-Kubitza

lib/sh/db.sh: mk_select(): added support for ORDER BY

10825 08/30/2013 03:28 PM Aaron Marcuse-Kubitza

lib/sh/db.sh: added pg_export_table_to_dir(), analogous to pg_export_table_to_dir_no_header()

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

10775 08/27/2013 09:07 PM Aaron Marcuse-Kubitza

bugfix: lib/sh/db.sh: pg_dump(): don't default $struct flag to on, because both structure and data should be printed by default

10774 08/27/2013 09:02 PM Aaron Marcuse-Kubitza

lib/sh/db.sh: pg_dump(): added create_schema= flag to remove CREATE SCHEMA statements (useful if the schema already exists)

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

10765 08/27/2013 07:10 PM Aaron Marcuse-Kubitza

lib/sh/local.sh: added pg_dump_local()

10764 08/27/2013 07:09 PM Aaron Marcuse-Kubitza

lib/sh/db.sh: added pg_dump(), using the code in bin/pg_dump_vegbien with clarity improvements

10763 08/27/2013 07:06 PM Aaron Marcuse-Kubitza

lib/sh/db.sh: added pg_cmd() (analogous to mysql_cmd() for PostgreSQL), and use it in psql(), so that other PostgreSQL operations can use this to set the PG* connection/login vars

10755 08/27/2013 02:38 PM Aaron Marcuse-Kubitza

lib/sh/db.sh: pg_export(): added usage

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

lib/sh/db.sh: mysqldump(): added create_db=1 flag to print the CREATE DATABASE statement

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

10446 07/26/2013 08:06 PM Aaron Marcuse-Kubitza

lib/sh/db.sh: mysqldump(): don't use --compatible=postgresql when the table structure is being exported, because this removes the table options (which include the COMMENT attribute). --compatible=postgresql remains on in data-only mode because embedded ` in data cannot easily be distinguished from ` around column names, so ANSI_QUOTES is needed to do the translation to " (and data sections do not contain table options). note that all --compatible modes that offer ANSI_QUOTES unfortunately exclude the table options, and there is no way to run a SQL query to set the SQL mode before beginning the dump, so ANSI_QUOTES translation must be handled by my2pg instead.

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

10402 07/24/2013 05:13 PM Aaron Marcuse-Kubitza

lib/sh/db.sh: mk_select(): support passing $cols as array instead of SQL string, which is easier to enter in a shell script (less quotes, \ , etc.)

10401 07/24/2013 05:12 PM Aaron Marcuse-Kubitza

lib/sh/db.sh: added cols2list()

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

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

10396 07/24/2013 04:08 PM Aaron Marcuse-Kubitza

lib/sh/db_make.sh: added pg_export_table_to_dir(), pg_export_tables_to_dir(). unlike db.sh pg_export_table_to_dir_no_header(), these functions are make-aware and will not clobber an existing file.

10295 07/17/2013 07:40 AM Aaron Marcuse-Kubitza

lib/sh/db.sh: psql(): display stack traces and DETAIL sections of error messages at verbosity 2+, to help debugging (previously they were always turned off). in particular, the DETAIL section of a "duplicate key value violates unique constraint" error is useful because it contains the duplicated key.

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

10247 07/11/2013 02:20 AM Aaron Marcuse-Kubitza

bugfix: lib/sh/local.sh: prevent automated tests when the public schema contains the live DB, so the user doesn't have to explicitly specify can_test= when running the import on vegbiendev