Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 11 Jun 2014 15:24:12 +0100
From: Justin Cormack <>
Subject: Re: REG_STARTEND (regex)

On Tue, Jan 15, 2013 at 3:16 PM, Daniel Cegiełka
<> wrote:
> Thank you for your reply. It's terribly sad that there are so many
> problems with portability. There are a lot of high-quality tools in
> the *BSD, which could be used in Linux. And rather than stick to the
> POSIX people still create a barrier, like REG_STARTEND, 'sed -i',
> bison (instead POSIX yacc), perl in the Makefile(!!!) etc.
> 'sed -i' is used in many programs (even linux, e2fsprogs, old libcap
> etc.) and there is no chance to avoid it. So I'm looking for an
> alternative to the gnu-sed+gnulib. I found that sed from FreeBSD has
> support for -i and is much smaller than the gnu sed:
> ls -lh /bin/sed ./sed
> -rwxr-xr-x 1 root root 143K Jun 22  2012 /bin/sed
> -rwxr-xr-x 1 root root  35K Jan 15 14:32 ./sed
> (compiled on linux with glibc)
> Now I want to use it with musl, but sed (and grep) from FreeBSD uses
> REG_STARTEND and I don't really know how to solve this problem.
> 651     /* Set anchors */
> 652     match[0].rm_so = 0;
> 653     match[0].rm_eo = slen;
> 654
> 655     eval = regexec(defpreg, string,
> 656     nomatch ? 0 : maxnsub + 1, match, eflags | REG_STARTEND);
> Does anyone have suggestions on how this can be modified to be able to
> use it with musl.

I know this was a long time ago, but NetBSD now has (in HEAD) FreeBSD
sed modified to not use REG_STARTEND, which does compile on Musl. You
could either use the NetBSD version, or try to get FreeBSD to port the


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.