Skip to content

Commit

Permalink
Fix usage of PGENV_SED to exclude old PostgreSQL versions
Browse files Browse the repository at this point in the history
Bug detected in the usage of uninitialized PGENV_SED when `use`-ing a
version.
Introduced in commit e32acb0.
See <#69 (comment)>

See #68
  • Loading branch information
fluca1978 committed Mar 1, 2024
1 parent e32acb0 commit bc6c1de
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion bin/pgenv
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ pgenv_get_downloadable_versions(){
local major
local minor

if [ -z "$PGENV_SED" ]; then
PGENV_SED=$(command -v sed)
fi


# First of all download the page with the links to each version (href=va.b.c/)
# and trim out each version, then extract the major version
# and append each version to an hash indexed by the major version number
Expand All @@ -78,7 +83,7 @@ pgenv_get_downloadable_versions(){
continue
fi

pgenv_debug "Version $version"

major=$( echo $version | $PGENV_SED 's/\([[:digit:]]\{1,2\}\).*/\1/' )
pgenv_debug "Extracted major version [$major]"

Expand Down Expand Up @@ -361,6 +366,11 @@ pgenv_input_version_or_exit() {
local verbose=$2
local hint=$3

if [ -z "$PGENV_SED" ]; then
PGENV_SED=$(command -v sed)
fi


if [ -z "$version" ]; then
if [ ! -z "$hint" ]; then
# count the versions
Expand Down

0 comments on commit bc6c1de

Please sign in to comment.