Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions tests/prepare/shell/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ rlJournalStart
fi
rlPhaseEnd

# TODO: #4785 Preparing from a remote script is broken in Image Mode
if [ "$IMAGE_MODE" != "yes" ]; then
rlPhaseStartTest "Remote Script"
rlRun -s "tmt -vvv run provision --how=$PROVISION_HOW $image_opt prepare finish cleanup plan -n url" 0 "Prepare using a remote script"
rlAssertGrep "Hello world" "$rlRun_LOG" #check for the prepare script
# TODO: #4785 Preparing from a remote script is broken in Image Mode (finish)
rlPhaseStartTest "Remote Script"
rlRun -s "tmt -vvv run provision --how=$PROVISION_HOW $image_opt prepare finish cleanup plan -n url" 0 "Prepare using a remote script"
rlAssertGrep "Hello world" "$rlRun_LOG" #check for the prepare script
if [ "$IMAGE_MODE" != "yes" ]; then
rlAssertGrep "third" "$rlRun_LOG" # check for the finish script
assert_image_mode
rlPhaseEnd
fi
fi
assert_image_mode
rlPhaseEnd
done <<< "$IMAGES"

rlPhaseStartCleanup
Expand Down
3 changes: 2 additions & 1 deletion tmt/package_managers/bootc.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ def build_container(self) -> Optional[CommandOutput]:
)
)
self.guest.execute(
ShellScript(f'cat <<EOF > {containerfile_path!s} \n{containerfile} \nEOF')
# Quoted delimiter disables any shell expansions
ShellScript(f'cat <<"EOF" > {containerfile_path!s} \n{containerfile} \nEOF')
Comment on lines +262 to +263
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.

medium

The spaces before \n in the ShellScript string result in trailing whitespace in the generated Containerfile. Remove them to ensure the directives are written exactly as intended.

Suggested change
# Quoted delimiter disables any shell expansions
ShellScript(f'cat <<"EOF" > {containerfile_path!s} \n{containerfile} \nEOF')
# Quoted delimiter disables any shell expansions
ShellScript(f'cat <<"EOF" > {containerfile_path!s}\n{containerfile}\nEOF')
References
  1. Paths that are internally generated and controlled by the application do not need to be quoted in shell commands, as they are not considered user-provided input.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think it is/will be addresses in #4875

)

self.debug(f"containerfile content: {containerfile}")
Expand Down
Loading