Ion icon indicating copy to clipboard operation
Ion copied to clipboard

`Failed to read command` when attempting `ion summon`

Open Krastanov opened this issue 2 years ago • 9 comments
trafficstars

I installed ion in a local path, successfully authenticated it to github, successfully used bump but then summon is erroring with error code 101:

stefan@cube ~/D/S/q/QuantumClifford.jl (master) > ion summon
Failed to read command
stefan@cube ~/D/S/q/QuantumClifford.jl (master) [101]> ion -V
ion 0.1.21

Not really sure what to do to debug now

Krastanov avatar Apr 09 '23 01:04 Krastanov

what does it say if you run

RUST_LOG=debug ion summon

also what OS are you on? is this a linux distro?

Roger-luo avatar Apr 09 '23 21:04 Roger-luo

[2023-04-09T21:42:38Z DEBUG ion::config] config file: /home/stefan/.config/ion/config.toml
[2023-04-09T21:42:38Z DEBUG ion::config] config file: true
[2023-04-09T21:42:38Z DEBUG ion::commands::summon] summoning JuliaRegistrator to register /home/stefan/Documents/ScratchSpace/quantumjulia/QuantumClifford.jl/Project.toml
[2023-04-09T21:42:38Z DEBUG ion::utils::git] get_toplevel_path("/home/stefan/Documents/ScratchSpace/quantumjulia/QuantumClifford.jl")
[2023-04-09T21:42:38Z DEBUG ion::utils::read_command] Running command: Command {
        program: "git",
        args: [
            "git",
            "rev-parse",
            "--show-toplevel",
        ],
        cwd: Some(
            "/home/stefan/Documents/ScratchSpace/quantumjulia/QuantumClifford.jl",
        ),
        create_pidfd: false,
    }
[2023-04-09T21:42:39Z DEBUG ion::utils::git] current_branch("/home/stefan/Documents/ScratchSpace/quantumjulia/QuantumClifford.jl")
[2023-04-09T21:42:39Z DEBUG ion::utils::read_command] Running command: Command {
        program: "git",
        args: [
            "git",
            "rev-parse",
            "--abbrev-ref",
            "HEAD",
        ],
        cwd: Some(
            "/home/stefan/Documents/ScratchSpace/quantumjulia/QuantumClifford.jl",
        ),
        create_pidfd: false,
    }
[2023-04-09T21:42:39Z DEBUG ion::utils::read_command] Running command: Command {
        program: "git",
        args: [
            "git",
            "symbolic-ref",
            "refs/remotes/origin/HEAD",
        ],
        cwd: Some(
            "/home/stefan/Documents/ScratchSpace/quantumjulia/QuantumClifford.jl",
        ),
        create_pidfd: false,
    }
Failed to read command

Krastanov avatar Apr 09 '23 21:04 Krastanov

It seems the following command doesn't work

git symbolic-ref refs/remotes/origin/HEAD

this command is for getting the current default branch, could you try it locally and see if this fails?

Roger-luo avatar Apr 11 '23 05:04 Roger-luo

This is on Ubuntu 22.04. It is on git 2.37.2

The command indeed fails:

> git symbolic-ref refs/remotes/origin/HEAD
fatal: ref refs/remotes/origin/HEAD is not a symbolic ref

But this issue seems very similar and seems to suggest a workaround https://github.com/jhauberg/gitdoctor/issues/3

> git remote show origin
Host key fingerprint is ...
...
+----[SHA256]-----+
* remote origin
  Fetch URL: [email protected]:Krastanov/QuantumClifford.jl.git
  Push  URL: [email protected]:Krastanov/QuantumClifford.jl.git
  HEAD branch: master
... many more lines of output

Krastanov avatar Apr 11 '23 23:04 Krastanov

Or maybe there is some standard way to create refs/remotes/origin/HEAD?

Krastanov avatar Apr 11 '23 23:04 Krastanov

Another place where a similar issue has popped up https://github.com/dhimmel/manubot-rootstock/commit/667d170eb2f1898156226456292d25c1c99377c4

Krastanov avatar Apr 11 '23 23:04 Krastanov

So I wrote that because of this StackOverflow post: https://stackoverflow.com/questions/28666357/how-to-get-default-git-branch

Maybe there is a more robust way of detecting the default repo branch in the remote repo, the other way might be using the GitHub API to get the default repo branch, I'm not sure if how it works yet.

Roger-luo avatar Apr 12 '23 02:04 Roger-luo

If I first run git remote set-head origin --auto then git symbolic-ref refs/remotes/origin/HEAD works fine. Could that be enough of a solution?

Krastanov avatar Apr 12 '23 12:04 Krastanov

Hmm, I think I need to understand when refs/remotes/origin/HEAD will appear first and why it might not be there first. But yeah, please use this as a workaround for now until we figure out something more robust.

Roger-luo avatar Apr 12 '23 22:04 Roger-luo