Bug 12728 - git fetcher: Fixed remote removal not throwing exception on failure.
Summary: git fetcher: Fixed remote removal not throwing exception on failure.
Status: RESOLVED FIXED
Alias: None
Product: BitBake
Classification: Build System, Metadata & Runtime
Component: bitbake (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium normal
Target Milestone: 2.6
Assignee: Paulo Neves
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2018-05-02 08:33 UTC by Paulo Neves
Modified: 2018-08-30 09:29 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments
Patch that allows for earlier failure message. (2.16 KB, patch)
2018-05-02 08:33 UTC, Paulo Neves
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paulo Neves 2018-05-02 08:33:52 UTC
Created attachment 4295 [details]
Patch that allows for earlier failure message.

A caught exception in runfectcmd is assumed to always be benign when it is not.

Before this fix it is assumed that the removal of the
remote can only fail because there is not remote to remove. This
is a false assumption. Example error which would be ignored:
    
git -c core.fsyncobjectfiles=0 remote rm origin failed with exit code 1, output:
Note: A branch outside the refs/remotes/ hierarchy was not removed;
to delete it, use:
git branch -d master
error: could not lock config file config
error: Could not remove config section 'remote.origin'

Due to the masking of this error a stranger error will be
presented to the user, because this time we do not mask the
exception:
    
git -c core.fsyncobjectfiles=0 remote add --mirror=fetch origin https://github.com/ptsneves/tl-wn722.git failed with exit code 128, output:
fatal: remote origin already exists.
    
The most likely reason that the remote cannot be removed nor
modified is that the DL_DIR/git2 does not have write permissions
compatible with the user running bitbake.

This happened to me while pointing to a pre-populated download directory. The patch below allowed me to see the true nature of the problems I was facing.
Comment 1 Stephano Cetola 2018-05-03 08:06:32 UTC
Thank you for the patch. I think this will require some discussion on the bitbake mailing list. Please send this in:

https://www.openembedded.org/wiki/Mailing_lists

For more info on submitting patches:

https://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded

Thanks!
Comment 2 Paulo Neves 2018-08-28 14:12:49 UTC
Submitted patch to bitbake-devel. I was getting some emails to solve this..so i finally did it.
Comment 3 Richard Purdie 2018-08-30 09:29:36 UTC
Thanks, the patch merged so we can resolve this: http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=a8368651ffed1bd6c4715a37dfe9f40c48ca23c4

(Chris Larson did comment on the patch with a small tweak we might also want to add)