All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/lvm2: LC_ALL set to "C" locale before generating cmds
@ 2022-01-13 17:48 Jeremy Lyda via buildroot
  2022-01-13 19:36 ` Thomas Petazzoni
  0 siblings, 1 reply; 3+ messages in thread
From: Jeremy Lyda via buildroot @ 2022-01-13 17:48 UTC (permalink / raw)
  To: buildroot; +Cc: Jeremy Lyda


[-- Attachment #1.1: Type: text/plain, Size: 2 bytes --]



[-- Attachment #1.2: Type: text/html, Size: 377 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: package-lvm2-LC_ALL-set-to-C-locale-before-generatin.patch --]
[-- Type: text/x-patch; name="package-lvm2-LC_ALL-set-to-C-locale-before-generatin.patch", Size: 2475 bytes --]

From 8527acf5177dd17c0ffafcd1b331b25a51d7a705 Mon Sep 17 00:00:00 2001
From: Jeremy Lyda <jlyda@carnegierobotics.com>
Date: Thu, 13 Jan 2022 12:14:01 -0500
Subject: [PATCH 1/1] package/lvm2: LC_ALL set to "C" locale before generating
 cmds

Signed-off-by: Jeremy Lyda <jlyda@carnegierobotics.com>
---
 ...t-to-C-locale-before-generating-cmds.patch | 35 +++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 package/lvm2/0001-LC_ALL-set-to-C-locale-before-generating-cmds.patch

diff --git a/package/lvm2/0001-LC_ALL-set-to-C-locale-before-generating-cmds.patch b/package/lvm2/0001-LC_ALL-set-to-C-locale-before-generating-cmds.patch
new file mode 100644
index 0000000000..d9c31cc3f1
--- /dev/null
+++ b/package/lvm2/0001-LC_ALL-set-to-C-locale-before-generating-cmds.patch
@@ -0,0 +1,35 @@
+From 8742a873dc3a89095760152db62b827ddba8ca24 Mon Sep 17 00:00:00 2001
+From: Jeremy Lyda <jlyda@carnegierobotics.com>
+Date: Thu, 13 Jan 2022 12:00:54 -0500
+Subject: [PATCH 1/1] LC_ALL set to "C" locale before generating cmds
+
+An assumption is made prior to generating the cmds.h header file that the
+LC_COLLATE locale setting is set to "C" -- this is not always the case. If the
+locale is set for example to "en_US.UTF8" then it will alter the way that
+underscores compare to letters and numbers such that underscores will be sorted
+after letters and numbers. LVM in our experience does not gracefully handle
+this erroneous sorting and results in a segmentation fault at some point in
+program execution. Setting LC_ALL to the "C" locale (specifically LC_COLLATE)
+ensures a correct, consistent command environment across various systems.
+
+Signed-off-by: Jeremy Lyda <jlyda@carnegierobotics.com>
+---
+ tools/Makefile.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tools/Makefile.in b/tools/Makefile.in
+index ec546ca63..c8530915c 100644
+--- a/tools/Makefile.in
++++ b/tools/Makefile.in
+@@ -181,7 +181,7 @@ cmds.h: $(srcdir)/command-lines.in Makefile
+ 	( 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_ALL=C $(SORT) -u | $(AWK) '{print "cmd(" $$2 "_CMD, " $$2 ")"}' && \
+ 	  echo "cmd(CMD_COUNT, count)" \
+ 	) > $@
+ 
+-- 
+2.25.1
+
-- 
2.25.1


[-- Attachment #3: Type: text/plain, Size: 150 bytes --]

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/lvm2: LC_ALL set to "C" locale before generating cmds
  2022-01-13 17:48 [Buildroot] [PATCH 1/1] package/lvm2: LC_ALL set to "C" locale before generating cmds Jeremy Lyda via buildroot
@ 2022-01-13 19:36 ` Thomas Petazzoni
  2022-01-13 21:11   ` Jeremy Lyda via buildroot
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni @ 2022-01-13 19:36 UTC (permalink / raw)
  To: Jeremy Lyda via buildroot; +Cc: Jeremy Lyda

Hello Jeremy,

On Thu, 13 Jan 2022 17:48:57 +0000
Jeremy Lyda via buildroot <buildroot@buildroot.org> wrote:

> 

Thanks a lot for your patch. Did you submit this patch to the upstream
lvm2 project?

Also, could you send the patch with "git send-email", so that it
appears inline, and not as an attached file?

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/lvm2: LC_ALL set to "C" locale before generating cmds
  2022-01-13 19:36 ` Thomas Petazzoni
@ 2022-01-13 21:11   ` Jeremy Lyda via buildroot
  0 siblings, 0 replies; 3+ messages in thread
From: Jeremy Lyda via buildroot @ 2022-01-13 21:11 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: Jeremy Lyda, buildroot


Hello Thomas,

> Thanks a lot for your patch. Did you submit this patch to the upstream
> lvm2 project?

I have not yet gotten around to it, but I do intend on submitting it, yes.

> Also, could you send the patch with "git send-email", so that it
> appears inline, and not as an attached file?

I am struggling to get `git send-email` to cooperate with our mail server, but
I will attach an inline copy of the patch below:

From 8527acf5177dd17c0ffafcd1b331b25a51d7a705 Mon Sep 17 00:00:00 2001
From: Jeremy Lyda <jlyda@carnegierobotics.com>
Date: Thu, 13 Jan 2022 12:14:01 -0500
Subject: [PATCH 1/1] package/lvm2: LC_ALL set to "C" locale before generating
 cmds

Signed-off-by: Jeremy Lyda <jlyda@carnegierobotics.com>
---
 ...t-to-C-locale-before-generating-cmds.patch | 35 +++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 package/lvm2/0001-LC_ALL-set-to-C-locale-before-generating-cmds.patch

diff --git a/package/lvm2/0001-LC_ALL-set-to-C-locale-before-generating-cmds.patch b/package/lvm2/0001-LC_ALL-set-to-C-locale-before-generating-cmds.patch
new file mode 100644
index 0000000000..d9c31cc3f1
--- /dev/null
+++ b/package/lvm2/0001-LC_ALL-set-to-C-locale-before-generating-cmds.patch
@@ -0,0 +1,35 @@
+From 8742a873dc3a89095760152db62b827ddba8ca24 Mon Sep 17 00:00:00 2001
+From: Jeremy Lyda <jlyda@carnegierobotics.com>
+Date: Thu, 13 Jan 2022 12:00:54 -0500
+Subject: [PATCH 1/1] LC_ALL set to "C" locale before generating cmds
+
+An assumption is made prior to generating the cmds.h header file that the
+LC_COLLATE locale setting is set to "C" -- this is not always the case. If the
+locale is set for example to "en_US.UTF8" then it will alter the way that
+underscores compare to letters and numbers such that underscores will be sorted
+after letters and numbers. LVM in our experience does not gracefully handle
+this erroneous sorting and results in a segmentation fault at some point in
+program execution. Setting LC_ALL to the "C" locale (specifically LC_COLLATE)
+ensures a correct, consistent command environment across various systems.
+
+Signed-off-by: Jeremy Lyda <jlyda@carnegierobotics.com>
+---
+ tools/Makefile.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tools/Makefile.in b/tools/Makefile.in
+index ec546ca63..c8530915c 100644
+--- a/tools/Makefile.in
++++ b/tools/Makefile.in
+@@ -181,7 +181,7 @@ cmds.h: $(srcdir)/command-lines.in Makefile
+ 	( 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_ALL=C $(SORT) -u | $(AWK) '{print "cmd(" $$2 "_CMD, " $$2 ")"}' && \
+ 	  echo "cmd(CMD_COUNT, count)" \
+ 	) > $@
+ 
+-- 
+2.25.1
+
-- 
2.25.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2022-01-13 21:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-13 17:48 [Buildroot] [PATCH 1/1] package/lvm2: LC_ALL set to "C" locale before generating cmds Jeremy Lyda via buildroot
2022-01-13 19:36 ` Thomas Petazzoni
2022-01-13 21:11   ` Jeremy Lyda via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.