shrub/pkg/arvo/sys
fang d0f8eda937
hoon: correctly parse empty path
And reject paths ending in empty segments.

The following cases were being parsed incorrectly:
- `/` represents the empty path, `~`. This was being parsed into `[~. ~]`
- `/x/` is not valid. This was being parsed into `[~.x ~. ~]`

This happens because `urs:ab` has no problem parsing the empty string.
For some supported cases, like `//x` (`[~. ~.x ~]`), this is actually desired
behavior, but it results in trailing empty segments for paths ending in `/`.

Here we apply a `+sear` on top of the existing parser, that transform the `/`
case to produce `~`, and ensures the absence of a trailing empty segment in
all other cases.

Note that we change `(more fas urs:ab)` to `(most fas urs:ab)`. Since `urs:ab`
parses the empty string, this doesn't actually make a difference, but it does
make it more obvious that the `+rear` call will never crash.

Alternative approaches I attempted all resulted in much more complicated
parser, so the dumb `+sear` seems preferable.
We do eat the performance cost of an additional list traversal (in `+rear`)
with this change, but that is probably not the end of the world.

Fixes #1501.
2021-09-16 12:39:50 +02:00
..
vane dill: no-op on strange fact 2021-07-29 14:56:26 -04:00
arvo.hoon arvo: add %whiz option that allows one to prime the compiler cache 2021-05-27 12:55:03 -05:00
hoon.hoon hoon: correctly parse empty path 2021-09-16 12:39:50 +02:00
lull.hoon jael, dawn: support multikeyfile 2021-07-20 13:28:33 -04:00
zuse.hoon zuse: remove unnecessary line from +re 2021-06-07 10:20:20 -05:00