List for cgit developers and users
 help / color / mirror / Atom feed
From: Jason at zx2c4.com (Jason A. Donenfeld)
Subject: RFE: .so filters
Date: Fri, 10 Jan 2014 02:41:20 +0100	[thread overview]
Message-ID: <CAHmME9qqf0fLFQOb8xQrzoXDvRUqayA8PvzWzFzv+kjJUkFcow@mail.gmail.com> (raw)
In-Reply-To: <20140109225802.GM7608@serenity.lan>

On Thu, Jan 9, 2014 at 11:58 PM, John Keeping <john at keeping.me.uk> wrote:
>
> That interface doesn't really match the way the current filters work.

Yes, hence the post.

>  We could swap out write with a function pointer
> into the filter, but I don't think we guarantee that all of the data is
> written in one go which makes life harder for filter writers (although
> for simple cases like author info we probably could guarantee to write
> it all at once).

I'm actually contemplating doing just this; it would be the only sane
way to reap the benefits of shared objects. Stdio will ensure that the
writes occur once per line, since stdout has line buffering enabled.
This is reasonable enough behavior.

> If we allow filters to act incrementally, then we can just leave the
> filter running and swap it in or out when required.  That would require
> a single dup2 to make it work the same way that the filters currently
> work.

So the other thing I've been considering is doing something like this,
but without shared objects. The idea is -- we exec the filter once.
The first N lines (or instead of \n we use \0 - same difference)
contain the arguments. Then the filter runs, using those arguments,
and does its thing per usual. At the end, however, it does not exit.
Instead of waitpid()ing on it in close filter, we SIGSTOP it, put the
fds back in place, etc. Then the next time that filter is called, we
SIGCONT it, it reads the first N lines as arguments again, and so
forth. I'm most tempted to go with this approach at the moment.

> I think scripts using stdin+stdout
> are a much simpler interface and provides a much lower barrier to entry,
> not least because the range of languages that can be used to implement
> the filters is so much greater.

Yea. I'm leaning toward the SIGSTOP solution with normal scripts... We
could do a megafast shared object plugin architecture, but it seems
like that's needlessly complicated right now...


  reply	other threads:[~2014-01-10  1:41 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-09 21:34 Jason
2014-01-09 22:29 ` mailings
2014-01-09 22:58 ` john
2014-01-10  1:41   ` Jason [this message]
2014-01-10  2:11     ` Jason
2014-01-10  4:26       ` Jason
2014-01-10  9:06       ` john
2014-01-10 15:57         ` Jason
2014-01-10 17:12           ` bluewind
2014-01-10 17:20             ` john
2014-01-10 17:43               ` mricon
2014-01-10 18:00                 ` Jason
2014-01-10 18:00               ` Jason
2014-01-10 17:57             ` Jason
2014-01-10 20:03               ` bluewind
2014-01-10 20:11                 ` john
2014-01-10 20:25                   ` bluewind
2014-01-10 20:36                     ` john
2014-01-10 20:56                       ` bluewind
2014-01-11  2:37                         ` Jason
2014-01-11  2:34                 ` Jason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHmME9qqf0fLFQOb8xQrzoXDvRUqayA8PvzWzFzv+kjJUkFcow@mail.gmail.com \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).