8000 Handle recent changes to Fuchsia's ffx tool by glpesk · Pull Request #6112 · google/syzkaller · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Handle recent changes to Fuchsia's ffx tool #6112

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 2 commits into
base: master
Choose a base branch
from

Conversation

glpesk
Copy link
Collaborator
@glpesk glpesk commented Jun 19, 2025

Recently, some subcommands of ffx have b 8000 een split into separate binaries, and others depend on prebuilt artifacts. This PR updates the Starnix VM startup script to get the current path for each artifact (either from the default ffx config or from the tool manifest), and refactors the ffx helpers to make the call sites more consistent.

(Starnix bug ref: this is a fix for https://fxbug.dev/409390594.)

glpesk added 2 commits June 18, 2025 17:22
ffx emu now needs to know the locations of some host
tools. Copy these paths from the default ffx config
into the configuration for the isolated ffx instance
that syzkaller uses for most tasks.

Also refactors the ffx helpers to make the options
more visible for each command.
ffx log is now built separately from the main
ffx binary.
@glpesk glpesk requested a review from eepeep June 19, 2025 00:38
Copy link
Collaborator
@eepeep eepeep left a comment

Choose a reason for hiding this comment

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

Sorry to take a bit to get back to you on this! Generally seems good to me, assuming that this is the approach recommended by the ffx team, with a couple nits for readability. Thank you for fixing this!


type ffxCommandOpts struct {
isolated bool
startDaemon bool
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Given that there is only one location where startDaemon is true, maybe we can just run ffx daemon start -b as a separate call in that location? Or, alternatively, I think we can define startDaemon as !isolated because isolated is the only case we wanted to suppress it, I believe, and it is a no-op if already running for the other cases. Then we could avoid having this extra struct.

I am torn between the benefit of having names for the boolean args like this, and the added complexity, so defer to your judgement for the final call.

func (inst *instance) ffxCommand(args ...string) *exec.Cmd {
cmd := osutil.Command(inst.ffxBinary, args...)
func (inst *instance) ffxCommand(opts ffxCommandOpts, binary string, args ...string) *exec.Cmd {
config := []string{"-c", "log.enabled=false,ffx.analytics.disabled=true"}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: We previously only set these options explicitly when running non-isolated, so just want to make sure I understand the consequences of moving this here.

I believe running isolated implies ffx.analytics.disabled=true, so this shouldn't affect that behavior. For logging, though, do we want to disable that in the isolated case or might it be good to keep for debugging? If I recall correctly, we disabled it in the non-isolated case because it wanted to write to the home directory or some other place that potentially wouldn't have write access.

@@ -340,18 +364,30 @@ func (inst *instance) connect() error {
return nil
}

func (inst *instance) ffxCommand(args ...string) *exec.Cmd {
cmd := osutil.Command(inst.ffxBinary, args...)
func (inst *instance) ffxCommand(opts ffxCommandOpts, binary string, args ...string) *exec.Cmd {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are all ffx binaries compatible with the same base -c ... config arguments?

@@ -271,8 +290,10 @@ func (inst *instance) startSshdAndConnect() error {
if inst.debug {
log.Logf(1, "instance %s: started alpine container", inst.name)
}
opts.startDaemon = false
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Even though it takes more space, I think it would be easier to read to have a whole new ffxCommandsOpts instead of having to track mutation

@@ -229,8 +234,10 @@ func (inst *instance) Close() error {
}

func (inst *instance) startFuchsiaVM() error {
inst.runFfx(30*time.Second, "config", "get", "product.path")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Was this doing something important? I have no idea why this was here 😆

if err := cmd.Start(); err != nil {
if inst.debug {
log.Logf(0, "instance %s: failed to start ffx log", inst.name)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Might as well log err too?

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
0