[linux-lvm] LVM tools segfault since 2.03.12

Zdenek Kabelac zkabelac at redhat.com
Thu Sep 2 19:14:25 UTC 2021


Dne 02. 09. 21 v 21:10 Jean-Michel Pollion napsal(a):
> Le jeudi 02 septembre 2021 à 19:21 +0200, Zdenek Kabelac a écrit :
>> Dne 02. 09. 21 v 17:49 Jean-Michel Pollion napsal(a):
>>> Le jeudi 02 septembre 2021 à 16:11 +0200, Zdenek Kabelac a écrit :
>>>> Dne 02. 09. 21 v 9:34 Jean-Michel Pollion napsal(a):
>>>>> Hello,
>>>>>
>>>>> I have the lvm2 tools segfaulting since 2.03.12 with a message
>>>>> of
>>>>> unsorted commands in cmds.h.
>>>>> It turns out that in my locale and on my setup, the LANG=C
>>>>> setting
>>>>> before "sort -u" in tools/Makefile.in is not enough, I had to
>>>>> patch
>>>>> and
>>>>> add LC_COLLATE=C too, or the rules will not count the
>>>>> underscore
>>>>> while
>>>>> sorting, causing the segfault in the code (command.c IIRC).
>>>>> This broke the boot on some of my servers, so I think it's a
>>>>> rather
>>>>> big
>>>>> problem that perhaps can't be caught in reproducible builds.
>>>>> Can this be corrected upstream or should I just modify my build
>>>>> environment for LVM2?
>>>>>
>>>> Hi
>>>>
>>>> Interesting - can you send a patch to Makefile  to include
>>>> LC_COLLATE=C
>>>> in case it does fixes your problem
>>> I fixed it with a sed, the resulting patch is attached:
>>> --- LVM2.2.03.13-orig/tools/Makefile.in 2021-08-11
>>> 17:37:43.000000000
>>> +0200
>>> +++ LVM2.2.03.13/tools/Makefile.in      2021-09-02
>>> 17:41:42.113702990
>>> +0200
>>> @@ -181,7 +181,7 @@
>>>           ( cat $(srcdir)/license.inc && \
>>>             echo "/* Do not edit. This file is generated by the
>>> Makefile.
>>> */" && \
>>>             echo "cmd(CMD_NONE, none)" && \
>>> -         $(GREP) '^ID:' $(srcdir)/command-lines.in | LANG=C
>>> $(SORT) -u
>>>> $(AWK) '{print "cmd(" $$2 "_CMD, " $$2 ")"}' && \
>>> +         $(GREP) '^ID:' $(srcdir)/command-lines.in | LANG=C
>>> LC_COLLATE=C $(SORT) -u | $(AWK) '{print "cmd(" $$2 "_CMD, " $$2
>>> ")"}'
>>> && \
>>>             echo "cmd(CMD_COUNT, count)" \
>>>           ) > $@
>>
>> And does it also work if you set  LC_ALL=C   (instead of LANG=C
>> LC_COLLATE=C) ?
> Yes, it works also with LC_ALL=C alone (without either LANG_C or
> LC_COLLATE=C), I replaced LANG=C by LC_ALL=C in the Makefile and it
> worked perfectly, as expected, as LC_ALL is supposed to supersede LANG.
>

So thanks for checking,  I'll push this fix then.


Regards


Zdenek




More information about the linux-lvm mailing list