urbit/pkg
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
..
arvo hoon: correctly parse empty path 2021-09-16 12:39:50 +02:00
btc-wallet glob: update to 0v758lj.uf0s5.0nh3m.gunn6.942gj 2021-08-19 15:25:15 -07:00
docker-image docker: update documentation 2021-04-25 12:02:56 -04:00
ent build: rework all nix expressions to support hercules-ci builds 2020-10-27 13:55:49 +01:00
ge-additions build: rework all nix expressions to support hercules-ci builds 2020-10-27 13:55:49 +01:00
herb herb: add cancel command 2021-05-29 12:53:23 -07:00
hs urbit: bumps version to 1.5 2021-04-27 13:58:44 -07:00
interface CalmPref: respect inverted form state 2021-07-23 13:39:59 +10:00
libaes_siv build: rework all nix expressions to support hercules-ci builds 2020-10-27 13:55:49 +01:00
npm @urbit/api: fix empty getDeepOlderThan 2021-07-29 09:18:54 +10:00
urbit Revert "Merge pull request #5086 from urbit/jo/chdir" 2021-07-14 13:58:21 +00:00