> I've implemented a simple extension on top of SBCL that would allow an
> extended set of characters to be used with Logical Pathnames (but
> still with restrictions, specially regarding dots). I have no idea if
> this is desirable or not, but I'll leave it attached so that
> maintainers can have a look.
Hi Fábio,
A few questions:
- as far as I can see, nothing in that patch would compensate for the
lettercase folding that happens when translating, e.g.,
(translate-logical-pathname "FOO:SOURCE;BAR.LISP")
=> #P"/home/me/src/foo/bar.lisp"
So this prompts a question: do you build/develop/run exclusively on
case-insensitive file systems (the defaults on MacOS and Windows)? Or
do you (sometimes) use a case-sensitive file system, but mixed-case or
solid-uppercase filenames don't occur in your stack?
- Have you got a sense for how frequently the "offending" filenames
occur, say, as a percentage of all your source files?
- Do you happen to find many non-ASCII characters in filenames? Many
non-European characters in filenames? Emojis? Flags? [ No joke, it
might matter for different approaches! ]
If these things are rare, there might be some "lightweight" approaches
available, even without altering SBCL at all.
Although I am not an active maintainer, I have spent more time studying
and thinking about pathnames than any human ever should. I would be
concerned about using a special variable for the job: it seems like one
of those variables that must never never vary after you've configured
it, right? If it changes dynamically, then you'll get errors at
unpredictable moments in a program: during parsing, during reading,
during any pathname operation that happens to validate LPN components.
So one option that occurs to me would be to make a list of "extra
allowed characters" be a slot in the logical pathname host, so that, say
foo:source;bar+baz.lisp
would be valid for the host FOO only if FOO were configured that way,
and not affect other hosts at all. This way, reading or parsing FOO's
namestrings, or constructing pathnames on FOO couldn't go wrong over
time due to changes in the dynamic environment, only if you modified FOO
itself. This would be pretty similar to the effect of your patch, just
different semantics and data flow within the pathnames implementation.
Another option could be to add an "escape character" to LPN namestring
syntax, either on a per-host basis or just generally. Let's say it was
#\^ (circumflex). Then you could write
"foo:source;bar^+baz.lisp"
and move on with life. (Prior art: an escape character was a feature of
logical pathnames on the MIT-descended Lisp Machines, though their
escape character was something else.) An escape character would get very
ugly if an LPN needed a lot of them, though, say
"foo:source;^Ba^R^_^Ba^Z.^Li^Sp" ;; but who names a file BaR_BaZ.LiSp?
This is why I've asked the questions above: if the "offenders" are rare
in fact, maybe an escape character would be okay in practice, if
not in principle.
Regards,
Richard
(I'm being deliberately a vague about how to set & get an extra slot in
an LPN host, and/or the precise effect of an "escape character"; the
details can be worked out, but no sense spending cycles on it unless
people would want it.)
> So this prompts a question: do you build/develop/run exclusively on
> case-insensitive file systems (the defaults on MacOS and Windows)? Or
> do you (sometimes) use a case-sensitive file system, but mixed-case
> or
> solid-uppercase filenames don't occur in your stack?
Yes, we do build/develop/run exclusively on Windows which, by default,
is
case insensitive (although it does support case sensitive folders).
Case folding was definitely an overlook.
> - Have you got a sense for how frequently the "offending" filenames
> occur, say, as a percentage of all your source files?
I'd say less than 1% are problems on naming files inside the projects
(there was only one instance of a file with a dot on the name, that I
can recall). Out of the 60 something libraries we are using, the
majority
of offending pathnames were related to dots on folder names (quite
common
for semantic versioning), an odd underscore in CFFI folder name and, of
course 'cl+ssl' 😅.
> - Do you happen to find many non-ASCII characters in filenames? Many
> non-European characters in filenames? Emojis? Flags? [ No joke, it
> might matter for different approaches! ]
Not on libraries, not that I am aware. But definitely on user facing
"stuff". On that front, at least UTF-8 support is mandatory. But in
those cases I'd strongly recommend against Logical Pathnames (even for
temporary files/paths).
> (...) I would be
> concerned about using a special variable for the job: it seems like one
> of those variables that must never never vary after you've configured
> it, right?
That seems very sensible, and I totally agree.
The escaping you suggest was something that we also discussed
internally,
but this small hackathon took me somewhere else.
But I think I like the idea of using logical hosts more.
Some prototyping might be in order (no promises though).
On a final note. As far as I am concerned, I don't really feel a
necessity
to use Logical Pathnames (or expand them for that matter), but there
seems
to be a loophole in this front for Common Lisp + ASDF + Quicklisp:
What if I want to build on a different system/folder structure from
which
I'll be developing? Logical Pathnames do seem to be the way to answer
this,
but alas, it doesn't really work, does it?
From my exploration and experimentation, there isn't really a de facto
way
on how to address this, is there?
Best regards,
Fábio Almeida
Software Engineer
SISCOG - Sistemas Cognitivos, SA
A Campo Grande, 378 - 3º, 1700-097 Lisboa, Portugal
T +351 217 529 100
W www.siscog.pt
Optimising the resources of the world
DISCLAIMER This message may contain confidential information. You should
not copy or address
this message to third parties. If you are not the appropriate recipient
we
kindly ask you to delete
the message and notify the sender.
The contents of this message and its attachments are the sole
responsibility of the sender and under
no circumstances can SISCOG - Sistemas Cognitivos, SA be liable for any
resulting consequences.