Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts/subfolder_list.py: Support long paths #24576

Closed
Abhishek-brcm opened this issue Apr 21, 2020 · 1 comment · Fixed by #24584
Closed

scripts/subfolder_list.py: Support long paths #24576

Abhishek-brcm opened this issue Apr 21, 2020 · 1 comment · Fixed by #24584
Assignees
Labels
area: Build System area: Userspace Userspace bug The issue is a bug, or the PR is fixing a bug

Comments

@Abhishek-brcm
Copy link
Collaborator

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 source 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.

@carlescufi carlescufi added area: Build System area: Userspace Userspace Enhancement Changes/Updates/Additions to existing features labels Apr 21, 2020
@carlescufi carlescufi changed the title scripts/subfolder_list.py: os.symlink: OSError: [Errno 36] File name too long scripts/subfolder_list.py: Support long paths Apr 21, 2020
tejlmand added a commit to tejlmand/zephyr that referenced this issue Apr 22, 2020
Fixes: zephyrproject-rtos#24576

The name of the symbolic link would be constructed using the full path
name to the target folder.

This is not needed and caused the issue raised in zephyrproject-rtos#24576.

This has been fixed by no longer using the toplevel target directory
in the link name, for example:
Old style: _project_zephyr_workspace_zephyr_include_sys
New style: include_sys

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
@tejlmand tejlmand added bug The issue is a bug, or the PR is fixing a bug and removed Enhancement Changes/Updates/Additions to existing features labels Apr 22, 2020
@tejlmand
Copy link
Collaborator

tejlmand commented Apr 22, 2020

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 source directory;
   a relation needs to be established in between zephyr source directory and build directory.

This would actually not help, as the symlink name itself is what causes a too long filename, not whether that link is full path or relative path.

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.

Well, in you case this will make the symlink name itself much shorter than half.
But if you count the fullpath to the symlink itself, that your right, it will be half, but we cannot move the location of the build folder, only the user can decide where to place build folder.

But this is now fixed in #24584

carlescufi pushed a commit that referenced this issue Apr 22, 2020
Fixes: #24576

The name of the symbolic link would be constructed using the full path
name to the target folder.

This is not needed and caused the issue raised in #24576.

This has been fixed by no longer using the toplevel target directory
in the link name, for example:
Old style: _project_zephyr_workspace_zephyr_include_sys
New style: include_sys

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
sandeepbrcm pushed a commit to Broadcom/zephyr that referenced this issue Apr 30, 2020
Fixes: zephyrproject-rtos#24576

The name of the symbolic link would be constructed using the full path
name to the target folder.

This is not needed and caused the issue raised in zephyrproject-rtos#24576.

This has been fixed by no longer using the toplevel target directory
in the link name, for example:
Old style: _project_zephyr_workspace_zephyr_include_sys
New style: include_sys

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
hakehuang pushed a commit to hakehuang/zephyr that referenced this issue Jun 20, 2020
Fixes: zephyrproject-rtos#24576

The name of the symbolic link would be constructed using the full path
name to the target folder.

This is not needed and caused the issue raised in zephyrproject-rtos#24576.

This has been fixed by no longer using the toplevel target directory
in the link name, for example:
Old style: _project_zephyr_workspace_zephyr_include_sys
New style: include_sys

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Build System area: Userspace Userspace bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants