bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 0/1] Rewrite /hurd/symlink on top of trivfs OFF TOPIC PRAISE


From: Sergey Bugaev
Subject: Re: [PATCH 0/1] Rewrite /hurd/symlink on top of trivfs OFF TOPIC PRAISE
Date: Thu, 29 Jul 2021 14:45:14 +0300

On Wed, Jul 28, 2021 at 11:25 PM Sergey Bugaev <bugaevc@gmail.com> wrote:
> On Wed, Jul 28, 2021 at 10:39 PM <jbranso@dismail.de> wrote:
> > It would be cool to have a gemini translator.  It would only take a few 100
> > lines of code.
>
> Oh yes, a Gemini translator actually sounds like a perfect exercise!
> It's not as simple as /hurd/hello or /dev/yes, but still simple
> enough, and would be actually useful for the end users.

Thinking about it further,

while it's true that you should be able to write a very simple
trivfs-based Gemini translator that would basically do a request for
each open and let the client read the response body,

for a more serious, solid Gemini translator you'd want much more than
that. In particular, you'd want the ability to talk about directories
as filesystem nodes even if there's no document at that URL. So for
instance,

$ settrans gemini: /hypothetical/gemini
$ cat gemini://example.com/foo/bar/hello
Hello
# You'd also want this to work:
$ cd gemini://example.com/foo
$ cat bar/hello
Hello
# ...even if there's nothing (error code 51) at gemini://example.com/foo

Ideally, cd'ing into a directory would not even cause a network
request, only trying to read a file would. Moreover, you'd want ls(1)
to work, at least somewhat. We could learn a trick from httpfs here:
when asked to list the contents of a directory, fetch the page and
collect links that point to pages inside the directory. For instance,
gemini://gemini.circumlunar.space/ contains a bunch of links to its
subpages, which we would parse out and display as directory entries.
Thankfully, Hurd fully supports treating a single node as both a
directory and a readable file.

I think this is all implementable, but would require using netfs,
probably overriding netfs_S_dir_lookup (), and quite a bit more than a
few hundred lines of code. :|

Sergey



reply via email to

[Prev in Thread] Current Thread [Next in Thread]