assemble: fix accidental file globbing during parsing #1713
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
commit 1bb261a (assemble: fix regression in file reading) introduced a different regression in file parsing.
When creating a distrobox I observed:
In the loop reading the file, the file contents are being interpreted by the shell rather than being passed as read. This results in the section header being treated as a single-character glob expression. If a file or directory exists in the working directory and is named with a single character contained in the section header, the line will only contain that character rather than the section header. This naturally results in the distrobox not being created because the start of the section is never detected, $name, goes unset, and run_distrobox is called without a name.
distrobox rm
uses a default name of "my-distrobox" which, on my test system doesn't exist. Thendistrobox create
is called with an empty name, which fails, but that's interpreted as already existing byrun_distrobox
.It appears a few separate changes went into that commit and restoring the while read loop fixes the issue for me.
Fixes: #1712 #1487
Fixes: 1bb261a