Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: bugzilla@busybox.net
To: buildroot@uclibc.org
Subject: [Buildroot] [Bug 14841] New: support/download/git fails with "fatal: No such remote 'origin'" due to incorrect check for origin remote
Date: Fri, 10 Jun 2022 23:57:55 +0000	[thread overview]
Message-ID: <bug-14841-163@https.bugs.busybox.net/> (raw)

https://bugs.busybox.net/show_bug.cgi?id=14841

            Bug ID: 14841
           Summary: support/download/git fails with "fatal: No such remote
                    'origin'" due to incorrect check for origin remote
           Product: buildroot
           Version: 2020.02.10
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Other
          Assignee: unassigned@buildroot.uclibc.org
          Reporter: bmurdock@gmail.com
                CC: buildroot@uclibc.org
  Target Milestone: ---

The git script does the following:

- initializes a git repo
- checks if the remote named origin exists
- if it exists, it call git remote set-url to set the correct url for the
origin remote

The problem is, it uses the command 'git remote | grep '^origin$'' to check if
origin exists.  This command always prints the word origin, even if the origin
remote doesn't actually exist in the repo.  It's unfortunate, but that's how
git works.  On a brand new git repo, origin does not exist, but this part of
the script believes it does exist, so it calls git remote set-url which then
fails because origin doesn't exist.

In my project I noticed two packages, flashbench and mmc_utils that use the git
download method and it fails for both of them.  The packages still succeed
because they fallback to a different download method.  I can imagine that's one
reason why this has not been noticed.

You will also not see this error if the git repo already exists with an actual
origin remote that has been configured.

The proper way to check if origin exists is to do this:

if ! git config remote.origin.url | /dev/null; then...

I have a patch for this and I will work on sending it to the mailing list.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

             reply	other threads:[~2022-06-10 23:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-10 23:57 bugzilla [this message]
2022-06-10 23:59 ` [Buildroot] [Bug 14841] support/download/git fails with "fatal: No such remote 'origin'" due to incorrect check for origin remote bugzilla
2022-06-13  8:15 ` [Buildroot] [Bug 14841] New: " Edgar Bonet
2022-06-14 19:55 ` [Buildroot] [Bug 14841] " bugzilla
2022-07-30 19:55 ` bugzilla
2022-10-24 20:09 ` bugzilla
2022-10-24 20:10 ` bugzilla
2024-06-15 15:03 ` bugzilla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-14841-163@https.bugs.busybox.net/ \
    --to=bugzilla@busybox.net \
    --cc=buildroot@uclibc.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox