Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 15 Jan 2013 16:16:29 +0100
From: Daniel Cegiełka <daniel.cegielka@...il.com>
To: musl@...ts.openwall.com
Subject: Re: REG_STARTEND (regex)

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:

http://svnweb.freebsd.org/base/release/9.1.0/usr.bin/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.


http://svnweb.freebsd.org/base/release/9.1.0/usr.bin/sed/process.c?revision=243808&view=markup

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.

Daniel

Powered by blists - more mailing lists

Your e-mail address:

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