msys2 / msys2/msys2-runtime

Symbolic link to directory creation fails because of too long paths even if path <= 260 characters

Open
#216 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
240
Forks
60
Avg merge
2d 3h
Merged PRs (30d)
1

Description

Hello!

I have noticed a strange issue with using ln -s inside of MSYS2 which I'm inclined to consider a bug. Even after I enabled long paths inside of the Windows registry ln -s will complain about paths being too long to symlink to and will exit with an error code of 1 when creating symlinks to directories. The strange thing is that this also happens when the paths are far less than 260 characters long. If the paths are short enough, the symlink will be created regardless of the error. If the path is longer than 260 characters, the symlink will not be created.

Steps to reproduce

Run the following commands inside of MSYS2 after enabling long paths in the Windows registry and rebooting:

mkdir -p /c/foo
cd /c/foo
ln -s .. bar
mkdir -p /c/betts/underscores/aiding/elegance/arginine/turkmen/ballet/bumsen/bendigo/steam/chronically/kannur/source/stalled/mangled/toolkit/strength/fateful/kurosawa/effectiveness/yardage/newport/repairers/prawn/angela/resembles/projekt/avalanche/storedge/alibi/gauteng/chaim/estudio/zante/thickened/retention/wieder/pretzel/maastricht/speciality/universalist/heine/nagios/spans/meetup/binders/strict/tooltip/beastiality/terrace  
cd /c/betts/underscores/aiding/elegance/arginine/turkmen/ballet/bumsen/bendigo/steam/chronically/kannur/source/stalled/mangled/toolkit/strength/fateful/kurosawa/effectiveness/yardage/newport/repairers/prawn/angela/resembles/projekt/avalanche/storedge/alibi/gauteng/chaim/estudio/zante/thickened/retention/wieder/pretzel/maastricht/speciality/universalist/heine/nagios/spans/meetup/binders/strict/tooltip/beastiality/terrace  
ln -s .. foo
MSYS2 Version

uname -a for my MSYS2 installation:

MSYS_NT-10.0-19045 ___________ 3.5.3.x86_64 2024-05-06 06:45 UTC x86_64 Msys
Implications

This bug can cause many kinds of frustrating problems because many shell scripts and tools like tar often need to create symlinks to other directories

I thank you in advance for investigating this bug!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure in an MSYS2 environment using the short and long directory commands from the issue, after enabling Windows long paths. Start by tracing the MSYS2 runtime path used by ln -s for directory targets; done means the reported short-path case no longer exits with an error while symlink creation behavior remains correct for paths beyond 260 characters.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.