Re: [PATCH v6 1/6] submodules: add helper functions to determine presence of submodules
- From
- Brandon Williams <bmwill@google.com>
- Date
- Dec 2, 2016, 21:46 UTC
- Message-ID
- <20161202214603.GD117792@google.com>
- In-Reply-To
- <CA+P7+xpJ1=TiWq60wO4ftA-Y6SHAkdbLk=srbTQQsB=D1ZGkrw@mail.gmail.com>
On 12/02, Jacob Keller wrote:
Show 22 quoted lines
> On Fri, Dec 2, 2016 at 11:28 AM, Stefan Beller <sbeller@google.com> wrote: > > On Fri, Dec 2, 2016 at 11:20 AM, Jacob Keller <jacob.keller@gmail.com> wrote: > >>> > >>> So is there a reason why the library function realpath() can't be used? > >>> From a cursory look at its man page it seems to do the symlink > >>> resolution. > >>> > >>> -- > >>> Brandon Williams > >> > >> I believe it uses the same method and thus wouldn't actually resolve > >> the issue. But I'm not really 100% sure on this. > >> > >> Thanks, > >> Jake > > > > 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. Would this be portable to Windows, though?
Perhaps. It looks like the only crazy thing it does is use readlink, which our real_path function is already doing. I don't think we could drop in their implementation though since there are other things that it does that aren't portable to windows (like determining if a path is absolute or not). Rather their implementation gives me some hope that it is possible to resolve the real path without using chdir.
-- Brandon Williams