lvm2 portability issues (GNU sed is assumed)
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.symgcc -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
Quoted 2 lines · John Spencer
may i ask kindly to reformulate that statement so that it works with posix sed (as used in busybox 1.20.2) ?
I'm perfectly happy using modern extensions to these tools:)
If you want this to work with alternative versions, please send a tested patch for us to incorporate. (Either modifications to the commands so it works with both or else alternative versions which configure chooses between.)
Alasdair
Quoted 10 lines · Alasdair G Kergon
Quoted 2 lines · John Spencer
may i ask kindly to reformulate that statement so that it works with posix sed (as used in busybox 1.20.2) ?
I'm perfectly happy using modern extensions to these tools:)
If you want this to work with alternative versions, please send a tested patch for us to incorporate. (Either modifications to the commands so it works with both or else alternative versions which configure chooses between.)
a couple of regex experts looked at it, and the reason it didnt work is simply a bug: the \ before d is wrong. apparently the author meant to escape the makefile variable that follows, but that is not necessary and so the backslash gets passed on.
find attached a patch that works correctly with gnu sed and busybox sed.
btw: apparently there are 2 other bugs in that sed statement:
| should become \| to work as intended by the author (gnu sed only), and [ \*] should become [ *]. but apparently this part of the regex isn't used anyway, so it might be the best to just remove it. i left that part unfixed, as it is not crucial, so someone else might want to look at it.
thanks,
--JS
Quoted 4 lines
Alasdair
Quoted 12 lines · John Spencer
Quoted 10 lines · Alasdair G Kergon
Quoted 2 lines · John Spencer
may i ask kindly to reformulate that statement so that it works with posix sed (as used in busybox 1.20.2) ?
I'm perfectly happy using modern extensions to these tools:)
If you want this to work with alternative versions, please send a tested patch for us to incorporate. (Either modifications to the commands so it works with both or else alternative versions which configure chooses between.)
Quoted 6 lines
a couple of regex experts looked at it, and the reason it didnt work is simply a bug: the \ before d is wrong. apparently the author meant to escape the makefile variable that follows, but that is not necessary and so the backslash gets passed on.
find attached a patch that works correctly with gnu sed and busybox sed.
zdenek, since alasdair does not seem to react, would you mind applying this patch for a quick test, see that it generates both linker scripts (.export.sym) correctly (exactly the same output than before) and merge it ? thanks!
(reattaching the patch)
thanks,
--JS
Quoted 26 lines · John Spencer
Quoted 12 lines · John Spencer
Quoted 10 lines · Alasdair G Kergon
Quoted 2 lines · John Spencer
may i ask kindly to reformulate that statement so that it works with posix sed (as used in busybox 1.20.2) ?
I'm perfectly happy using modern extensions to these tools:)
If you want this to work with alternative versions, please send a tested patch for us to incorporate. (Either modifications to the commands so it works with both or else alternative versions which configure chooses between.)
Quoted 6 lines
a couple of regex experts looked at it, and the reason it didnt work is simply a bug: the \ before d is wrong. apparently the author meant to escape the makefile variable that follows, but that is not necessary and so the backslash gets passed on.
find attached a patch that works correctly with gnu sed and busybox sed.
zdenek, since alasdair does not seem to react, would you mind applying this patch for a quick test, see that it generates both linker scripts (.export.sym) correctly (exactly the same output than before) and merge it ? thanks!
Quoted 5 lines
(reattaching the patch)
thanks,
--JS
ping