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


Rasmussen, Torsten
 

Hi,

This is actually a bug, and is fixed now:
https://github.com/zephyrproject-rtos/zephyr/pull/24584

Regards

Torsten


Abhishek Shah
 

Hi Carles,

I think this can be solved in multiple ways, just by taking a quick look at the subfolder_list.py script.

I don't have much experience on Python. I thought sharing with the community, we could get quicker and proper solution.

Opened GitHub enhancement issue here per your suggestion: https://github.com/zephyrproject-rtos/zephyr/issues/24576


Thanks,
Abhishek


Carles Cufi
 

Hi Abhishek,

 

I think this can be solved in multiple ways, just by taking a quick look at the subfolder_list.py script.

It is even handled differently on Windows, where symlinks are not supported.

 

Could you open a GitHub enhancement issue with the contents of the email and then we can discuss the solution there?

scripts/subfolder_list.py was added by Torsten (I have added him on copy) so I think he’d be the right person to assign the issue to.

 

Regards,

 

Carles

 

From: devel@... <devel@...> On Behalf Of Abhishek Shah via lists.zephyrproject.org
Sent: 18 April 2020 21:01
To: devel@...
Subject: [Zephyr-devel] scripts/subfolder_list.py: os.symlink: OSError: [Errno 36] File name too long

 

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


Abhishek Shah
 

correction:
As symlink is in zephyr build directory and original directory is in source directory;
a relation needs to be established in between zephyr source directory and build directory.
 


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