Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 24, 2020. It is now read-only.

Conversation

@glevand
Copy link
Contributor

@glevand glevand commented Oct 12, 2017

Use the current working directory and not MK_TOPLEVEL_ABS_SRCDIR when
processing 'go list' output in go-find-directories.

Our invocation of 'go list' in the go-find-directories function uses
paths relative to the current working directory and so the output of
that command will have file paths based on the current working
directory. The make file variable MK_TOPLEVEL_ABS_SRCDIR is initialized
with make's abspath function. The abspath function (GNU Make 4.1) will
resolve symlinks. This difference in resolved and unresolved symlinks
causes problems in the go-find-directories function output when building
from a path that includes a symlink.

Fixes 'make unit-check' errors like these when building in a directory
that has a symlink in its path:

stat ./_/home/runner/workspace/src/github.com/.../builds/build-rkt-none/api/v1: no such file or directory

Semaphore-ci uses symlinks, and that is where I found this problem.

Here's a simple test:

git clone https://github.com/coreos/rkt rkt-src
mkdir test
ln -s ../rkt-src test/
cd test/rkt-src
./tests/build-and-run-tests.sh -f none -c

@iaguis iaguis requested a review from krnowak October 13, 2017 10:23
@glevand
Copy link
Contributor Author

glevand commented Oct 18, 2017

Rebsaed to latest.
@krnowak: Please review.

@glevand
Copy link
Contributor Author

glevand commented Oct 26, 2017

Rebased to latest.

Use the current working directory and not MK_TOPLEVEL_ABS_SRCDIR when
processing 'go list' output in go-find-directories.

Our invocation of 'go list' in the go-find-directories function uses
paths relative to the current working directory and so the output of
that command will have file paths based on the current working
directory.  The make file variable MK_TOPLEVEL_ABS_SRCDIR is initialized
with make's abspath function.  The abspath function (GNU Make 4.1) will
resolve symlinks.  This difference in resolved and unresolved symlinks
causes problems in the go-find-directories function output when building
from a path that includes a symlink.

Fixes 'make unit-check' errors like these when building in a directory
that has a symlink in its path:

  stat ./_/home/runner/workspace/src/github.com/.../builds/build-rkt-none/api/v1: no such file or directory

Signed-off-by: Geoff Levand <[email protected]>
@glevand
Copy link
Contributor Author

glevand commented Jan 10, 2018

Rebased to latest. Please merge.

@krnowak
Copy link
Collaborator

krnowak commented Jan 10, 2018

I'll try to have a look at it tomorrow. I'm sorry for the delay.

@krnowak
Copy link
Collaborator

krnowak commented Jan 11, 2018

This is a bug in GNU Make I think. abspath does not normally resolve symlinks, but if you pass a relative path to it, the implementation of abspath is basically prepending the result of getcwd() to the passed path. getcwd() returns a current working directory with resolved symlinks. So there.

Looks like that the proper solution would be to fix this in GNU Make. And a "proper" workaround would be to replace all calls to abspath with shell cd $(FOO) && pwd.

So let's merge it - this PR is a one step closer to the "proper" workaround.

@krnowak krnowak merged commit 4e91dc7 into rkt:master Jan 11, 2018
@glevand glevand deleted the for-merge-symlink branch January 11, 2018 17:51
@iaguis iaguis added this to the 1.30.0 milestone Apr 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants