scripts/subfolder_list.py: os.symlink: OSError: [Errno 36] File name too long


Abhishek Shah
 

Hi -

I am facing an issue where os.symlink call in subfolder_list.py(zephyr v2.2) results in below error:
"scripts/subfolder_list.py", line 56, in main
os.symlink(directory, symlink)
OSError: [Errno 36] File name too long   

Here is the example of one of the symlink getting created on one of the systems:
directory path:
'/tmp/yocto_builds/ 20133855_ genericx86-64/poky/build/tmp/work/
aarch64-poky-linux/brcm-zephyr/gitAUTOINC+a20a30cd86_bfa48a337e_dbbf7c9b30_f3635d87f4_90d93a11ba_ae871b61ae_5ba575618e-r0/git/
zephyr/include/arch/arm/aarch32/cortex_m/mpu'

It's symlink created by subfolder_list.py:
 '/tmp/yocto_builds/ 20133855_ genericx86-64/poky/build/tmp/work/
aarch64-poky-linux/brcm-zephyr/gitAUTOINC+a20a30cd86_bfa48a337e_dbbf7c9b30_f3635d87f4_90d93a11ba_ae871b61ae_5ba575618e-r0/git/
zephyr/samples/hello_world/build_soc/zephyr/misc/generated/syscalls_links/
_tmp_yocto_builds_20133855_genericx86-64_poky_build_tmp_work_aarch64-poky-linux_brcm-zephyr_gitAUTOINC+a20a30cd86_bfa48a337e_dbbf7c9b30_f3635d87f4_90d93a11ba_ae871b61ae_5ba575618e-r0_git_zephyr_include_arch_arm_aarch32_cortex_m_mpu'

Above symlink is evidently too long.

I can think of 2 ways to reduce symlink length:
1. Symlink creation should use relative path instead of absolute path.
As symlink is in zephyr build directory and original directory is in build directory;
a relation needs to be established in between zephyr source directory and build directory.

2. The final symlink name should not use entire PATH in the name, rather just start from "include_*"
For example: Instead of this:
_tmp_yocto_builds_20133855_genericx86-64_poky_build_tmp_work_aarch64-poky-linux_brcm-zephyr_gitAUTOINC+a20a30cd86_bfa48a337e_dbbf7c9b30_f3635d87f4_90d93a11ba_ae871b61ae_5ba575618e-r0_git_zephyr_include_arch_arm_aarch32_cortex_m_mpu
Name could be just:
include_arch_arm_aarch32_cortex_m_mpu
This should reduce symlink length almost by half.

Regards,
Abhishek

Join {devel@lists.zephyrproject.org to automatically receive all group messages.