Skip to content

5.3 compat#562

Open
andyneff wants to merge 11 commits into
mainfrom
5.3_compat
Open

5.3 compat#562
andyneff wants to merge 11 commits into
mainfrom
5.3_compat

Conversation

@andyneff
Copy link
Copy Markdown
Member

There are a few changes in bash 5.3 that lead to incompatibilities and failures in VSI Common.

The primary different is pushd "" + popd no longer silently works exactly as intended. So many patches had to be added for that.

Signed-off-by: Andy Neff <andy@visionsystemsinc.com>
Signed-off-by: Andy Neff <andy@visionsystemsinc.com>
Signed-off-by: Andy Neff <andy@visionsystemsinc.com>
Signed-off-by: Andy Neff <andy@visionsystemsinc.com>
Signed-off-by: Andy Neff <andy@visionsystemsinc.com>
Signed-off-by: Andy Neff <andy@visionsystemsinc.com>
Signed-off-by: Andy Neff <andy@visionsystemsinc.com>
@andyneff andyneff marked this pull request as ready for review May 29, 2026 15:32
@andyneff andyneff requested review from drewgilliam and scott-vsi May 29, 2026 15:32
Signed-off-by: Andy Neff <andy@visionsystemsinc.com>
@andyneff
Copy link
Copy Markdown
Member Author

Tests were passing in 1354be4 before I moved the file, so I think vsi_common main is being cloned by a integration test, and will fail until after this is merged in. So ignore the test failures.

Signed-off-by: Andy Neff <andy@visionsystemsinc.com>
Comment on lines +1040 to +1042
# "./_" is used so that when JUSTFILE and JUST_DOCKER_COMPOSE_DIR are unset,
# it will use that value that is dirnamed and throws away "/_" and results
# in pushd . to handle the bash 5.3 issue where pushd "" is now an error
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# "./_" is used so that when JUSTFILE and JUST_DOCKER_COMPOSE_DIR are unset,
# it will use that value that is dirnamed and throws away "/_" and results
# in pushd . to handle the bash 5.3 issue where pushd "" is now an error
# "./_" is used so that when JUSTFILE and JUST_DOCKER_COMPOSE_DIR are unset,
# it will dirname that value, which throws away "/_" and results in pushd .
# in order to handle the bash 5.3 issue where pushd "" is now an error

Comment thread linux/compat.bsh Outdated
Comment thread linux/compat.bsh Outdated
#
# In bash version 5.3 and older, caller returns the first line of a multiline command, whereas before it returned the last line.
#
# :Value: * ``0`` ``pushd ""`` returns 0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this example right? I dont se a multi-line command

Comment thread linux/git_functions.bsh
# Guarantee a trailing / or empty string (this may be guaranteed by
# --show-prefix)
prefix="${prefix:+"${prefix%/}/"}"
local prefix=$("${GIT}" rev-parse --show-prefix)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the trailing / here guaranteed by --show-prefix or something?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and no. If it returns a non-empty value, it appears to be guaranteed. But if it's empty, then clearly, no slash

Comment thread linux/git_functions.bsh
# core.worktree isn't set). Fortunately, in this case, --git-dir is correct
local dir
dir="$("${GIT}" rev-parse --show-toplevel)"
dir="$("${GIT}" rev-parse --show-toplevel)" # Don't use git_helper_toplevel, logic reasons
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heh. I don't get it, but def a good comment

Comment thread linux/git_functions.bsh
# git submodule foreach must be run from the top-level working tree in
# git v1.8.3
pushd "$("${GIT}" rev-parse --show-cdup)" &> /dev/null
local git_top_dir="$(git_helper_cdup)"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should prob be called up_path or git_up_path. You have something called git_helper_toplevel

Comment thread linux/git_functions.bsh
# git submodule foreach must be run from the top-level working tree in
# git v1.8.3
pushd "$("${GIT}" rev-parse --show-cdup)" &> /dev/null
local git_top_dir="$(git_helper_cdup)"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here again

Comment thread linux/git_functions.bsh
# git submodule foreach must be run from the top-level working tree in
# git v1.8.3
pushd "$("${GIT}" rev-parse --show-cdup)" &> /dev/null
local git_top_dir="$(git_helper_cdup)"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and again

Comment thread linux/git_functions.bsh Outdated
# At some point, prefix was deprecated and removed in favor of displaypath
local submodule_paths
if [ "${submodule_foreach_rv}" -eq "0" ]; then
# The following logic works based off of these variables being empty instead of `./` for proper output
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# The following logic works based off of these variables being empty instead of `./` for proper output
# The following logic works based off of these variables being empty instead
# of `./` (as they are in bash 5.3)

Comment thread linux/git_functions.bsh
popd &> /dev/null
fi
popd &> /dev/null
#
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ehh. I'd restore

Comment thread linux/compat.bsh Outdated
Comment thread linux/compat.bsh Outdated
Comment thread linux/git_functions.bsh
# Guarantee a trailing / or empty string (this may be guaranteed by
# --show-prefix)
prefix="${prefix:+"${prefix%/}/"}"
local prefix=$("${GIT}" rev-parse --show-prefix)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and no. If it returns a non-empty value, it appears to be guaranteed. But if it's empty, then clearly, no slash

Co-authored-by: Andy Neff <andyneff@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants