From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-5.5 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 047E81FC96 for ; Fri, 2 Dec 2016 21:46:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932390AbcLBVqc (ORCPT ); Fri, 2 Dec 2016 16:46:32 -0500 Received: from cloud.peff.net ([104.130.231.41]:50883 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751577AbcLBVqa (ORCPT ); Fri, 2 Dec 2016 16:46:30 -0500 Received: (qmail 9328 invoked by uid 109); 2 Dec 2016 21:45:31 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.84) with SMTP; Fri, 02 Dec 2016 21:45:31 +0000 Received: (qmail 15708 invoked by uid 111); 2 Dec 2016 21:46:08 -0000 Received: from sigill.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.7) by peff.net (qpsmtpd/0.84) with SMTP; Fri, 02 Dec 2016 16:46:08 -0500 Received: by sigill.intra.peff.net (sSMTP sendmail emulation); Fri, 02 Dec 2016 16:45:29 -0500 Date: Fri, 2 Dec 2016 16:45:29 -0500 From: Jeff King To: Stefan Beller Cc: Jacob Keller , Brandon Williams , Junio C Hamano , "git@vger.kernel.org" , Jonathan Tan Subject: Re: [PATCH v6 1/6] submodules: add helper functions to determine presence of submodules Message-ID: <20161202214529.mjekdaixrdoyroxq@sigill.intra.peff.net> References: <20161201191603.GB54082@google.com> <20161201205444.GG54082@google.com> <20161201205944.2py2ijranq4g2wap@sigill.intra.peff.net> <20161201215934.g7dt5ioekmx6ssii@sigill.intra.peff.net> <20161202183622.GB117792@google.com> <20161202184944.GC117792@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Fri, Dec 02, 2016 at 11:28:49AM -0800, Stefan Beller wrote: > I just reviewed 2 libc implementations (glibc and an Android libc) and > both of them > do not use chdir internally, but use readlink and compose the path 'manually' > c.f. http://osxr.org:8080/glibc/source/stdlib/canonicalize.c?v=glibc-2.13 Interesting. It might be worth updating our implementation. The original comes all the way from 54f4b8745 (Library code for user-relative paths, take three., 2005-11-17). That references a suggestion which I think comes from: http://public-inbox.org/git/Pine.LNX.4.64.0510181728490.3369@g5.osdl.org/ where it's claimed to be simpler and more efficient (which sounds plausible to me). But back then it was _just_ git-daemon doing a canonicalization, and nobody cared about things like thread safety. Looking at the glibc implementation, it's really not that bad. We _could_ even rely on the system realpath() and just provide our own fallback for systems without it, but I think ours might be a little more featureful (at the very least, it handles arbitrary-sized paths via strbufs). -Peff