All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] core: ensure we use the realpath(3) of DL_DIR
@ 2018-11-15 17:03 Yann E. MORIN
  2018-11-18 18:38 ` Peter Korsgaard
  2018-11-26 16:15 ` Peter Korsgaard
  0 siblings, 2 replies; 3+ messages in thread
From: Yann E. MORIN @ 2018-11-15 17:03 UTC (permalink / raw)
  To: buildroot

When $(TOPDIR)/dl is a symlink, checking out git submodules can fail,
as reported by Michael in #11086.

To reproduce a similarly-related mis-behaviour:

    $ mkdir -p foo/bar foo/buz
    $ cd foo/bar
    $ ln -s ../buz meh
    $ cd meh
    $ cd ../../foo

The last command should not succeed, because, relative to meh, there is
no ../../foo directory; we would expect it to be ../../../foo, instead.
But since meh is a symlink to a directory, then a relative path from that
symlink is interpreted as relative to the derefrenced directory, i.e.
from buz in this case.

But where this gine even werider, is that, if the last command is
replaced by:

    $ cd ../../../foo

then it still works, too.

And that is the root of Michael's issue: the dl directory in Buildroot's
TOPDIR is a symlink to a similarly-named directory one directory higher,
which then confuses relative paths, which gets especially and noticeably
bad for git submodules.

Avoid this strangeness, and just use so-called "physical" path, i.e. a
path where all symlinks to directories have been dereferenced.

Fixes: #11086

Reported-by: Michael Nosthoff <posted@heine.so>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Michael Nosthoff <posted@heine.so>
---
 package/pkg-download.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/pkg-download.mk b/package/pkg-download.mk
index 73ea2a69f8..0def845cbc 100644
--- a/package/pkg-download.mk
+++ b/package/pkg-download.mk
@@ -32,8 +32,8 @@ else
 BR2_DL_DIR = $(DL_DIR)
 endif
 
-# ensure it exists and a absolute path
-DL_DIR := $(shell mkdir -p $(DL_DIR) && cd $(DL_DIR) >/dev/null && pwd)
+# ensure it exists and a absolute path, derefrecing symlinks
+DL_DIR := $(shell mkdir -p $(DL_DIR) && cd $(DL_DIR) >/dev/null && pwd -P)
 
 #
 # URI scheme helper functions
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] core: ensure we use the realpath(3) of DL_DIR
  2018-11-15 17:03 [Buildroot] [PATCH] core: ensure we use the realpath(3) of DL_DIR Yann E. MORIN
@ 2018-11-18 18:38 ` Peter Korsgaard
  2018-11-26 16:15 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2018-11-18 18:38 UTC (permalink / raw)
  To: buildroot

>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

 > When $(TOPDIR)/dl is a symlink, checking out git submodules can fail,
 > as reported by Michael in #11086.

 > To reproduce a similarly-related mis-behaviour:

 >     $ mkdir -p foo/bar foo/buz
 >     $ cd foo/bar
 >     $ ln -s ../buz meh
 >     $ cd meh
 >     $ cd ../../foo

 > The last command should not succeed, because, relative to meh, there is
 > no ../../foo directory; we would expect it to be ../../../foo, instead.
 > But since meh is a symlink to a directory, then a relative path from that
 > symlink is interpreted as relative to the derefrenced directory, i.e.
 > from buz in this case.

 > But where this gine even werider, is that, if the last command is
 > replaced by:

 >     $ cd ../../../foo

 > then it still works, too.

 > And that is the root of Michael's issue: the dl directory in Buildroot's
 > TOPDIR is a symlink to a similarly-named directory one directory higher,
 > which then confuses relative paths, which gets especially and noticeably
 > bad for git submodules.

 > Avoid this strangeness, and just use so-called "physical" path, i.e. a
 > path where all symlinks to directories have been dereferenced.

 > Fixes: #11086

 > Reported-by: Michael Nosthoff <posted@heine.so>
 > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
 > Cc: Michael Nosthoff <posted@heine.so>

Committed, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] core: ensure we use the realpath(3) of DL_DIR
  2018-11-15 17:03 [Buildroot] [PATCH] core: ensure we use the realpath(3) of DL_DIR Yann E. MORIN
  2018-11-18 18:38 ` Peter Korsgaard
@ 2018-11-26 16:15 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2018-11-26 16:15 UTC (permalink / raw)
  To: buildroot

>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

 > When $(TOPDIR)/dl is a symlink, checking out git submodules can fail,
 > as reported by Michael in #11086.

 > To reproduce a similarly-related mis-behaviour:

 >     $ mkdir -p foo/bar foo/buz
 >     $ cd foo/bar
 >     $ ln -s ../buz meh
 >     $ cd meh
 >     $ cd ../../foo

 > The last command should not succeed, because, relative to meh, there is
 > no ../../foo directory; we would expect it to be ../../../foo, instead.
 > But since meh is a symlink to a directory, then a relative path from that
 > symlink is interpreted as relative to the derefrenced directory, i.e.
 > from buz in this case.

 > But where this gine even werider, is that, if the last command is
 > replaced by:

 >     $ cd ../../../foo

 > then it still works, too.

 > And that is the root of Michael's issue: the dl directory in Buildroot's
 > TOPDIR is a symlink to a similarly-named directory one directory higher,
 > which then confuses relative paths, which gets especially and noticeably
 > bad for git submodules.

 > Avoid this strangeness, and just use so-called "physical" path, i.e. a
 > path where all symlinks to directories have been dereferenced.

 > Fixes: #11086

 > Reported-by: Michael Nosthoff <posted@heine.so>
 > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
 > Cc: Michael Nosthoff <posted@heine.so>

Committed to 2018.02.x and 2018.08.x, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-26 16:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-15 17:03 [Buildroot] [PATCH] core: ensure we use the realpath(3) of DL_DIR Yann E. MORIN
2018-11-18 18:38 ` Peter Korsgaard
2018-11-26 16:15 ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.