diff options
author | Richard Levitte <levitte@openssl.org> | 2016-03-11 13:25:48 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2016-03-11 17:41:43 +0100 |
commit | bb26842d1c8f99c1267b45361a2fc76822c0f913 (patch) | |
tree | 534a2c7812f51bcaa11425573a3ca94c550f8f84 /Configurations | |
parent | 178da24425dd9b26950dcdabb233d5564116a945 (diff) | |
download | openssl-bb26842d1c8f99c1267b45361a2fc76822c0f913.zip openssl-bb26842d1c8f99c1267b45361a2fc76822c0f913.tar.gz openssl-bb26842d1c8f99c1267b45361a2fc76822c0f913.tar.bz2 |
Some sed implementations are not greedy enough, use perl instead
The issue is demonstrated as follows:
On Linux:
$ echo ': foo.h /usr/include/stddef.h bar.h' | sed -e 's/ \/\(\\.\|[^ ]\)*//g'
: foo.h bar.h
On MacOS X:
$ echo ': foo.h /usr/include/stddef.h bar.h' | sed -e 's/ \/\(\\.\|[^ ]\)*//g'
: foo.husr/include/stddef.h bar.h
Perl is more consistent:
On Linux:
$ echo ': foo.h /usr/include/stddef.h bar.h' | perl -pe 's/ \/(\\.|[^ ])*//g;'
: foo.h bar.h
On MacOS X:
$ echo ': foo.h /usr/include/stddef.h bar.h' | perl -pe 's/ \/(\\.|[^ ])*//g;'
: foo.h bar.h
Reviewed-by: Andy Polyakov <appro@openssl.org>
Diffstat (limited to 'Configurations')
-rw-r--r-- | Configurations/unix-Makefile.tmpl | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl index 05844f0..e6dba5d 100644 --- a/Configurations/unix-Makefile.tmpl +++ b/Configurations/unix-Makefile.tmpl @@ -868,6 +868,14 @@ EOF } } + # The combination of perl and sed takes advantage of their respective + # capabilities. Some sed implementations aren't greedy (enough), which + # is problematic with the some regexps. However, the sed d command is + # simply easier in sed. + # + # Should one wonder about the end of the Perl snippet, it's because this + # second regexp eats up line endings as well, if the removed path is the + # last in the line. We may therefore need to put back a line ending. sub src2obj { my %args = @_; my $obj = $args{obj}; @@ -886,7 +894,8 @@ $obj$depext: $deps rm -f \$\@.tmp; touch \$\@.tmp -\$(MAKEDEPEND) -f\$\@.tmp -o"|$obj$objext" -- \$(CFLAGS) $ecflags$incs -- $srcs \\ 2>/dev/null - sed -i -e 's/^.*|//' -e 's/ \\/\\(\\\\.\\|[^ ]\\)*//g' -e '/: *\$\$/d' -e '/^\\(#.*\\| *\\)\$\$/d' \$\@.tmp + perl -i -pe 's/^.*\\|//; s/ \\/(\\\\.|[^ ])*//; \$\$_.="\\n" unless /\\R\$\$/g' \$\@.tmp + sed -i -e '/: *\$\$/d' -e '/^\\(#.*\\| *\\)\$\$/d' \$\@.tmp \@if ! cmp \$\@.tmp \$\@ > /dev/null 2> /dev/null; then \\ mv \$\@.tmp \$\@; \\ else \\ |