Gabe Black has submitted this change and it was merged. (
https://gem5-review.googlesource.com/2542 )
Change subject: scons: Collapse symlinks when installing git hooks.
......................................................................
scons: Collapse symlinks when installing git hooks.
When naively computing the relative path between the git hooks directory
and a
hook we want to install, that will generally start with a few ".." path
components to work back out of the .git directory into the working
directory.'
If the hooks directory is actually a symlink, then following ".." directory
entries won't get us back to where we came from, they'll take us to the
actual
parent directory of hooks. The relative path we computed would then try to
go
forward from this other directory using a path that would have worked in the
working directory, hopefully going somewhere that doesn't exist, but
potentially going to a totally unrelated file with the same relative path.
To avoid this problem, we should expand any symlinks in both the hooks
directory path, and the path to the hook script. That way, any ".."
components
will go where we'd expect them to, and the relative path will actually go
from
hooks to the script we expect.
Change-Id: I64d51bc817351f89b1d60eceaf450cc0a4553415
Reviewed-on: https://gem5-review.googlesource.com/2542
Reviewed-by: Jason Lowe-Power <[email protected]>
Reviewed-by: Andreas Sandberg <[email protected]>
Maintainer: Andreas Sandberg <[email protected]>
---
M SConstruct
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
Jason Lowe-Power: Looks good to me, approved
Andreas Sandberg: Looks good to me, approved; Looks good to me, approved
diff --git a/SConstruct b/SConstruct
index fbc52cc..ce53a51 100755
--- a/SConstruct
+++ b/SConstruct
@@ -407,8 +407,8 @@
# and the hooks directory is not a symlink to an absolute path.
if hook.is_under(main.root) and not abs_symlink_hooks:
script_path = os.path.relpath(
- script.get_abspath(),
- hook.Dir(".").get_abspath())
+ os.path.realpath(script.get_abspath()),
+ os.path.realpath(hook.Dir(".").get_abspath()))
else:
script_path = script.get_abspath()
--
To view, visit https://gem5-review.googlesource.com/2542
To unsubscribe, visit https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I64d51bc817351f89b1d60eceaf450cc0a4553415
Gerrit-Change-Number: 2542
Gerrit-PatchSet: 4
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev