Ben Voigt said:
Well this is a decidedly different problem from FileStream failures. Here
we're dealing with paths constructed inside the .NET framework or OS,
without giving you any chance to intercept the problem. I'm going to try
to reproduce it...
Ok, I can reproduce your problem, but I got plenty of warnings along the
way.
[bvoigt@voigt ...longpathname/Debug]$ ./longpathname.exe
[bvoigt@voigt ...longpathname/Debug]$ mkdir -p
abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcde
fg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/a
bcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcde
fg/abcdefg/abcdefg/
mkdir: cannot create directory
`abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcd
efg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/
abcdefg/abcdefg/abcdefg/abcdefg/abcdefg': File name too long
[bvoigt@voigt ...longpathname/Debug]$ mkdir -p
abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcde
fg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/a
bcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/
mkdir: cannot create directory
`abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcd
efg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/
abcdefg/abcdefg/abcdefg/abcdefg/abcdefg': File name too long
[bvoigt@voigt ...longpathname/Debug]$ mkdir -p
abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcde
fg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/a
bcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/
[bvoigt@voigt ...longpathname/Debug]$ cp longpathname.exe
abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/ab
cdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdef
g/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/
cp: cannot stat
`abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abc
defg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg
/abcdefg/abcdefg/longpathname.exe': File name too long
[bvoigt@voigt ...longpathname/Debug]$ cp longpathname.exe
abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/ab
cdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdef
g/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/
cp: cannot stat
`abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abc
defg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg
/abcdefg/longpathname.exe': File name too long
[bvoigt@voigt ...longpathname/Debug]$ cp longpathname.exe
abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/ab
cdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdef
g/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/
At this point I went to Windows explorer and renamed the directory
containing the file.
[bvoigt@voigt ...longpathname/Debug]$ cd
abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abc
defg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg
/abcdefg/abcdefg/abcdefg/abcdefghijklmnop/
[bvoigt@voigt ...abcdefg/abcdefghijklmnop]$ ls
ls: cannot access longpathname.exe: File name too long
longpathname.exe
[bvoigt@voigt ...abcdefg/abcdefghijklmnop]$ pwd
/cygdrive/c/Programming/longpathname/longpathname/Debug/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcd
efg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/
abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefghijklmnop
C:\Programming\longpathname\longpathname\Debug\abcdefg\abcdefg\abcdefg\abcdefg\a
bcdefg\abcdefg\abcdefg\abcdefg\abcdefg\abcdefg\abcdefg\abcdefg\abcdefg\abcdefg\a
bcdefg\abcdefg\abcdefg\abcdefg\abcdefg\abcdefg\abcdefg\abcdefg\abcdefg\abcdefghi
jklmnop>longpathname.exe
'longpathname.exe' is not recognized as an internal or external command,
operable program or batch file.
Ok, now I can't run the program from either tcsh, cmd.exe, or Windows
Explorer. But both explorer and tcsh refused to copy it into a deeper
directory, giving a coherent error message.
After using subst to map into the middle of the directory tree, I can run it
again.
subst k:
C:\Programming\longpathname\longpathname\Debug\abcdefg\abcdefg\abcdefg\abcdefg\abcdefg\abcdefg\abcdefg\abcdefg\abcdefg\abcdefg\abcdefg
[bvoigt@voigt ...abcdefg/abcdefghijklmnop]$ ls
longpathname.exe
[bvoigt@voigt ...abcdefg/abcdefghijklmnop]$ ./longpathname.exe
[bvoigt@voigt ...abcdefg/abcdefghijklmnop]$ pwd
/cygdrive/k/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefghijklmnop
A symbolic link does not help.
Oh, and rather nifty:
[bvoigt@voigt ...longpathname/Debug]$ rm -rf abcdefg/
rm: cannot remove
`abcdefg//abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/
abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcdefg/abcd
efg/abcdefghijklmnop/longpathname.exe': File name too long
Windows Explorer cannot delete it either, until the directory is renamed
shorter.