Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 572312 - git-r3.eclass fails to src_unpack() submodule as: "refusing to update ref with bad name"
Summary: git-r3.eclass fails to src_unpack() submodule as: "refusing to update ref wit...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Michał Górny
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-18 21:57 UTC by Sergei Trofimovich (RETIRED)
Modified: 2016-02-05 14:37 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergei Trofimovich (RETIRED) gentoo-dev 2016-01-18 21:57:34 UTC
Example ebuild:

    # cat ghc-99999.ebuild 
    EAPI=5
    inherit git-r3
    SLOT=0
    EGIT_REPO_URI="https://git.haskell.org/ghc.git"

referring seemingly problematic submodule:

    [submodule ".arc-linters/arcanist-external-json-linter"]
            path = .arc-linters/arcanist-external-json-linter
            url = ../arcanist-external-json-linter.git

(full .gitmodules: http://git.haskell.org/ghc.git/blob/b8abd852d3674cb485490d2b2e94906c06ee6e8f:/.gitmodules#l118 )

fails as:

    $ ebuild ghc-99999.ebuild clean unpack

>>> Unpacking source...
 * Fetching https://git.haskell.org/ghc.git ...
git fetch https://git.haskell.org/ghc.git +HEAD:refs/git-r3/HEAD
git symbolic-ref refs/git-r3/dev-lang/ghc/0/__main__ refs/heads/master
 * Fetching https://git.haskell.org/packages/binary.git ...
...
 * Fetching https://git.haskell.org/arcanist-external-json-linter.git ...
git fetch https://git.haskell.org/arcanist-external-json-linter.git --prune +refs/heads/*:refs/heads/* +refs/tags/*:refs/tags/* +refs/notes/*:refs/notes/* +HEAD:refs/git-r3/HEAD
git update-ref --no-deref refs/git-r3/dev-lang/ghc/0/.arc-linters/arcanist-external-json-linter/__main__ 85ece0f8653e7b1e7de6024d372cfeaf36ab5fa9
fatal: update_ref failed for ref 'refs/git-r3/dev-lang/ghc/0/.arc-linters/arcanist-external-json-linter/__main__': refusing to update ref with bad name refs/git-r3/dev-lang/ghc/0/.arc-linters/arcanist-external-json-linter/__main__
 * ERROR: dev-lang/ghc-99999::haskell failed (unpack phase):
 *   Referencing 85ece0f8653e7b1e7de6024d372cfeaf36ab5fa9 failed (wrong ref?).
 * 
 * Call stack:
 *     ebuild.sh, line  133:  Called src_unpack
 *   environment, line 2476:  Called git-r3_src_unpack
 *   environment, line 1740:  Called git-r3_src_fetch
 *   environment, line 1734:  Called git-r3_fetch
 *   environment, line 1672:  Called git-r3_fetch 'https://git.haskell.org/arcanist-external-json-linter.git' '85ece0f8653e7b1e7de6024d372cfeaf36ab5fa9' 'dev-lang/ghc/0/.arc-linters/arcanist-external-json-linter'
 *   environment, line 1647:  Called die
 * The specific snippet of code:
 *                   die "Referencing ${remote_ref} failed (wrong ref?).";
 * 
 * If you need support, post the output of `emerge --info '=dev-lang/ghc-99999::haskell'`,
 * the complete build log and the output of `emerge -pqv '=dev-lang/ghc-99999::haskell'`.
 * The complete build log is located at '/tmp/portage/dev-lang/ghc-99999/temp/build.log'.
 * The ebuild environment file is located at '/tmp/portage/dev-lang/ghc-99999/temp/environment'.
 * Working directory: '/tmp/portage/dev-lang/ghc-99999/work'
 * S: '/tmp/portage/dev-lang/ghc-99999/work/ghc-99999'
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-01-20 15:40:50 UTC
I'll try to take a look at this today. If you happen to have some extra time, could you confirm whether it's complaining about the dot, or something else?
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2016-01-20 21:27:10 UTC
Removing a dot certainly changes error message into better direction:

ghc.git $ git update-ref --no-deref refs/git-r3/dev-lang/ghc/0/.arc-linters/arcanist-external-json-linter/__main__ 85ece0f8653e7b1e7de6024d372cfeaf36ab5fa9
fatal: update_ref failed for ref 'refs/git-r3/dev-lang/ghc/0/.arc-linters/arcanist-external-json-linter/__main__': refusing to update ref with bad name refs/git-r3/dev-lang/ghc/0/.arc-linters/arcanist-external-json-linter/__main__

ghcgit $ git update-ref --no-deref refs/git-r3/dev-lang/ghc/0/arc-linters/arcanist-external-json-linter/__main__ 85ece0f8653e7b1e7de6024d372cfeaf36ab5fa9
fatal: update_ref failed for ref 'refs/git-r3/dev-lang/ghc/0/arc-linters/arcanist-external-json-linter/__main__': cannot update the ref 'refs/git-r3/dev-lang/ghc/0/arc-linters/arcanist-external-json-linter/__main__': Trying to write ref refs/git-r3/dev-lang/ghc/0/arc-linters/arcanist-external-json-linter/__main__ with nonexistent object 85ece0f8653e7b1e7de6024d372cfeaf36ab5fa9
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2016-01-20 21:34:42 UTC
Looks like a good list: https://github.com/git/git/blob/master/refs.c#L39

/*
 * Try to read one refname component from the front of refname.
 * Return the length of the component found, or -1 if the component is
 * not legal.  It is legal if it is something reasonable to have under
 * ".git/refs/"; We do not like it if:
 *
 * - any path component of it begins with ".", or
 * - it has double dots "..", or
 * - it has ASCII control characters, or
 * - it has ":", "?", "[", "\", "^", "~", SP, or TAB anywhere, or
 * - it has "*" anywhere unless REFNAME_REFSPEC_PATTERN is set, or
 * - it ends with a "/", or
 * - it ends with ".lock", or
 * - it contains a "@{" portion
 */
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-02-05 13:10:02 UTC
I'm sorry this is taking this long. I'm currently working on it, and should have a solution today.

While at it, I've discovered that https://git.haskell.org seems not to support shallow clones:

git fetch https://git.haskell.org/ghc.git +HEAD:refs/git-r3/HEAD --depth 1
fatal: The remote end hung up unexpectedly
fatal: protocol error: bad pack header

In case you haven't noticed it, this means you'd need to set EGIT_MIN_CLONE_TYPE in the ebuild.
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-02-05 14:37:49 UTC
commit 9dd95690e6f4ff62d66595eb2e0f78c223b32a3e
Author: Michał Górny <mgorny@gentoo.org>
Date:   Fri Feb 5 15:35:19 2016

    git-r3.eclass: Filter out /. components from submodule refs, #572312