]> git.michaelhowe.org Git - packages/o/openafs.git/commit
Avoid empty libtool -export-symbols-regex pattern
authorAndrew Deason <adeason@sinenomine.net>
Wed, 7 Mar 2018 19:11:03 +0000 (13:11 -0600)
committerBenjamin Kaduk <kaduk@mit.edu>
Sat, 14 Apr 2018 02:44:29 +0000 (22:44 -0400)
commite46c5c455c4eceb5dac5e86611d039c6c7089d6e
tree9047ef211e452c6a62ba78cc6bc8665209f70186
parentb41065f2b8877580a7e1858b8e2857973ddf6503
Avoid empty libtool -export-symbols-regex pattern

Currently, in LT_LDLIB_shlib_missing, we construct our
-export-symbols-regex pattern like so (with some escaping):

    "($(sed -e 's/^/^/' -e 's/$/$/' xxx.sym | tr '\n' '|' | sed -e 's/|$//'))"

The idea is that for a .sym file consisting of, for example:

    foo
    bar

We then generate a regex like (^foo$|^bar$). However, since the 'tr'
removes all newlines, the line given to the last 'sed' in the pipeline
has no trailing newline. On some systems, such as Solaris, this causes
sed to not output anything at all, resulting in a regex pattern of
just "()".

For example:

    # on Debian
    $ echo -n foo | sed -e 's/foo/bar/'
    bar$

    # on Solaris
    $ echo -n foo | sed -e 's/foo/bar/'
    $

To avoid this, we can change the sed pipeline to not remove the
newlines until the very end. Change the way we construct our regex to
this instead:

    "($(sed -e 's/^/^/' -e 's/$/$|/' -e '$ s/|$//' xxx.sym | tr -d '\n'))"

So the sed removes the extra '|' in the last element by looking at the
last line, instead of looking at the end of the line after the 'tr'
conversion.

Reviewed-on: https://gerrit.openafs.org/12944
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit d0805d72b7a48dcaa7abe1aea136a8cd963d76c2)

Change-Id: Iebf0996e63c6233bebbf855cde21094a73fbd420
Reviewed-on: https://gerrit.openafs.org/12949
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
src/config/Makefile.config.in