[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#33893: [PATCH v5 2/4] gnu: Add docker-engine.
From: |
Ludovic Courtès |
Subject: |
bug#33893: [PATCH v5 2/4] gnu: Add docker-engine. |
Date: |
Thu, 10 Jan 2019 09:50:49 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Howdy!
Danny Milosavljevic <address@hidden> skribis:
> On Tue, 08 Jan 2019 09:42:14 +0100
> Ludovic Courtès <address@hidden> wrote:
>
>> > Go has peculiar ideas of how the directory layout is supposed to be set up.
>> > I could probably figure it out - but if someone with more Go knowledge
>> > could
>> > step forward it would be much faster.
>>
>> I see Leo is Cc’d so we’ll see. :-)
>
> Nevermind, I've fixed it and learned something in the process:
>
> Linux doesn't actually know the current working directory as a string.
> It only knows the inode, so if you call getcwd, what libc actually does is
> it opendirs "..", then finds the entry with the same inode number as
> the current directory, and then returns the name of that entry.
Are you sure? In the Linux port of glibc I see this:
--8<---------------cut here---------------start------------->8---
char *
__getcwd (char *buf, size_t size)
{
char *path;
char *result;
// […]
retval = INLINE_SYSCALL (getcwd, 2, path, alloc_size);
--8<---------------cut here---------------end--------------->8---
And indeed, there’s a ‘getcwd’ syscall:
--8<---------------cut here---------------start------------->8---
$ strace -e getcwd guile -c '(getcwd)'
getcwd("/home/ludo", 100) = 11
+++ exited with 0 +++
--8<---------------cut here---------------end--------------->8---
> Now, gopath uses symlinks to set up their preferred directory hierarchy
> in such a way:
>
> ln -s ../../../.. .gopath/src/github.com/docker/docker
>
> Now if you chdir into ".gopath/src/github.com/docker/docker" and then Go later
> does getcwd, it will appear as if the chdir did not succeed (because it will
> just use the old working directory because it has the same inode).
>
> So Go was erroring out because the directory structure there was *still*
> wrong.
>
> Solution: Set environment variable PWD to the correct name of the directory.
Great that you found a solution.
Thanks for taking the time to address this!
Ludo’.