Skip to content
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

Fix auto-mount-filesystems #2516

Merged
merged 1 commit into from
Feb 20, 2024
Merged

Conversation

mauriciovasquezbernal
Copy link
Member

If there is an error calling statfs on the path, for instance, it doesn't exist, the logic should continue without erroring out to suggest using "--auto-mount-filesystems"

Fixes: 073bcd0 ("auto-mount-filesystems: add alternative path for tracefs")

Testing

Create a privileged container without mounting tracefs nor debugfs from the host:

$ docker run --privileged -it --rm -v $(pwd):/ig ubuntu:22.04 bash

Before this PR

$ /ig/ig trace exec --host
error: statfs /sys/kernel/debug/tracing: no such file or directory

After this PR

$ /ig/ig trace exec --host
error: filesystems debugfs, tracefs not mounted (did you try --auto-mount-filesystems?)

Copy link
Member

@blanquicet blanquicet left a comment

Choose a reason for hiding this comment

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

LGTM.

err = unix.Statfs(path, &statfs)
if err != nil {
return mountsSuggested, fmt.Errorf("statfs %s: %w", path, err)
if err := unix.Statfs(path, &statfs); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

nit: This indeed solves the issue, but I would prefer to avoid using named return values so that we don't end up with this shadowing.

If there is an error calling statfs on the path, for instance, it doesn't
exist, the logic should continue without erroring out to suggest using
"--auto-mount-filesystems"

Fixes: 073bcd0 ("auto-mount-filesystems: add alternative path for tracefs")

Signed-off-by: Mauricio Vásquez <mauriciov@microsoft.com>
@mauriciovasquezbernal mauriciovasquezbernal merged commit a1b5c73 into main Feb 20, 2024
59 checks passed
@mauriciovasquezbernal mauriciovasquezbernal deleted the mauricio/fix-mount-workaround branch February 20, 2024 18:48
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.

None yet

2 participants