Skip to content

assemble: fix accidental file globbing during parsing #1713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jeffmahoney
Copy link

@jeffmahoney jeffmahoney commented Mar 18, 2025

commit 1bb261a (assemble: fix regression in file reading) introduced a different regression in file parsing.

When creating a distrobox I observed:

     - Deleting ...
    Error response from daemon: No such container: my-distrobox
    Error response from daemon: No such container: my-distrobox
    Cannot find container my-distrobox.
     - Creating ...
     already exists

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. Then distrobox create is called with an empty name, which fails, but that's interpreted as already existing by run_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

commit 1bb261a (assemble: fix regression in file reading)
introduced a different regression in file parsing.

When creating a distrobox I observed:
 - Deleting ...
Error response from daemon: No such container: my-distrobox
Error response from daemon: No such container: my-distrobox
Cannot find container my-distrobox.
 - Creating ...
 already exists

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.  Then
distrobox create is called with an empty name, which fails, but
that's interpreted as already existing by run_distrobox.

It appears a few separate changes went into that commit and restoring
the while read loop fixes the issue for me.

Fixes: 89luca89#1712 89luca89#1487
Fixes: 1bb261a
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.

[Error] File globbing triggered during file parsing in distrobox-assemble
1 participant