Doesn't parse ssh-aliased urls

Bug #912125 reported by Jason
28
This bug affects 5 people
Affects Status Importance Assigned to Milestone
git-review
Fix Released
Medium
Alexander Jones

Bug Description

My fetch url is set to gerrit:cabs.git

My repositories .git/config has the remote:
[remote "gerrit"]
 fetch = +refs/heads/*:refs/remotes/gerrit/*
 url = gerrit:cabs.git

Which uses my ~/.ssh/config entry:
Host gerrit
User jaxelson
Hostname rams-build-vm
Port 29418
IdentityFile ~/.ssh/id_common

It seems to be a bug/misuse of python's urlparse method which is given the input "gerrit:cabs.git". The parse result is:
ParseResult(scheme='gerrit', netloc='', path='cabs.git', params='', query='', fragment='')

Which has gerrit as the scheme instead of the netloc. To remedy this you probably need to trust that the netloc can set the ssh settings necessary (such as the username and port).

An obvious workaround which I am just about to try is to use the .gitreview file instead which I will try in a few minutes and fully expect to resolve my problems

Revision history for this message
Monty Taylor (mordred) wrote :

Oh bother. Thanks. Using the .gitreview file will totally work - BUT, I would like to appropriately handle this case, since it's totally valid for someone to already have a gerrit remote set up.

Changed in git-review:
status: New → Triaged
importance: Undecided → Medium
assignee: nobody → Monty Taylor (mordred)
Revision history for this message
Marcin Cieślak (saperski) wrote :

I have submitted a Patch Set 4 to https://review.openstack.org/#change,5720, it should improve the situation.

Revision history for this message
David Ostrovsky (d-ostrovsky) wrote :

>... Using the .gitreview file will totally work
Unfortunately not.
Currently I'm getting connection error, because git-review is trying to connect to the port 22 instead of 29418.
Changing on the line 259 the value 22 through deafult gerrit port makes it work:

old:

# Is origin an ssh location? Let's pull more info
if parsed_url.scheme == "ssh" and port is None:
    port = 22

new:

# Is origin an ssh location? Let's pull more info
if parsed_url.scheme == "ssh" and port is None:
    port = 29418

Even when in my .gitreview the port line is presents:

[gerrit]
host=logerrit
port=29418
project=core
defaultremote=logerrit
defaultbranch=master

Revision history for this message
Jeremy Stanley (fungi) wrote :

https://review.openstack.org/5720 was abandoned a year ago... is this bug still valid in 1.21/master? It seems that parse_git_show() has undergone some heavy refactoring in that time.

Monty Taylor (mordred)
Changed in git-review:
assignee: Monty Taylor (mordred) → nobody
status: Triaged → Incomplete
Revision history for this message
@Spazm (granny-launchpad) wrote :

I've pushed a change [ https://review.openstack.org/#/c/43248 ] that helps in the related case of port=None. As of patch set 3 it also fixes the naked ssh url case.

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for git-review because there has been no activity for 60 days.]

Changed in git-review:
status: Incomplete → Expired
Revision history for this message
Marcin Cieślak (saperski) wrote :

Still valid as of current version

Changed in git-review:
status: Expired → Confirmed
Revision history for this message
Éric Araujo (merwok) wrote :

I saw the same error message just now, even though the .git/config file contains a full URI.
Following advice from a mediawiki bug report, I ran the initial git review command with the C locale, and the hook installed fine.

Revision history for this message
Cedric Brandily (cbrandily) wrote :
Changed in git-review:
status: Confirmed → Fix Committed
Jeremy Stanley (fungi)
Changed in git-review:
status: Fix Committed → Fix Released
assignee: nobody → Alexander Jones (alex-weej)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.