check-package: support symlinks to the script
PATCH 1/1 check-package: support symlinks to the script
The check-package script finds base_dir (= the Buildroot directory) and cd's into it. To be able to support relative paths as arguments, it first recalculates the arguments relative to base_dir.
However, if there is a symlink anywhere on the path to the check-package script, the relative paths will be wrong. To solve this, use realpath() instead of abspath(), so symlinks are resolved before calculating the relative path.
--- utils/check-package | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
utils/check-package +1 -1
@@ -143,7 +143,7 @@ def __main__(): if flags.intree_only: # change all paths received to be relative to the base dir - base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + base_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) files_to_check = [os.path.relpath(os.path.abspath(f), base_dir) for f in flags.files] # move current dir so the script find the files os.chdir(base_dir)
Signature · 1 line
2.16.3
PATCH 1/1 check-package: support symlinks to the script
Hello,
Quoted 11 lines · Arnout Vandecappelle (Essensium/Mind)
The check-package script finds
base_dir(= the Buildroot directory) and cd's into it. To be able to support relative paths as arguments, it first recalculates the arguments relative tobase_dir.However, if there is a symlink anywhere on the path to the check-package script, the relative paths will be wrong. To solve this, use
realpath()instead ofabspath(), so symlinks are resolved before calculating the relative path.Cc Ricardo Martincoski <[email protected]>
Sorry. I forgot about this use case.
Thank you for fixing it.
Regards,
Ricardo
PATCH 1/1 check-package: support symlinks to the script
In reply to Arnout Vandecappelle (Essensium/Mind)Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Arnout" == Arnout Vandecappelle (Essensium/Mind) <[email protected]> writes:
The check-package script finds
base_dir(= the Buildroot directory) and cd's into it. To be able to support relative paths as arguments, it first recalculates the arguments relative tobase_dir.
Quoted 7 lines
However, if there is a symlink anywhere on the path to the check-package script, the relative paths will be wrong. To solve this, use
realpath()instead ofabspath(), so symlinks are resolved before calculating the relative path.Cc Ricardo Martincoski <[email protected]>
Committed, thanks.
Signature · 1 line
Bye, Peter Korsgaard