XPost: uk.comp.homebuilt
On Thu, 6/5/2025 3:49 AM, Jeff Gaines wrote:
Why does Windows let me save a file (Little Ships return to Ramsgate) with a path three miles long then not let me do anything with it?
I spent a day de-bugging my file manager before twigging the problem :-(
On an OS like Windows 7, the bug was likely left there.
File Explorer cannot delete a MAX_PATH file. There is one precise path length that causes a problem, and then File Explorer cannot move it or delete it.
You could write a short PERL script, and if it handled the file, it
could delete it.
https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation
"the maximum path on drive D is "D:\some 256-character path string<NUL>"
On maybe a W10/W11, that was fixed. That specific path length no longer presented
a challenge to File Explorer. It could handle 260 character paths.
And speaking in broad general terms, files which violate the rules for filename,
extension, or path, they generally come from browsers. Even if the browser presents
a file saving dialog, that might not be sufficient to guarantee that some trick is
not played.
https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file
"Do not end a file or directory name with a space or a period.
Although the underlying file system may support such names,
the Windows shell and user interface does not."
You would expect a browser to ignore such entreaties.
*******
There is a feature called LongPathsEnabled (max ~32767?).
Office does not support LongPath. File Explorer does not support LongPath.
The OS can have LongPath enabled. Applications can be LongPathAware.
It is apparently possible to craft exploits that are more likely to be attempted when LongPaths are present.
The long and the short of that feature, is don't use it. In certain
scanning scenarios, it can radically slow down the scan (junctions perhaps).
The default on a clean install, is for that to be disabled (gives 260).
The feature may have "existed" in the filesystem for a number of years,
without any LongPathAware capability having been developed. The support
at some point in Win10, is mere wallpaper, with the feature not really
being supported in a practical way. I gather no one wants to change
all the string definitions to handle paths that big :-) The behavior on Junctions would be egregiously bad. "Pitch the PC out the window" bad.
Bill Gates once said "640,000 characters is enough for anyone", and he
was right. That's why War and Peace stopped at 640,000 characters :-)
Some of the other things Bill Gates said, such as utterances about
MAX_PATH, were likely only said to the bathroom mirror. "If only
we could make paths that were ridiculously long."
Paul
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)