git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Rast <trast@student.ethz.ch>
To: git@vger.kernel.org
Subject: Segfault when cloning http:// without libcurl
Date: Tue, 27 May 2008 11:24:36 +0200	[thread overview]
Message-ID: <200805271124.50172.trast@student.ethz.ch> (raw)

[-- Attachment #1: Type: text/plain, Size: 1902 bytes --]

Hi all

1.5.6.rc0.15.gd513 segfaults when attempting to clone from a http://
repository if compiled without libcurl:

(gdb) run clone http://repo.or.cz/r/git-homepage.git/
[..]
error: git was compiled without libcurl support.

Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
(gdb) bt
#0  0x00000000 in ?? ()
#1  0x080dd18d in transport_get_remote_refs (transport=0x814dbf0) at transport.c:795
#2  0x0805d24b in cmd_clone (argc=1, argv=0xbfda0ae8, prefix=0x0) at builtin-clone.c:461
#3  0x0804adbf in handle_internal_command (argc=2, argv=0xbfda0ae8) at git.c:249
#4  0x0804afa9 in main (argc=2, argv=0xbfda0ae8) at git.c:444
(gdb) up
#1  0x080dd18d in transport_get_remote_refs (transport=0x814dbf0) at transport.c:795
795                     transport->remote_refs = transport->get_refs_list(transport);

The underlying problem seems to be that at builtin-clone.c:160, no
error checking is done on the output of transport_get():

	transport = transport_get(remote, ref_git_copy);
	for (extra = transport_get_remote_refs(transport); extra;
	     extra = extra->next)
		add_extra_ref(extra->name, extra->old_sha1, 0);

But transport_get() never sets the ->get_refs_list() member if libcurl
wasn't enabled at compile time, cf. transport.c:738:

#ifdef NO_CURL
		error("git was compiled without libcurl support.");
#else
		ret->get_refs_list = get_refs_via_curl;
		ret->fetch = fetch_objs_via_curl;
		ret->push = curl_transport_push;
#endif

Some digging shows that at the time the above #ifdef was inserted
(ccfc02a3), there was no builtin-clone.c, so the error checking
probably got lost in the translation.

I'd attempt to write a patch, but it looks like I would have to read
into a lot of code for a fairly trivial issue, so I hope someone can
help me out with this...

- Thomas

-- 
Thomas Rast
trast@student.ethz.ch



[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

             reply	other threads:[~2008-05-27  9:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-27  9:24 Thomas Rast [this message]
2008-05-27 14:28 ` [PATCH] clone: make sure we support the transport type Jeff King
2008-05-27 16:30   ` Mike Hommey
2008-05-27 17:49     ` Daniel Barkalow
2008-05-27 18:05   ` Daniel Barkalow

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=200805271124.50172.trast@student.ethz.ch \
    --to=trast@student.ethz.ch \
    --cc=git@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).