<div dir="ltr">This will try to rm origin even if there&#39;s an &#39;originfoo&#39; remote, as you don&#39;t check for an exact match on a line, but a general substring search. Unlikely, I admit, but we should still work as correctly as possible, I think.<br></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Aug 27, 2018 at 12:39 PM Paulo Neves &lt;<a href="mailto:ptsneves@gmail.com">ptsneves@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Before this fix it is assumed that the removal of the<br>
remote can only fail because there is not remote to remove. This<br>
is a false assumption. Example error which would be ignored:<br>
<br>
git -c core.fsyncobjectfiles=0 remote rm origin failed with exit code 1, output:<br>
Note: A branch outside the refs/remotes/ hierarchy was not removed;<br>
to delete it, use:<br>
  git branch -d master<br>
error: could not lock config file config<br>
error: Could not remove config section &#39;remote.origin&#39;<br>
<br>
Due to the masking of this error a stranger error will be<br>
presented to the user, because this time we do not mask the<br>
exception:<br>
<br>
git -c core.fsyncobjectfiles=0 remote add --mirror=fetch origin <a href="https://github.com/ptsneves/tl-wn722.git" rel="noreferrer" target="_blank">https://github.com/ptsneves/tl-wn722.git</a> failed with exit code 128, output:<br>
fatal: remote origin already exists.<br>
<br>
The most likely reason that the remote cannot be removed nor<br>
modified is that the DL_DIR/git2 does not have permissions<br>
compatible with the user running bitbake.<br>
<br>
This commit fixes:<br>
<a href="https://bugzilla.yoctoproject.org/show_bug.cgi?id=12728" rel="noreferrer" target="_blank">https://bugzilla.yoctoproject.org/show_bug.cgi?id=12728</a><br>
<br>
Signed-off-by: Paulo Neves &lt;<a href="mailto:ptsneves@gmail.com" target="_blank">ptsneves@gmail.com</a>&gt;<br>
---<br>
 bitbake/lib/bb/fetch2/git.py | 7 +++----<br>
 1 file changed, 3 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py<br>
index 612aac4..35da14d 100644<br>
--- a/bitbake/lib/bb/fetch2/git.py<br>
+++ b/bitbake/lib/bb/fetch2/git.py<br>
@@ -353,10 +353,9 @@ class Git(FetchMethod):<br>
                 break<br>
<br>
         if needupdate:<br>
-            try: <br>
-                runfetchcmd(&quot;%s remote rm origin&quot; % ud.basecmd, d, workdir=ud.clonedir)<br>
-            except bb.fetch2.FetchError:<br>
-                logger.debug(1, &quot;No Origin&quot;)<br>
+            output = runfetchcmd(&quot;%s remote&quot; % ud.basecmd, d, quiet=True, workdir=ud.clonedir)<br>
+            if &quot;origin&quot; in output:<br>
+              runfetchcmd(&quot;%s remote rm origin&quot; % ud.basecmd, d, workdir=ud.clonedir)<br>
<br>
             runfetchcmd(&quot;%s remote add --mirror=fetch origin %s&quot; % (ud.basecmd, repourl), d, workdir=ud.clonedir)<br>
             fetch_cmd = &quot;LANG=C %s fetch -f --prune --progress %s refs/*:refs/*&quot; % (ud.basecmd, repourl)<br>
-- <br>
2.7.4<br>
<br>
-- <br>
_______________________________________________<br>
bitbake-devel mailing list<br>
<a href="mailto:bitbake-devel@lists.openembedded.org" target="_blank">bitbake-devel@lists.openembedded.org</a><br>
<a href="http://lists.openembedded.org/mailman/listinfo/bitbake-devel" rel="noreferrer" target="_blank">http://lists.openembedded.org/mailman/listinfo/bitbake-devel</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr">Christopher Larson<br>kergoth at gmail dot com<br>Founder - BitBake, OpenEmbedded, OpenZaurus<br>Senior Software Engineer, Mentor Graphics</div></div></div></div>