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

Support for multicast DNS #19

Closed
grizeldi opened this issue Oct 1, 2022 · 9 comments
Closed

Support for multicast DNS #19

grizeldi opened this issue Oct 1, 2022 · 9 comments
Labels
enhancement New feature or request

Comments

@grizeldi
Copy link

grizeldi commented Oct 1, 2022

": can't open git-upload-pack" error after trying to interact with a HTTP remote

Describe the bug
Every time I try to do anything with a HTTP remote (pull, push, fetch...), the operation fails with an error popup, with the text as described in the title. All of the operations work just fine when done from the CLI git. My remote doesn't support HTTPS or SSH, so I couldn't test if any of those works as it should with the same remote.

To Reproduce
Steps to reproduce the behavior:

  1. Open a local repository that has a HTTP remote
  2. Try any of the operations that interact with the remote (tested with pull and clone)
  3. See the error popup

Expected behavior
The operation was supposed to complete as if done via CLI git.

Desktop (please complete the following information):

  • OS: Ubuntu 20.04 LTS
  • Version 1.0.1 from flathub
@grizeldi grizeldi added the bug Something isn't working label Oct 1, 2022
@JetpackDuba
Copy link
Owner

Have you checked for the issues mentioned here? Have you tried with other remotes?

@grizeldi
Copy link
Author

grizeldi commented Oct 2, 2022

I have tried setting the sslVerify to false to no avail. Github remotes seem to work fine.
Another thing that might be worth mentioning is that the remote is using a .local address resolved through mDNS.

@grizeldi
Copy link
Author

grizeldi commented Oct 2, 2022

Update, I tried looking up the remote's IP address and cloning by the actual IP instead of the .local URL seems to work fine. So it's an issue with the way the DNS lookups are done and probably something to do with an upstream library. Should I close this issue?

@JetpackDuba
Copy link
Owner

That's quite an exotic of a setup. I may try to create a similar setup but not soon, as I want to release 1.1 and I'm quite busy until the end of january.

Can you please run flatpak run com.jetpackduba.Gitnuro and paste the output after getting the error? I may have to somehow tell JGit how to handle such connection, not really sure.

@grizeldi
Copy link
Author

grizeldi commented Oct 2, 2022

Yeah, no worries. I am aware it's a rather exotic setup :)

The relevant part of the output when started from the terminal:

org.eclipse.jgit.api.errors.TransportException: http://carbon.local/user/repo.git: cannot open git-upload-pack
	at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:224)
	at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:266)
	at app.git.RemoteOperationsManager$pull$2.invokeSuspend(RemoteOperationsManager.kt:32)
	at app.git.RemoteOperationsManager$pull$2.invoke(RemoteOperationsManager.kt)
	at app.git.RemoteOperationsManager$pull$2.invoke(RemoteOperationsManager.kt)
	at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
	at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:165)
	at kotlinx.coroutines.BuildersKt.withContext(Unknown Source)
	at app.git.RemoteOperationsManager.pull(RemoteOperationsManager.kt:24)
	at app.viewmodels.MenuViewModel$pull$1.invokeSuspend(MenuViewModel.kt:17)
	at app.viewmodels.MenuViewModel$pull$1.invoke(MenuViewModel.kt)
	at app.viewmodels.MenuViewModel$pull$1.invoke(MenuViewModel.kt)
	at app.git.TabState$safeProcessing$1$2.invokeSuspend(TabState.kt:68)
	at app.git.TabState$safeProcessing$1$2.invoke(TabState.kt)
	at app.git.TabState$safeProcessing$1$2.invoke(TabState.kt)
	at app.extensions.StateManagementUtilsKt.delayedStateChange(StateManagementUtils.kt:21)
	at app.git.TabState$safeProcessing$1.invokeSuspend(TabState.kt:62)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
Caused by: org.eclipse.jgit.errors.TransportException: http://carbon.local/user/repo.git: cannot open git-upload-pack
	at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:749)
	at org.eclipse.jgit.transport.TransportHttp.openFetch(TransportHttp.java:465)
	at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:151)
	at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:103)
	at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1321)
	at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:213)
	... 22 more
Caused by: java.net.UnknownHostException: carbon.local
	at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:567)
	at java.base/java.net.Socket.connect(Socket.java:633)
	at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:178)
	at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:498)
	at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:603)
	at java.base/sun.net.www.http.HttpClient.<init>(HttpClient.java:246)
	at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:351)
	at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:373)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1309)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1287)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1128)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1057)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1665)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1589)
	at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:529)
	at org.eclipse.jgit.transport.http.JDKHttpConnection.getResponseCode(JDKHttpConnection.java:85)
	at org.eclipse.jgit.util.HttpSupport.response(HttpSupport.java:205)
	at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:654)
	... 27 more
LastError flow: Error(date=1664748369237, exception=org.eclipse.jgit.api.errors.TransportException: http://carbon.local/user/repo.git: cannot open git-upload-pack, message=http://carbon.local/user/repo.git: cannot open git-upload-pack)

It does indeed seem like the mDNS lookup doesn't work.

@JetpackDuba
Copy link
Owner

Yeah, after a bit of research I've found that apparently mDNS lookup is not build-in in any Java/Kotlin SDK 😞

I'll have to search for a lib to do it in a future release.

I'll edit the issue as this is a new feature. If using the IP directly is an option, I'd stick with that as a workaround until I can add support for it.

@JetpackDuba JetpackDuba added enhancement New feature or request and removed bug Something isn't working labels Oct 4, 2022
@JetpackDuba JetpackDuba changed the title "<repo URL>: can't open git-upload-pack" error after trying to interact with a HTTP remote Support for multicast DNS Oct 4, 2022
@JetpackDuba JetpackDuba added this to the 1.X milestone Oct 4, 2022
@grizeldi
Copy link
Author

grizeldi commented Oct 4, 2022

The remote I'm using sadly auto redirects to the .local address, so I just went back to CLI git.

If this was a more permanent setup, I'd set up a DNS server, but it's a rather ad hoc setup that will only be used for a week, so I can't be bothered.

@grizeldi
Copy link
Author

grizeldi commented Jan 7, 2023

I'm in a similar situation again and I figured out that as a workaround, manually adding the .local domain into /etc/hosts file makes gitnuro work as intended.

@JetpackDuba
Copy link
Owner

Sorry for the late response, I completly missed the notification. Thanks for the feedback, I'll add it to the readme.

I've been looking more into it but I don't think there is much I can do aside from documenting your workaround, since it would require diving into JGit internals, something I don't really want to do in case I also use alternative Git libraries such as libgit2 (Not planned for now but it may happen in the future) and it may require a lot of effort for such a particular use case.

I'll close it for now. If someone is willing to implement it in the future, we can reopen it.

@JetpackDuba JetpackDuba removed this from the 1.X milestone Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants