[poky] [Errno 18] Invalid cross-device link warning coming from license file copy

matti kaasinen matti.kaasinen at gmail.com
Tue Aug 25 07:02:49 PDT 2015


Hi!
It is not that easy for me to get rid of these mount points on same drive
as they are made in /etc/fstab file. If I unmount any mountpoint, it does
not have any directory to show anymore. Therefore I need to make some
workaround. Really, system call stat does not recognize mount points on the
same drive. However, df command does recognize. Therefore I'm considering
workaround for this problem using df. Unfortunately it is required to use
pipe for getting results from df. I need to modify
if os.access(src, os.W_OK) and (os.stat(src).st_dev ==
os.stat(destdir).st_dev):
line in copy_license_files function as below:

if os.access(src, os.W_OK) and (os.popen('df -P ' + src).read().split()[11]
== (os.popen('df -P ' + destdir).read().split()[11] ):

I'm pretty sure it's much more slowly, but it makes the important
difference. I suppose this is so seldom problem that poky is not too eager
in patching
poky/meta/classes/license.bbclass with this line.

Is there any way overloading system methods with own methods like recipes
with bbappend? I have not found any, so most likely I just need to patch my
poky with this line locally that makes updates pretty awkward, don't I

Cheers,
Matti

2015-08-24 15:52 GMT+03:00 matti kaasinen <matti.kaasinen at gmail.com>:

> Hi!
> This warning/error is coming from copy_license_files (listed below)
> function in do_populate task:
> #------------------------
> def copy_license_files(lic_files_paths, destdir):
>     import shutil
>
>     bb.utils.mkdirhier(destdir)
>     for (basename, path) in lic_files_paths:
>         try:
>             src = path
>             dst = os.path.join(destdir, basename)
>             if os.path.exists(dst):
>                 os.remove(dst)
>             if os.access(src, os.W_OK) and (os.stat(src).st_dev ==
> os.stat(destdir).st_dev):
>                 os.link(src, dst)
>             else:
>                 shutil.copyfile(src, dst)
>         except Exception as e:
>             bb.warn("Could not copy license file %s to %s: %s" % (src,
> dst, e))
> #-----------------------
> I suppose the idea of :
>             if os.access(src, os.W_OK) and (os.stat(src).st_dev ==
> os.stat(destdir).st_dev):
>
> -test is to find out if source directory and destination directories were
> on different drives. In my case that seems kind of failing in that task.
> "Kind of" because they are in different logical drives that are mounted on
> the same physical drive.
>
> Therefore, link is tried to make instead of copy. However, this fails as
> those directories are on the different logical drives and "OSError: [Errno
> 18] Invalid cross-device link" is thrown.
> I suppose, there is no other workaround to this than removing mountpoint
> from this build directory and instead using it as normal direcotry.
> Original idea was that it could have been mapped anywhere - for instance to
> nfs drive.
>
> Cheers,
> Matti
>
>
> By manually executing
>
> 2015-08-20 15:31 GMT+03:00 matti kaasinen <matti.kaasinen at gmail.com>:
>
>> Ross,
>> it is still unclear to me what release are you referring to. Could you
>> please pinpoint it to me.
>> Thanks,
>> Matti
>>
>> 2015-08-19 16:19 GMT+03:00 matti kaasinen <matti.kaasinen at gmail.com>:
>>
>>> I listed my main build configuration in my previous mail. What else do
>>> you need. In fact I have not updated poky recently.
>>> -Matti
>>>
>>> 2015-08-19 16:00 GMT+03:00 Burton, Ross <ross.burton at intel.com>:
>>>
>>>>
>>>> On 19 August 2015 at 13:48, matti kaasinen <matti.kaasinen at gmail.com>
>>>> wrote:
>>>>
>>>>> WARNING: Could not copy license file /YOCTO/poky/LICENSE to
>>>>> /XXX/work/am335x_evm-poky-linux-gnueabi/xxxx-image/1.0-r0/license-destdir/xxx-image/LICENSE:
>>>>> [Errno 18] Invalid cross-device link
>>>>>
>>>>> Yes, sources and results are located on different logical drives, but
>>>>> should it still be possible to copy files between them. Everything else
>>>>> works fine in bitbaking.
>>>>
>>>>
>>>> What release?  I have my build and checkouts on different disks and I
>>>> don't get this warning.
>>>>
>>>> Ross
>>>>
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/poky/attachments/20150825/5f7dd071/attachment.html>


More information about the poky mailing list