From d843c81e1f013218db78c0f841727cca65bbc3ba Mon Sep 17 00:00:00 2001 From: Ryan Caloras Date: Mon, 30 May 2016 22:29:23 -0400 Subject: [PATCH 1/6] Get started on 1.1.1 --- bashhub/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bashhub/version.py b/bashhub/version.py index 1a72d32..4c708db 100644 --- a/bashhub/version.py +++ b/bashhub/version.py @@ -1 +1 @@ -__version__ = '1.1.0' +__version__ = '1.1.1-dev' From b8f6f1dbbf6b506196da76b688e9fb7963e68c19 Mon Sep 17 00:00:00 2001 From: Ryan Caloras Date: Mon, 30 May 2016 22:33:21 -0400 Subject: [PATCH 2/6] Remove unnecessary stuff from setup.py - Will re-explore setup and executing scripts later. --- setup.py | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/setup.py b/setup.py index c9aefbb..402b03f 100644 --- a/setup.py +++ b/setup.py @@ -1,35 +1,6 @@ from setuptools import setup, find_packages import install_bashhub import sys -from setuptools.command.install import install -from setuptools.command.develop import develop - - -def postinstall(command_subclass): - """A decorator for classes subclassing one of the setuptools commands. - - It modifies the run() method so that it runs our post install setup. - """ - orig_run = command_subclass.run - - def modified_run(self): - # Need to run bashhub-setup here - # - orig_run(self) - - command_subclass.run = modified_run - return command_subclass - - -@postinstall -class BashhubInstall(install): - pass - - -@postinstall -class BashhubDevelop(develop): - pass - exec (open('bashhub/version.py').read()) @@ -51,8 +22,4 @@ class BashhubDevelop(develop): 'console_scripts': ['bh=bashhub.bh:main', 'bashhub=bashhub.bashhub:main'] }, - cmdclass={ - 'install': BashhubInstall, - 'develop': BashhubDevelop - }, zip_safe=False) From 9305daa2e1c172292454275ccea5901620f5e2c8 Mon Sep 17 00:00:00 2001 From: Ryan Caloras Date: Sun, 24 Jul 2016 20:29:50 -0400 Subject: [PATCH 3/6] Issue #32 disable subshells by default in bash-preexec - This is causing newer versions of bash to exit under some conditions. Believe this is caused by a bug in bash's debug trap and functrace that is being exposred by bash-preexec. --- bashhub/shell/bashhub.sh | 3 +++ bashhub/shell/deps/bash-preexec.sh | 20 ++++++++++++++------ bashhub/shell/deps/lib-bashhub.sh | 2 +- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/bashhub/shell/bashhub.sh b/bashhub/shell/bashhub.sh index deee9d8..9ec7f4a 100644 --- a/bashhub/shell/bashhub.sh +++ b/bashhub/shell/bashhub.sh @@ -25,6 +25,9 @@ __bh_setup_bashhub() { # Pull in our libs source "$BH_DEPS_DIRECTORY/lib-bashhub.sh" + + # Disable subshells in bash-preexec + export __bp_disable_subshells="true" source "$BH_DEPS_DIRECTORY/bash-preexec.sh" # Hook bashhub into preexec and precmd. diff --git a/bashhub/shell/deps/bash-preexec.sh b/bashhub/shell/deps/bash-preexec.sh index e4ddbc6..13db194 100644 --- a/bashhub/shell/deps/bash-preexec.sh +++ b/bashhub/shell/deps/bash-preexec.sh @@ -11,7 +11,7 @@ # Author: Ryan Caloras (ryan@bashhub.com) # Forked from Original Author: Glyph Lefkowitz # -# V0.3.0 +# V0.3.1 # # General Usage: @@ -42,7 +42,7 @@ __bp_imported="defined" # Should be available to each precmd and preexec # functions, should they want it. -__bp_last_command_ret_value="$?" +__bp_last_ret_value="$?" # Command to set our preexec trap. It's invoked once via # PROMPT_COMMAND and then removed. @@ -87,7 +87,7 @@ __bp_interactive_mode() { # It will invoke any functions defined in the precmd_functions array. __bp_precmd_invoke_cmd() { - # Should be available to each precmd function, should it want it. + # Save the returned value from our last command __bp_last_ret_value="$?" # For every function defined in our function array. Invoke it. @@ -234,9 +234,17 @@ __bp_install() { # Adjust our HISTCONTROL Variable if needed. __bp_adjust_histcontrol - # Set so debug trap will work be invoked in subshells. - set -o functrace > /dev/null 2>&1 - shopt -s extdebug > /dev/null 2>&1 + + # Issue #25. Setting debug trap for subshells causes sessions to exit for + # backgrounded subshell commands (e.g. (pwd)& ). Believe this is a bug in Bash. + # + # This option allows you to disable subshells. + if [[ -z "$__bp_disable_subshells" ]]; then + + # Set so debug trap will work be invoked in subshells. + set -o functrace > /dev/null 2>&1 + shopt -s extdebug > /dev/null 2>&1 + fi; local existing_prompt_command diff --git a/bashhub/shell/deps/lib-bashhub.sh b/bashhub/shell/deps/lib-bashhub.sh index 73090b6..37aa1e6 100644 --- a/bashhub/shell/deps/lib-bashhub.sh +++ b/bashhub/shell/deps/lib-bashhub.sh @@ -113,7 +113,7 @@ __bh_process_command() { __bh_check_bashhub_installation() { local ret ret=0 - if [[ -n "$BASH_VERSION" && "$(trap)" != *"__bp_preexec_invoke_exec"* ]]; then + if [[ -n "$BASH_VERSION" && -z "$__bp_disable_subshells" && "$(trap)" != *"__bp_preexec_invoke_exec"* ]]; then echo "Bashhub's preexec hook is being overriden and is not saving commands. Please resolve what may be holding the DEBUG trap." ret=1 elif [[ ! -f "$BH_HOME_DIRECTORY/config" ]]; then From 926c545b74657828e8c8dcfa32ae7f0bc5cc4712 Mon Sep 17 00:00:00 2001 From: Ryan Caloras Date: Sun, 7 Aug 2016 00:39:40 -0400 Subject: [PATCH 4/6] Fix some error messaging --- bashhub/rest_client.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/bashhub/rest_client.py b/bashhub/rest_client.py index bbe7708..ae020e7 100644 --- a/bashhub/rest_client.py +++ b/bashhub/rest_client.py @@ -193,9 +193,10 @@ def search(limit=None, path=None, query=None, system_name=None, unique=None): except Exception as error: if r.status_code in (403, 401): print("Permissons Issue. Run bashhub setup to re-login.") - print( - "Sorry, an error occurred communicating with Bashhub. Response Code: " - + str(r.status_code)) + else: + print( + "Sorry, an error occurred communicating with Bashhub. Response Code: " + + str(r.status_code)) return [] @@ -222,11 +223,14 @@ def get_status_view(process_id, start_time): r = requests.get(url, params=payload, headers=json_auth_headers()) status_view_json = json.dumps(r.json()) return StatusView.from_JSON(status_view_json) + except ConnectionError as error: + print "Sorry, looks like there's a connection error" + return None except Exception as error: if r.status_code in (403, 401): print("Permissons Issue. Run bashhub setup to re-login.") else: print( - "Sorry, looks like there's a connection error: " + str(error)) - + "Sorry, an error occurred communicating with Bashhub. Response Code: " + + str(r.status_code)) return None From dde817a30877422abc440926ab7633fb91ffaebf Mon Sep 17 00:00:00 2001 From: Ryan Caloras Date: Mon, 8 Aug 2016 23:29:13 -0400 Subject: [PATCH 5/6] Changed subshell supprt to be opt-in - disabled by default in bash-preexec 0.3.1 --- bashhub/shell/bashhub.sh | 3 --- bashhub/shell/deps/bash-preexec.sh | 4 ++-- bashhub/shell/deps/lib-bashhub.sh | 2 +- tests/shell/lib-bashhub.bats | 3 +++ 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bashhub/shell/bashhub.sh b/bashhub/shell/bashhub.sh index 9ec7f4a..deee9d8 100644 --- a/bashhub/shell/bashhub.sh +++ b/bashhub/shell/bashhub.sh @@ -25,9 +25,6 @@ __bh_setup_bashhub() { # Pull in our libs source "$BH_DEPS_DIRECTORY/lib-bashhub.sh" - - # Disable subshells in bash-preexec - export __bp_disable_subshells="true" source "$BH_DEPS_DIRECTORY/bash-preexec.sh" # Hook bashhub into preexec and precmd. diff --git a/bashhub/shell/deps/bash-preexec.sh b/bashhub/shell/deps/bash-preexec.sh index 13db194..d93cb9a 100644 --- a/bashhub/shell/deps/bash-preexec.sh +++ b/bashhub/shell/deps/bash-preexec.sh @@ -238,8 +238,8 @@ __bp_install() { # Issue #25. Setting debug trap for subshells causes sessions to exit for # backgrounded subshell commands (e.g. (pwd)& ). Believe this is a bug in Bash. # - # This option allows you to disable subshells. - if [[ -z "$__bp_disable_subshells" ]]; then + # Disabling this by default. It can be enabled by setting this variable. + if [[ -n "$__bp_enable_subshells" ]]; then # Set so debug trap will work be invoked in subshells. set -o functrace > /dev/null 2>&1 diff --git a/bashhub/shell/deps/lib-bashhub.sh b/bashhub/shell/deps/lib-bashhub.sh index 37aa1e6..6fa96df 100644 --- a/bashhub/shell/deps/lib-bashhub.sh +++ b/bashhub/shell/deps/lib-bashhub.sh @@ -113,7 +113,7 @@ __bh_process_command() { __bh_check_bashhub_installation() { local ret ret=0 - if [[ -n "$BASH_VERSION" && -z "$__bp_disable_subshells" && "$(trap)" != *"__bp_preexec_invoke_exec"* ]]; then + if [[ -n "$BASH_VERSION" && -n "$__bp_enable_subshells" && "$(trap)" != *"__bp_preexec_invoke_exec"* ]]; then echo "Bashhub's preexec hook is being overriden and is not saving commands. Please resolve what may be holding the DEBUG trap." ret=1 elif [[ ! -f "$BH_HOME_DIRECTORY/config" ]]; then diff --git a/tests/shell/lib-bashhub.bats b/tests/shell/lib-bashhub.bats index 5aa6d4f..d0da26f 100644 --- a/tests/shell/lib-bashhub.bats +++ b/tests/shell/lib-bashhub.bats @@ -29,6 +29,9 @@ teardown() { @test "__bh_check_bashhub_installation should find issues and run only once." { + # Enable subshells for these checks to work + export __bp_enable_subshells="true" + # Bash but no trap. run '__bh_check_bashhub_installation' [[ $status == 1 ]] From 0adce1045b4611c6b0bc9b8fe3215b66ab4bc16c Mon Sep 17 00:00:00 2001 From: Ryan Caloras Date: Sun, 21 Aug 2016 21:27:22 -0400 Subject: [PATCH 6/6] Prepare for release 1.1.1 --- bashhub/version.py | 2 +- install-bashhub.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bashhub/version.py b/bashhub/version.py index 4c708db..b3ddbc4 100644 --- a/bashhub/version.py +++ b/bashhub/version.py @@ -1 +1 @@ -__version__ = '1.1.1-dev' +__version__ = '1.1.1' diff --git a/install-bashhub.sh b/install-bashhub.sh index d52b7ed..b63f627 100755 --- a/install-bashhub.sh +++ b/install-bashhub.sh @@ -41,7 +41,7 @@ zshprofile=~/.zshrc # Optional parameter to specify a github branch # to pull from. -github_branch=${1:-'1.1.0'} +github_branch=${1:-'1.1.1'} install_bashhub() { check_dependencies