]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
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)
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

index af51d6ecc38e2f97bc8a7d55a82442f0d08a9ffa..90a47f3ac724abdd88887bb6a18bfecdc3391e52 100644 (file)
@@ -260,8 +260,8 @@ LT_LDLIB_shlib_common=$(LIBTOOL) --quiet --mode=link --tag=CC \
 LT_LDLIB_shlib=$(LT_LDLIB_shlib_common) -export-symbols $(srcdir)/$@.sym
 
 LT_LDLIB_shlib_missing=$(LT_LDLIB_shlib_common) -export-symbols-regex \
-       "($$(sed -e 's/^/^/' -e 's/$$/$$/' $(srcdir)/$@.sym | tr '\n' '|' | \
-       sed -e 's/|$$//'))"
+       "($$(sed -e 's/^/^/' -e 's/$$/$$|/' -e '$$ s/|$$//' $(srcdir)/$@.sym | \
+       tr -d '\n'))"
 
 # Link a static convenience library (contains no PIC code)
 LT_LDLIB_static=$(LIBTOOL) --quiet --mode=link --tag=CC \