mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: REG_STARTEND (regex)
Date: Wed, 16 Jan 2013 11:57:01 -0500	[thread overview]
Message-ID: <20130116165701.GE20323@brightrain.aerifal.cx> (raw)
In-Reply-To: <1358350921.32505.33@driftwood>

On Wed, Jan 16, 2013 at 09:42:01AM -0600, Rob Landley wrote:
> On 01/15/2013 12:45:13 PM, Rich Felker wrote:
> >> Does anyone have suggestions on how this can be modified to be
> >able to
> >> use it with musl.
> >
> >If the start position is 0, which it seems to be here, there's nothing
> >to be done but removing REG_STARTEND. All it's doing is allowing you
> >to process data with embedded nul bytes, which is not required by the
> >standard or useful for any meaningful use of sed.
> 
> Actually people use sed to modify embedded strings in binaries.
> (Strange but true.)
> 
> >Nobody will notice
> >the difference with it missing unless they're trying to perform
> >hideous hacks like patching binary files with sed...
> 
> Which people do.
> 
> However, mostly this involves embedded nuls in the data being
> processed, not embedded nuls in the pattern space. So it's merely
> creepy rather than outright pathological. And the caller can wrap
> the regex library to do its own strlen stuff and restart right after
> the embedded NUL if there's data left. (Which was on the todo list
> for busybox sed back when Bruce happened, possibly Denys has
> implemented it since.)

If sed wants to support this without providing its own
embedded-NUL-capable regex library, it should just treat NUL as a kind
of boundary/line-break so that the pattern space never ends up
containing NUL bytes. However, there are still a good many other
portability issues with passing binary files to sed, even if you
ignore the fact that POSIX sed specifically requires a text file as
input, so I think it's rather misguided to cater to these uses anyway.

Rich



  reply	other threads:[~2013-01-16 16:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-15 10:34 Daniel Cegiełka
2013-01-15 13:42 ` Rich Felker
2013-01-15 15:16   ` Daniel Cegiełka
2013-01-15 15:37     ` John Spencer
2013-01-15 15:50       ` Daniel Cegiełka
2013-01-15 16:13         ` Rob Landley
2013-01-15 18:38         ` John Spencer
2013-01-16 15:41           ` Rob Landley
2013-01-15 16:11     ` Rob Landley
2013-01-15 18:45     ` Rich Felker
2013-01-15 18:55       ` Daniel Cegiełka
2013-01-16 15:42       ` Rob Landley
2013-01-16 16:57         ` Rich Felker [this message]
2014-06-11 14:24     ` Justin Cormack
2014-06-12  1:00       ` bfdamkoehler
2014-06-12  1:40         ` Rich Felker
2014-06-13  1:15           ` bfdamkoehler
2014-06-13  3:00             ` Rich Felker

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=20130116165701.GE20323@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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).