Pluto.jl icon indicating copy to clipboard operation
Pluto.jl copied to clipboard

Surface reason for git authentication failures

Open BioTurboNick opened this issue 2 years ago • 5 comments

If you have a private repository that you normally access with SSH credentials ([email protected]:), but instead try to load with username/password (https://github.com/), the request by GitHub for those credentials (hidden on stdout) causes a crash loop with the notebook.

To reproduce, probably need a LocalRegistry, to which you add a dummy package from a private repository.

Then add both the General and local registry to Julia.

Then open a notebook and try to load the private package using the Pluto package manager (just a normal using statement). May need a General package to be listed first - should quickly see an error saying it can't find the package and a Restart Notebook banner.

image

So it would be good to surface the fact that git itself encountered a problem and can't run without intervention.

(Deleted a bit about affecting other notebooks - that was a coincidence :-) )

BioTurboNick avatar Aug 03 '23 14:08 BioTurboNick

hey @BioTurboNick sprry for the late reply!

Pluto uses Pkg (and RegistryInstances.jl) for this. Which Pkg call do you think caused the error?

You could take a look at our packagae management code, everything should be behind a try catch. But maybe not the code that loads in the registries?

fonsp avatar Aug 10 '24 19:08 fonsp

Unfortunately I haven't seen this issue in a long time. I just tried to reproduce it and I think it fails safe now, though perhaps could still be room for some improvement down the line?

Now, it produces this stdout:

     Cloning git-repo `https://github.com/<username>/<repo>`
fatal: could not read Username for 'https://github.com': No such device or address

Which results in this error: image

Perhaps the username request or failure could be detected, and Pluto could inform the user that a package requested git authentication, and direct people to solutions (e.g. use SSH).

BioTurboNick avatar Aug 13 '24 13:08 BioTurboNick

Hey @BioTurboNick !

In your last comment, you used a Pkg.add call inside a cell. In that case, the error message displayed in the notebook comes from Pkg.jl, and it's the same as in the REPL, right? (So you could contribute improvements directly to Pkg.jl and they will show up in Pluto?)

I just noticed that your original post has no checkmarks next to package names, so you are not using the Pluto package manager because you use Pkg.activate. If you are not using the Pluto package manager, then all behaviour and error messages should be exactly as in the REPL, originating from Pkg.jl. I don't think there is something actionable from the Pluto side, or?

fonsp avatar Aug 14 '24 15:08 fonsp

It's just a bit unique in that a better error in the REPL is somewhat extraneous because user action would happen and the user would know what they did.

But maybe the status quo is livable. It does seem like the git request is now displayed in the stdout display, which wasn't the case before. Maybe a broader issue is if there's a need to handle terminal input requests in some way? Not necessarily to provide an interface for it, but to flag for the user that interactive input was requested and this isn't possible in Pluto?

BioTurboNick avatar Aug 16 '24 13:08 BioTurboNick

Ah sorry I only fully understand it now: it's about unsupported stdin.

Could you check if it's possible to detect an attempt to use stdin? I suspect not, especially if it comes from the git subprocess. Not sure how much of this code is in Julia.

Otherwise, there is still some value in improving the error message: it would also help when running julia in CI, or on a headless server.

fonsp avatar Aug 17 '24 12:08 fonsp