www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - dealing with very long paths and names

reply Josphe Brigmo <JospheBrigmo gmail.com> writes:
Seems to break dirEntries when trying to deal with long 
pathnames(> 512) on windows.

It's a strange error because it just fails with access denied or 
missing file.
Sep 14 2018
parent reply Basile B. <b2.temp gmx.com> writes:
On Friday, 14 September 2018 at 17:59:38 UTC, Josphe Brigmo wrote:
 Seems to break dirEntries when trying to deal with long 
 pathnames(> 512) on windows.

 It's a strange error because it just fails with access denied 
 or missing file.
The bug is known, see https://issues.dlang.org/show_bug.cgi?id=8967
Sep 14 2018
next sibling parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Fri, Sep 14, 2018 at 07:05:35PM +0000, Basile B. via Digitalmars-d-learn
wrote:
 On Friday, 14 September 2018 at 17:59:38 UTC, Josphe Brigmo wrote:
 Seems to break dirEntries when trying to deal with long pathnames(>
 512) on windows.
 
 It's a strange error because it just fails with access denied or
 missing file.
The bug is known, see https://issues.dlang.org/show_bug.cgi?id=8967
Whoa. After seeing the insane mess that is the Windows pathname syntax, I'm so glad I code on Linux instead! T -- Only boring people get bored. -- JM
Sep 14 2018
parent Kagamin <spam here.lot> writes:
On Friday, 14 September 2018 at 20:52:42 UTC, H. S. Teoh wrote:
 Whoa.  After seeing the insane mess that is the Windows 
 pathname syntax, I'm so glad I code on Linux instead!
Yeah, also SIGPIPE, EINTR and "fork should be fast enough".
Sep 17 2018
prev sibling parent reply Jonathan M Davis <newsgroup.d jmdavisprog.com> writes:
On Friday, September 14, 2018 2:52:42 PM MDT H. S. Teoh via Digitalmars-d-
learn wrote:
 On Fri, Sep 14, 2018 at 07:05:35PM +0000, Basile B. via Digitalmars-d-
learn wrote:
 On Friday, 14 September 2018 at 17:59:38 UTC, Josphe Brigmo wrote:
 Seems to break dirEntries when trying to deal with long pathnames(>
 512) on windows.

 It's a strange error because it just fails with access denied or
 missing file.
The bug is known, see https://issues.dlang.org/show_bug.cgi?id=8967
Whoa. After seeing the insane mess that is the Windows pathname syntax, I'm so glad I code on Linux instead!
Yeah, though if you write cross-platform applications or libraries (and ideally, most applications and libraries would be platform-agnostic), you can't necessarily avoid all of the Windows insanity, even if you yourself use a platform without those problems. - Jonathan M Davis
Sep 14 2018
parent reply Vladimir Panteleev <thecybershadow.lists gmail.com> writes:
On Friday, 14 September 2018 at 21:16:31 UTC, Jonathan M Davis 
wrote:
 Yeah, though if you write cross-platform applications or 
 libraries (and ideally, most applications and libraries would 
 be platform-agnostic), you can't necessarily avoid all of the 
 Windows insanity, even if you yourself use a platform without 
 those problems.
Linux generally allows you to go ahead and use the filesystem as a database, and this works pretty well in a lot of cases. Filesystem performance is much better, and so are the limitations - not just the path length as discussed in this thread, but also the range of valid characters (anything except / and NUL is fine). Plus, depending on your choice of filesystem, you get bonus features like snapshots, incremental backups, and deduplication. It's a boon for prototyping (or Linux-only software).
Sep 15 2018
parent Jonathan M Davis <newsgroup.d jmdavisprog.com> writes:
On Saturday, September 15, 2018 8:45:55 AM MDT Vladimir Panteleev via 
Digitalmars-d-learn wrote:
 On Friday, 14 September 2018 at 21:16:31 UTC, Jonathan M Davis

 wrote:
 Yeah, though if you write cross-platform applications or
 libraries (and ideally, most applications and libraries would
 be platform-agnostic), you can't necessarily avoid all of the
 Windows insanity, even if you yourself use a platform without
 those problems.
Linux generally allows you to go ahead and use the filesystem as a database, and this works pretty well in a lot of cases. Filesystem performance is much better, and so are the limitations - not just the path length as discussed in this thread, but also the range of valid characters (anything except / and NUL is fine). Plus, depending on your choice of filesystem, you get bonus features like snapshots, incremental backups, and deduplication. It's a boon for prototyping (or Linux-only software).
Oh, I don't disagree. I think that in general it makes _way_ more sense to use a *nix system for development (or most anything else) even if the software can run on multiple platforms. And actually, the primary reason that I use the OS I do (FreeBSD) is because of the filesystem (it has first class ZFS support unlike Linux). However, I'm a strong believer that in general, software should be cross-platform if it reasonably can be. That's usually the worst when folks use all kinds of Windows-specific stuff when they don't need to, but sometimes, Linux-isms do creep into code unnecessarily. Either way, while I've occasionally found something that Windows did better than *nix, far more often, it's shocking how bad their APIs are. And in this particular case, there really isn't a great solution. Trying to hide the Windows limitations by translating longer paths so that the Windows API is risky business, but leaving it up to the programmer to run into it and then scream in frustration like the OP is isn't great either. And of course, even if they outright fixed the problem in Windows tomorrow, it would probably be over a decade before you could rely on it given how long people use older versions of Windows. - Jonathan M Davis
Sep 15 2018