Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] oe/path.py: copyhardlinktree: don't overwrite existing symlinks
@ 2017-08-16 11:13 Ioan-Adrian Ratiu
  2017-08-18  9:53 ` Richard Purdie
  0 siblings, 1 reply; 3+ messages in thread
From: Ioan-Adrian Ratiu @ 2017-08-16 11:13 UTC (permalink / raw)
  To: openembedded-core; +Cc: haris.okanovic, ken.sharp

Starting with tar>=1.26 the default behaviour when extracting is to
overwrite symlinks and a '-h' flag was added for tar to follow them.

The primary use case for this is to allow ${DEPLOY_DIR_IPK/RPM/DEB} to
be symlinks and avoid copyhardlinktree replacing those symlinks with a
normal directory.

Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
---
 meta/lib/oe/path.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/lib/oe/path.py b/meta/lib/oe/path.py
index 448a2b944e..1ea03d5d56 100644
--- a/meta/lib/oe/path.py
+++ b/meta/lib/oe/path.py
@@ -98,7 +98,7 @@ def copyhardlinktree(src, dst):
     if (os.stat(src).st_dev ==  os.stat(dst).st_dev):
         # Need to copy directories only with tar first since cp will error if two 
         # writers try and create a directory at the same time
-        cmd = "cd %s; find . -type d -print | tar --xattrs --xattrs-include='*' -cf - -C %s -p --no-recursion --files-from - | tar --xattrs --xattrs-include='*' -xf - -C %s" % (src, src, dst)
+        cmd = "cd %s; find . -type d -print | tar --xattrs --xattrs-include='*' -cf - -C %s -p --no-recursion --files-from - | tar --xattrs --xattrs-include='*' -xhf - -C %s" % (src, src, dst)
         subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
         source = ''
         if os.path.isdir(src):
-- 
2.14.0



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

* Re: [PATCH] oe/path.py: copyhardlinktree: don't overwrite existing symlinks
  2017-08-16 11:13 [PATCH] oe/path.py: copyhardlinktree: don't overwrite existing symlinks Ioan-Adrian Ratiu
@ 2017-08-18  9:53 ` Richard Purdie
  2017-08-21 10:45   ` Ioan-Adrian Ratiu
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Purdie @ 2017-08-18  9:53 UTC (permalink / raw)
  To: Ioan-Adrian Ratiu, openembedded-core; +Cc: haris.okanovic, ken.sharp

On Wed, 2017-08-16 at 14:13 +0300, Ioan-Adrian Ratiu wrote:
> Starting with tar>=1.26 the default behaviour when extracting is to
> overwrite symlinks and a '-h' flag was added for tar to follow them.
> 
> The primary use case for this is to allow ${DEPLOY_DIR_IPK/RPM/DEB}
> to
> be symlinks and avoid copyhardlinktree replacing those symlinks with
> a
> normal directory.
> 
> Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
> ---
>  meta/lib/oe/path.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Does the -h option exist for tar < 1.26?

Cheers,

Richard


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

* Re: [PATCH] oe/path.py: copyhardlinktree: don't overwrite existing symlinks
  2017-08-18  9:53 ` Richard Purdie
@ 2017-08-21 10:45   ` Ioan-Adrian Ratiu
  0 siblings, 0 replies; 3+ messages in thread
From: Ioan-Adrian Ratiu @ 2017-08-21 10:45 UTC (permalink / raw)
  To: Richard Purdie, openembedded-core; +Cc: haris.okanovic, ken.sharp

On Fri, 18 Aug 2017, Richard Purdie <richard.purdie@linuxfoundation.org> wrote:
> On Wed, 2017-08-16 at 14:13 +0300, Ioan-Adrian Ratiu wrote:
>> Starting with tar>=1.26 the default behaviour when extracting is to
>> overwrite symlinks and a '-h' flag was added for tar to follow them.
>>
>> The primary use case for this is to allow ${DEPLOY_DIR_IPK/RPM/DEB}
>> to
>> be symlinks and avoid copyhardlinktree replacing those symlinks with
>> a
>> normal directory.
>>
>> Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
>> ---
>>  meta/lib/oe/path.py | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Does the -h option exist for tar < 1.26?

Actually it was introduced for extraction in tar 1.24, but for the
archiving command it existed much longer (I went back and confirmed
until release 1.14 in 2004 where the tar git log ends).

The tar git commit which added -h for extraction in 1.24 is:
14efeb9f956e38d7be (tar: --dereference consistency)

-h is set by default when creating archives for systems supporting
symlinks, but -h when extracting is not set by default.

Sorry for the 1.24/1.26 mixup, I'll ammend the patch msg in v2.

Do you want me to do some version checking? (GNU tar 1.24 was released
in 2011).

Ionel

>
> Cheers,
>
> Richard
National Instruments Romania S.R.L.
------------------------------------------------------
B-dul 21 Decembrie 1989, nr. 77, A2
Cluj-Napoca 400604, Romania
C.I.F.: RO17961616 | O.R.C.: J12/3337/2005
Telefon: +40 264 406428 | Fax: +40 264 406429
E-mail: office.cluj@ni.com
Web: romania.ni.com

Vanzari si suport tehnic:
Telefon gratuit : 0800 070071
E-mail vanzari: ni.romania@ni.com
E-mail suport tehnic: techsupport@ni.com


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

end of thread, other threads:[~2017-08-21  7:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-16 11:13 [PATCH] oe/path.py: copyhardlinktree: don't overwrite existing symlinks Ioan-Adrian Ratiu
2017-08-18  9:53 ` Richard Purdie
2017-08-21 10:45   ` Ioan-Adrian Ratiu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox