bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/28897] bdf/bdfio.c does not properly detect "long paths" c


From: fredrick.eisele at gmail dot com
Subject: [Bug binutils/28897] bdf/bdfio.c does not properly detect "long paths" containing ".."
Date: Tue, 15 Feb 2022 18:49:10 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=28897

--- Comment #2 from Fred Eisele <fredrick.eisele at gmail dot com> ---
This affects several programs such as `ar.exe`, and `make.exe`. 
In those cases it only shows up when a relative path is provided and the
combined length of that relative path and the path to the current working
directory are greater than MAX_PATH.

The following use of `ar.exe` on MSYS2 on Windows 10 illustrates the issue in
practice.

Setup a candidate directory structure.

mkdir -p ./wip/sample/projects/Aaa/Bbb/Ccccccc/DdddEeeeeeeeeee/fffff/Ggg
touch
./wip/sample/projects/Aaa/Bbb/Ccccccc/DdddEeeeeeeeeee/fffff/Ggg/iiii_iii_iiiiiiiiiiiiiii_iiii_iiiiiiii_iiii.o
mkdir -p
./wip/HHHHHhhhhhhhhhhhHhhhHhhhh_1.1.1/kkkkKkkkkkkkKkkkkkkkk/Aaa/src/Bbb/DdddEeeeeeeeeee/Jjjj_Jjjjjjjj/foo/bar/baz/bow


Then the following produces the error:

pushd
./wip/HHHHHhhhhhhhhhhhHhhhHhhhh_1.1.1/kkkkKkkkkkkkKkkkkkkkk/Aaa/src/Bbb/DdddEeeeeeeeeee/Jjjj_Jjjjjjjj/foo/bar/baz/bow
ls ../../../../../../../../../../..
ar cr foo.a
../../../../../../../../../../../sample/projects/Aaa/Bbb/Ccccccc/DdddEeeeeeeeeee/fffff/Ggg/iiii_iii_iiiiiiiiiiiiiii_iiii_iiiiiiii_iiii.o


The error message is something like (when it happens):

C:\tools\msys64\mingw64\bin\ar.exe:
../../../../../../../../../../../sample/projects/Aaa/Bbb/Ccccccc/DdddEeeeeeeeeee/fffff/Ggg/iiii_iii_iiiiiiiiiiiiiii_iiii_iiiiiiii_iiii.o:
Invalid argument


The problem can be cleared up by making doing a similar thing from a higher
directory. e.g.

pushd
./wip/HHHHHhhhhhhhhhhhHhhhHhhhh_1.1.1/kkkkKkkkkkkkKkkkkkkkk/Aaa/src/Bbb/DdddEeeeeeeeeee
ls  ../../../../../..
ar cr foo.a 
../../../../../../sample/projects/Aaa/Bbb/Ccccccc/DdddEeeeeeeeeee/fffff/Ggg/iiii_iii_iiiiiiiiiiiiiii_iiii_iiiiiiii_iiii.o

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]