<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>8864</bug_id>
          
          <creation_ts>2015-12-31 15:49:38 +0000</creation_ts>
          <short_desc>git fetcher does not support non git url format based requests</short_desc>
          <delta_ts>2016-01-15 15:06:21 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>BitBake</product>
          <component>bitbake</component>
          <version>2.2</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>claude</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>57500</commentid>
    <comment_count>0</comment_count>
      <attachid>2914</attachid>
    <who name="">claude</who>
    <bug_when>2015-12-31 15:49:38 +0000</bug_when>
    <thetext>Created attachment 2914
patch to make the changes as noted above.

Preconditions/Environment
-------------------------
create a private, secured git repository (e.g. bitbucket private repository)
add ssh key to access repository
create a x.bb file with
SRC_URI = &quot;git://git@bitbucket.org:&lt;username&gt;/&lt;repository&gt;.git;rev=foo&quot;


Triggering Action/Cause
-----------------------
execute bitbake x

Expectation
-----------
code should be checked out

Actual Result
-------------
DEBUG: Fetcher accessed the network with the command git -c core.fsyncobjectfiles=0 ls-remote git://git@bitbucket.org:claudenw/lion.git

ERROR: Function failed: Fetcher failure: Fetch command failed with exit code 128, output: 
 fatal: unable to connect to git@bitbucket.org:
 git@bitbucket.org: Servname not supported for ai_socktype

The error is that the git command does not like the git:// on the url within the git command.  

setting protocol=ssh
yeilds:
DEBUG: Fetcher accessed the network with the command git -c core.fsyncobjectfiles=0 ls-remote ssh://git@bitbucket.org:claudenw/lion.git

ERROR: Function failed: Fetcher failure: Fetch command failed with exit code 128, output:
 conq: invalid repository syntax.
 fatal: Could not read from remote repository.

Reproducibility
---------------
100%

SOLUTION
--------

Need a mechanism to remove the git:// (ssh://) from the url presented to the internal git command.  this can be done by modifying git.py  (patch attached)

line 104 add &apos;none&apos; as a valid protocol type

change line 333 to be 
        if ud.proto != &apos;none&apos;:  
            return &quot;%s://%s%s%s&quot; % (ud.proto, username, ud.host, ud.path)
        return &quot;%s%s%s&quot; % (username, ud.host, ud.path)

This adds protocol=none as a valid option to the URL.

SRC_URI = &quot;git://git@bitbucket.org:&lt;username&gt;/&lt;repository&gt;.git;rev=foo;protocol=none&quot;

then works as expected.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57617</commentid>
    <comment_count>1</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2016-01-07 11:25:56 +0000</bug_when>
    <thetext>I don&apos;t like the idea of a &quot;none&quot; type, not sure that makes sense since it really is using the ssh backend. Two different syntaxes for the same thing is bad.

It appears its actually the bitbucket server which can&apos;t cope with this (which is why there is a mention of conq in the error message).

Your patch happens to work by having the &quot;:&quot; in the SRC_URI when combined with the protocol=none parameter which is also a bit ugly.

I&apos;m wondering if a better solution is simple to modify _get_repo_url like this:

             username = &quot;&quot;
+        if ud.proto == &quot;ssh&quot;:
+            # Some servers, e.g. bitbucket.org can&apos;t cope with ssh://
+            # and removing that means we need a : before path.
+            return &quot;%s%s:%s&quot; % (username, ud.host, ud.path)
         return &quot;%s://%s%s%s&quot; % (ud.proto, username, ud.host, ud.path)

which then change all ssh urls to use the other syntax. This is more in line with what people use from the commandline.

I would maintain that its the bitbucket server which is broken here mind since git does usually accept this syntax, e.g.:

$ git ls-remote ssh://git@git.yoctoproject.org/psplash 
88343ad23c90fa1dd8d79ac0d784a691aa0c6d2b	HEAD
88343ad23c90fa1dd8d79ac0d784a691aa0c6d2b	refs/heads/master</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57691</commentid>
    <comment_count>2</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2016-01-08 19:21:03 +0000</bug_when>
    <thetext>http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=221d864042658daa054281aab439b44d54fe94d7</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57866</commentid>
    <comment_count>3</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2016-01-15 15:06:21 +0000</bug_when>
    <thetext>Upon further investigation we&apos;ve reverted the patch. I suspect the original problem was a &quot;:&quot; in the url where there should be a &quot;/&quot; character. If you continue to have issues when using a &quot;/&quot; and protocol=ssh, please reopen the bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>2914</attachid>
            <date>2015-12-31 15:49:38 +0000</date>
            <delta_ts>2015-12-31 15:49:38 +0000</delta_ts>
            <desc>patch to make the changes as noted above.</desc>
            <filename>git.py.patch</filename>
            <type>text/plain</type>
            <size>987</size>
            <attacher>claude</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL2JpdGJha2UvbGliL2JiL2ZldGNoMi9naXQucHkgYi9iaXRiYWtlL2xpYi9i
Yi9mZXRjaDIvZ2l0LnB5CmluZGV4IDliZDg3YWQuLjI1ZTY0NWIgMTAwNjQ0Ci0tLSBhL2JpdGJh
a2UvbGliL2JiL2ZldGNoMi9na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lvbl9rZXkoc2VsZiwgdWQsIGQsIG5h
bWUpOgogICAgICAgICAiIiIK
</data>

          </attachment>
      

    </bug>

</bugzilla>