[linux-lvm] lvm2 portability issues (GNU sed is assumed)

John Spencer maillist-lvm at barfooze.de
Tue Jan 29 19:51:21 UTC 2013


hi list,

during lvm2.2.02.98 compilation,
a linker script gets generated which exposes only symbols matching the 
gnu sed regex. this fails using a posix compliant sed program, leading 
to an almost empty linker script and subsequently missing symbols:

set -e; \
( cat ./.exported_symbols; \
   if test x./libdevmapper.h != x; then \
         gcc -E -P -I./ioctl -I. -I. -I../include -DHAVE_CONFIG_H 
-DDM_IOCTLS -DDM_DEVICE_UID=0 -DDM_DEVICE_GID=0 -DDM_DEVICE_MODE=0600 
./libdevmapper.h | \
         sed -ne "/^typedef|}/!s/.*[ \*]\(\dm_[a-z0-9_]*\)(.*/\1/p"; \
   fi \
) > .exported_symbols_generated
set -e; (echo "Base {"; echo "  global:"; \
          sed "s/^/              /;s/$/;/" < .exported_symbols_generated; \
          echo " local:"; echo "         *;"; echo "};") > .export.sym
gcc -shared -Wl,-soname,libdevmapper.so.1.02 \
         -D_GNU_SOURCE -fPIC  -O2 -Wl,--version-script,.export.sym 
-L../libdm -L../lib -L../libdaemon/client datastruct/bitset.o 
datastruct/hash.o datastruct/list.o libdm-common.o libdm-file.o 
libdm-deptree.o libdm-string.o libdm-report.o libdm-config.o 
mm/dbg_malloc.o mm/pool.o regex/matcher.o regex/parse_rx.o regex/ttree.o 
ioctl/libdm-iface.o    -o ioctl/libdevmapper.so.1.02


here is the statement that generates the symbollist:

gcc -E -P -I./ioctl -I. -I. -I../include -DHAVE_CONFIG_H -DDM_IOCTLS 
-DDM_DEVICE_UID=0 -DDM_DEVICE_GID=0 -DDM_DEVICE_MODE=0600 
./libdevmapper.h | sed -ne "/^typedef|}/!s/.*[ 
\*]\(\dm_[a-z0-9_]*\)(.*/\1/p";


may i ask kindly to reformulate that statement so that it works with 
posix sed (as used in busybox 1.20.2) ?

afaict, both the usage of | and \d are non-posix. the latter can 
probably be fixed by using [:digit:], the former by using 2 separate 
statements.

thanks,
--JS




More information about the linux-lvm mailing list