linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] lvm2 portability issues (GNU sed is assumed)
@ 2013-01-29 19:51 John Spencer
  2013-01-30  2:55 ` Alasdair G Kergon
  0 siblings, 1 reply; 5+ messages in thread
From: John Spencer @ 2013-01-29 19:51 UTC (permalink / raw)
  To: linux-lvm

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-lvm] lvm2 portability issues (GNU sed is assumed)
  2013-01-29 19:51 [linux-lvm] lvm2 portability issues (GNU sed is assumed) John Spencer
@ 2013-01-30  2:55 ` Alasdair G Kergon
  2013-01-31  3:31   ` John Spencer
  0 siblings, 1 reply; 5+ messages in thread
From: Alasdair G Kergon @ 2013-01-30  2:55 UTC (permalink / raw)
  To: John Spencer; +Cc: linux-lvm

On Tue, Jan 29, 2013 at 08:51:21PM +0100, John Spencer wrote:
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-lvm] lvm2 portability issues (GNU sed is assumed)
  2013-01-30  2:55 ` Alasdair G Kergon
@ 2013-01-31  3:31   ` John Spencer
  2013-02-24 15:12     ` John Spencer
  0 siblings, 1 reply; 5+ messages in thread
From: John Spencer @ 2013-01-31  3:31 UTC (permalink / raw)
  To: linux-lvm; +Cc: agk

[-- Attachment #1: Type: text/plain, Size: 1243 bytes --]

On 01/30/2013 03:55 AM, Alasdair G Kergon wrote:
> On Tue, Jan 29, 2013 at 08:51:21PM +0100, John Spencer wrote:
>> 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

>
> Alasdair
>
>


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-make.tmpl.in-fix-buggy-sed-statement-that-worked-by-.patch --]
[-- Type: text/x-patch; name="0001-make.tmpl.in-fix-buggy-sed-statement-that-worked-by-.patch", Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-lvm] lvm2 portability issues (GNU sed is assumed)
  2013-01-31  3:31   ` John Spencer
@ 2013-02-24 15:12     ` John Spencer
  2013-03-19 17:38       ` John Spencer
  0 siblings, 1 reply; 5+ messages in thread
From: John Spencer @ 2013-02-24 15:12 UTC (permalink / raw)
  To: zkabelac; +Cc: agk, LVM general discussion and development

[-- Attachment #1: Type: text/plain, Size: 1190 bytes --]

On 01/31/2013 04:31 AM, John Spencer wrote:
> On 01/30/2013 03:55 AM, Alasdair G Kergon wrote:
>> On Tue, Jan 29, 2013 at 08:51:21PM +0100, John Spencer wrote:
>>> 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.


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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-make.tmpl.in-fix-buggy-sed-statement-that-worked-by-.patch --]
[-- Type: text/x-patch; name="0001-make.tmpl.in-fix-buggy-sed-statement-that-worked-by-.patch", Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-lvm] lvm2 portability issues (GNU sed is assumed)
  2013-02-24 15:12     ` John Spencer
@ 2013-03-19 17:38       ` John Spencer
  0 siblings, 0 replies; 5+ messages in thread
From: John Spencer @ 2013-03-19 17:38 UTC (permalink / raw)
  To: zkabelac, agk; +Cc: LVM general discussion and development

On 02/24/2013 04:12 PM, John Spencer wrote:
> On 01/31/2013 04:31 AM, John Spencer wrote:
>> On 01/30/2013 03:55 AM, Alasdair G Kergon wrote:
>>> On Tue, Jan 29, 2013 at 08:51:21PM +0100, John Spencer wrote:
>>>> 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.
>
>
> 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
>

ping

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-03-19 17:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-29 19:51 [linux-lvm] lvm2 portability issues (GNU sed is assumed) John Spencer
2013-01-30  2:55 ` Alasdair G Kergon
2013-01-31  3:31   ` John Spencer
2013-02-24 15:12     ` John Spencer
2013-03-19 17:38       ` John Spencer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).