From mboxrd@z Thu Jan 1 00:00:00 1970 From: Felipe Contreras Subject: Re: [Administrivia] On ruby and contrib/ Date: Sat, 8 Jun 2013 12:40:19 -0500 Message-ID: References: <7vtxld30f2.fsf@alter.siamese.dyndns.org> <7va9n52zjc.fsf@alter.siamese.dyndns.org> <20130608171513.GA28029@sigill.intra.peff.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Cc: Duy Nguyen , Johannes Schindelin , Greg Troxel , Junio C Hamano , Git Mailing List , Jonathan Nieder , Thomas Rast , =?UTF-8?Q?Ren=C3=A9_Scharfe?= , Michael Haggerty , Matthieu Moy , Ramsay Jones , Erik Faye-Lund , Johannes Sixt To: Jeff King X-From: git-owner@vger.kernel.org Sat Jun 08 19:40:30 2013 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UlN7s-0000ou-Hc for gcvg-git-2@plane.gmane.org; Sat, 08 Jun 2013 19:40:28 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752253Ab3FHRkW (ORCPT ); Sat, 8 Jun 2013 13:40:22 -0400 Received: from mail-lb0-f182.google.com ([209.85.217.182]:36306 "EHLO mail-lb0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751276Ab3FHRkV (ORCPT ); Sat, 8 Jun 2013 13:40:21 -0400 Received: by mail-lb0-f182.google.com with SMTP id r11so4144331lbv.27 for ; Sat, 08 Jun 2013 10:40:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=AtRWP7aTRwqX6a3t7UFeh4zgEdGAKs0cZ0FGfYL0e9A=; b=gQqicRjovJIFrL7wPyyQ8LtiigqENaGnlCbSvVWzEosKkUP+QflSuceTbR4DxqJjXz fUa4LWij5c/okvLhr4HsSmknxtgohH3NvGJ1QNXWpOWAiOLhgLKZo/ycoa7cngtcUfhY THj+QsRuVcuOog9q+TVWWM3la0qSwrKhK+yGPEiAZzv3C0RsO3Q5Lt3NAyqNg4dBfnUf smDnAkN5JMGUTNLXO23jMJ01ruh0vSxjYTck30kJ8WFX1pugviV1joQOPZ2Ypkianqtv a12pkRS1wbs6KhLAJrXFqUbRvXdY7Z7SfqVNsC7wAs0sdBxOXdF5BTACs88bxCsIukNz Uc2Q== X-Received: by 10.152.27.170 with SMTP id u10mr1699253lag.45.1370713220015; Sat, 08 Jun 2013 10:40:20 -0700 (PDT) Received: by 10.114.59.202 with HTTP; Sat, 8 Jun 2013 10:40:19 -0700 (PDT) In-Reply-To: <20130608171513.GA28029@sigill.intra.peff.net> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: On Sat, Jun 8, 2013 at 12:15 PM, Jeff King wrote: > On Sat, Jun 08, 2013 at 08:20:28AM -0500, Felipe Contreras wrote: > >> > There are a lot of static variables in builtin/ (and outside too), >> > which make it non-entrant, or at least not safe. >> >> So? >> >> > fork provides a process space isolation, some depend on that. >> >> Process space isolation from what? > > Manipulation of global variables. Here are a few examples off the top of > my head: > > Try running "git diff" from your Ruby hook, then try running "git > diff-files" within the same process. I believe the latter will start > respecting porcelain diff config like diff.mnemonicprefix. To clear > state you need to reset a list of global variables back to their initial > states (some of which are the BSS-default zero, but some of which are > not). > > Try running "git log" followed by another "git log". The log family of > commands does not clear its marks from the commit objects, since it > expects to exit after the traversal. The second log will sometimes give > wrong answers if its traversal overlaps with the first (e.g., commits > marked SEEN or UNINTERESTING that should not be). You can add a call to > clear them at the end of the process, but that does not cover any cases > where we die(). > > These are problems that can be solved. But there is a lot of work > involved in finding these subtle bugs and coming up with fixes. I think > you would be better off working on an implementation of git that was > designed from scratch to work in-process, like libgit2. So you are in favor of never ever having an official Git library. Got it. > libgit2 doesn't have feature parity with regular git yet, but there are > many clients based around it that use the library internally for speed, > and then exec regular git to fill in the gaps. There's a reason why the Git project doesn't use libgit2, and for the same reason the official Ruby scripts should not use it. As history indicates, the Git project will never have any pressure to fix it's re-entrancy and re-run issues, so these issues will remain there forever. Only if you allow code that exposes those issues will there ever be any pressure to fix them. -- Felipe Contreras