Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] base-files: don't overwrite existing locale and define default LANG
@ 2022-09-13 18:23 oreo639
  2022-09-13 18:25 ` [PR PATCH] [Updated] " oreo639
                   ` (71 more replies)
  0 siblings, 72 replies; 73+ messages in thread
From: oreo639 @ 2022-09-13 18:23 UTC (permalink / raw)
  To: ml

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

There is a new pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Closes: https://github.com/void-linux/void-packages/issues/15292
Closes: https://github.com/void-linux/void-packages/pull/39196

Based on what is done on Arch: https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1017 bytes --]

From f2d5a51c5b5b9d9fb6d9726693112d87c0152977 Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

---
 srcpkgs/base-files/files/locale.sh | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf..bf266eefa1d1 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,15 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
-if [ -s /etc/locale.conf ]; then
-	. /etc/locale.conf
+
+if [ -z "$LANG" ]; then
+	if [ -s /etc/locale.conf ]; then
+		. /etc/locale.conf
+	fi
 fi
 
+# define default LANG to C if not already defined
+LANG=${LANG:-C}
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
 export LC_INDENTIFICATION

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
@ 2022-09-13 18:25 ` oreo639
  2022-09-26  6:36 ` oreo639
                   ` (70 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2022-09-13 18:25 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Closes: https://github.com/void-linux/void-packages/issues/15292
Closes: https://github.com/void-linux/void-packages/pull/39196

Based on what is done on Arch: https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1435 bytes --]

From 5d836e38deafbc1666a12dcf1fc5b2ba8fd277e6 Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

---
 srcpkgs/base-files/files/locale.sh | 10 ++++++++--
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf..bf266eefa1d1 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,15 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
-if [ -s /etc/locale.conf ]; then
-	. /etc/locale.conf
+
+if [ -z "$LANG" ]; then
+	if [ -s /etc/locale.conf ]; then
+		. /etc/locale.conf
+	fi
 fi
 
+# define default LANG to C if not already defined
+LANG=${LANG:-C}
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
 export LC_INDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index be6384f942c6..f4d9085b32e4 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.142
-revision=14
+revision=15
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
  2022-09-13 18:25 ` [PR PATCH] [Updated] " oreo639
@ 2022-09-26  6:36 ` oreo639
  2022-09-26  6:36 ` oreo639
                   ` (69 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2022-09-26  6:36 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Closes: https://github.com/void-linux/void-packages/issues/15292

Based on what is done on Arch:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1441 bytes --]

From d35e98e81242b845256d8bb50f514170d8f32303 Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

---
 srcpkgs/base-files/files/locale.sh | 10 ++++++++--
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf..b7e198eca772 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,15 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
-if [ -s /etc/locale.conf ]; then
-	. /etc/locale.conf
+
+if [ -z "$LANG" ]; then
+	if [ -s /etc/locale.conf ]; then
+		. /etc/locale.conf
+	fi
 fi
 
+# define default LANG to C if not already defined
+LANG=${LANG:-C.UTF-8}
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
 export LC_INDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index be6384f942c6..f4d9085b32e4 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.142
-revision=14
+revision=15
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
  2022-09-13 18:25 ` [PR PATCH] [Updated] " oreo639
  2022-09-26  6:36 ` oreo639
@ 2022-09-26  6:36 ` oreo639
  2022-09-26  6:37 ` oreo639
                   ` (68 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2022-09-26  6:36 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Closes: https://github.com/void-linux/void-packages/issues/15292

Based on what is done on Arch:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1447 bytes --]

From 2dc7484bf25f9f36d2aa597d4f7bca41fc8ff5b6 Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

---
 srcpkgs/base-files/files/locale.sh | 10 ++++++++--
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf..743ef5517b9d 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,15 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
-if [ -s /etc/locale.conf ]; then
-	. /etc/locale.conf
+
+if [ -z "$LANG" ]; then
+	if [ -s /etc/locale.conf ]; then
+		. /etc/locale.conf
+	fi
 fi
 
+# define default LANG to C.UTF-8 if not already defined
+LANG=${LANG:-C.UTF-8}
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
 export LC_INDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index be6384f942c6..f4d9085b32e4 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.142
-revision=14
+revision=15
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (2 preceding siblings ...)
  2022-09-26  6:36 ` oreo639
@ 2022-09-26  6:37 ` oreo639
  2022-12-26  1:57 ` github-actions
                   ` (67 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2022-09-26  6:37 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Closes: https://github.com/void-linux/void-packages/issues/15292

Based on what is done on Arch:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1447 bytes --]

From fb31cffbd11584fff924d352138e971cfe8a31ee Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

---
 srcpkgs/base-files/files/locale.sh | 10 ++++++++--
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf..743ef5517b9d 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,15 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
-if [ -s /etc/locale.conf ]; then
-	. /etc/locale.conf
+
+if [ -z "$LANG" ]; then
+	if [ -s /etc/locale.conf ]; then
+		. /etc/locale.conf
+	fi
 fi
 
+# define default LANG to C.UTF-8 if not already defined
+LANG=${LANG:-C.UTF-8}
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
 export LC_INDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index be6384f942c6..f4d9085b32e4 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.142
-revision=14
+revision=15
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (3 preceding siblings ...)
  2022-09-26  6:37 ` oreo639
@ 2022-12-26  1:57 ` github-actions
  2022-12-26  2:02 ` oreo639
                   ` (66 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: github-actions @ 2022-12-26  1:57 UTC (permalink / raw)
  To: ml

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

New comment by github-actions[bot] on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1364805363

Comment:
Pull Requests become stale 90 days after last activity and are closed 14 days after that.  If this pull request is still relevant bump it or assign it.

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (4 preceding siblings ...)
  2022-12-26  1:57 ` github-actions
@ 2022-12-26  2:02 ` oreo639
  2022-12-26  2:22 ` [PR PATCH] [Updated] " oreo639
                   ` (65 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2022-12-26  2:02 UTC (permalink / raw)
  To: ml

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

New comment by oreo639 on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1364808727

Comment:
bump

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (5 preceding siblings ...)
  2022-12-26  2:02 ` oreo639
@ 2022-12-26  2:22 ` oreo639
  2023-01-02 15:29 ` leahneukirchen
                   ` (64 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2022-12-26  2:22 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

Closes: https://github.com/void-linux/void-packages/issues/15292

Based on what is done on Arch:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

You can see here for the `locale.conf` specification: https://man7.org/linux/man-pages/man5/locale.conf.5.html

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1447 bytes --]

From c088095b7f2ec0a85172887a93d8624d1af03016 Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

---
 srcpkgs/base-files/files/locale.sh | 10 ++++++++--
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf..743ef5517b9d 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,15 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
-if [ -s /etc/locale.conf ]; then
-	. /etc/locale.conf
+
+if [ -z "$LANG" ]; then
+	if [ -s /etc/locale.conf ]; then
+		. /etc/locale.conf
+	fi
 fi
 
+# define default LANG to C.UTF-8 if not already defined
+LANG=${LANG:-C.UTF-8}
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
 export LC_INDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index be6384f942c6..f4d9085b32e4 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.142
-revision=14
+revision=15
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (6 preceding siblings ...)
  2022-12-26  2:22 ` [PR PATCH] [Updated] " oreo639
@ 2023-01-02 15:29 ` leahneukirchen
  2023-01-02 19:53 ` oreo639
                   ` (63 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: leahneukirchen @ 2023-01-02 15:29 UTC (permalink / raw)
  To: ml

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

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1369037248

Comment:
Why would this work? Doesn't bash start with /etc/profile, which then sources /etc/profile.d/*?

In any case, setting it later in .profile overrides this.

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (7 preceding siblings ...)
  2023-01-02 15:29 ` leahneukirchen
@ 2023-01-02 19:53 ` oreo639
  2023-01-02 19:54 ` oreo639
                   ` (62 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-01-02 19:53 UTC (permalink / raw)
  To: ml

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

New comment by oreo639 on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1369171391

Comment:
Because GDM sets LANG and then gnome-session launches bash as a login shell.

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (8 preceding siblings ...)
  2023-01-02 19:53 ` oreo639
@ 2023-01-02 19:54 ` oreo639
  2023-01-02 20:23 ` oreo639
                   ` (61 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-01-02 19:54 UTC (permalink / raw)
  To: ml

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

New comment by oreo639 on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1369171391

Comment:
Because GDM sets LANG and then gnome-session launches bash as a login shell so that `/etc/profile` can be applied.

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (9 preceding siblings ...)
  2023-01-02 19:54 ` oreo639
@ 2023-01-02 20:23 ` oreo639
  2023-01-03  5:45 ` oreo639
                   ` (60 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-01-02 20:23 UTC (permalink / raw)
  To: ml

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

New comment by oreo639 on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1369171391

Comment:
Because GDM sets LANG and then gnome-session launches bash as a login shell so that `/etc/profile` can be applied which overwrites the previous LANG preference.

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (10 preceding siblings ...)
  2023-01-02 20:23 ` oreo639
@ 2023-01-03  5:45 ` oreo639
  2023-01-03  5:45 ` oreo639
                   ` (59 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-01-03  5:45 UTC (permalink / raw)
  To: ml

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

New comment by oreo639 on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1369171391

Comment:
Because GDM sets LANG and then gnome-session launches bash as a login shell so that `/etc/profile` can be applied which overwrites the previous LANG preference.

This PR adds a check for if LANG is already defined before applying the system-wide preference.

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (11 preceding siblings ...)
  2023-01-03  5:45 ` oreo639
@ 2023-01-03  5:45 ` oreo639
  2023-01-03  5:45 ` oreo639
                   ` (58 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-01-03  5:45 UTC (permalink / raw)
  To: ml

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

New comment by oreo639 on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1369171391

Comment:
Because GDM sets LANG and then gnome-session launches bash as a login shell so that `/etc/profile` can be applied which overwrites the previous LANG preference.

This PR adds a check for if LANG is already defined (i.e. by the user) before applying the system-wide preference.

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (12 preceding siblings ...)
  2023-01-03  5:45 ` oreo639
@ 2023-01-03  5:45 ` oreo639
  2023-04-03  2:41 ` [PR PATCH] [Updated] " oreo639
                   ` (57 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-01-03  5:45 UTC (permalink / raw)
  To: ml

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

New comment by oreo639 on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1369171391

Comment:
Because GDM sets LANG and then gnome-session launches bash as a login shell so that `/etc/profile` can be applied which overwrites the previous LANG preference.

This PR adds a check for if LANG is already defined (i.e. by the user/DE/etc) before applying the system-wide preference.

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (13 preceding siblings ...)
  2023-01-03  5:45 ` oreo639
@ 2023-04-03  2:41 ` oreo639
  2023-06-20  3:00 ` oreo639
                   ` (56 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-04-03  2:41 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

According to the locale.conf specification:

> The locale settings configured in /etc/locale.conf are
> system-wide and are inherited by every service or user, unless
> overridden or unset by individual programs or users.

https://man7.org/linux/man-pages/man5/locale.conf.5.html

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which afaict goes against what is stated above.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

Fedora does something way way more complicated using include guards and having bashrc and profile load each other and is definitely not what we want to do.

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1449 bytes --]

From 9693366515f354ee8b0c470b7d62e3530cf0675f Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

---
 srcpkgs/base-files/files/locale.sh | 10 ++++++++--
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf9..743ef5517b9d5 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,15 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
-if [ -s /etc/locale.conf ]; then
-	. /etc/locale.conf
+
+if [ -z "$LANG" ]; then
+	if [ -s /etc/locale.conf ]; then
+		. /etc/locale.conf
+	fi
 fi
 
+# define default LANG to C.UTF-8 if not already defined
+LANG=${LANG:-C.UTF-8}
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
 export LC_INDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index 27b83604b6489..b96d09351a08f 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.143
-revision=1
+revision=2
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (14 preceding siblings ...)
  2023-04-03  2:41 ` [PR PATCH] [Updated] " oreo639
@ 2023-06-20  3:00 ` oreo639
  2023-06-20  3:14 ` [PR REVIEW] " classabbyamp
                   ` (55 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-06-20  3:00 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

According to the locale.conf specification:

> The locale settings configured in /etc/locale.conf are
> system-wide and are inherited by every service or user, unless
> overridden or unset by individual programs or users.

https://man7.org/linux/man-pages/man5/locale.conf.5.html

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which afaict goes against what is stated above.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

Fedora does something way way more complicated using include guards and having bashrc and profile load each other and is definitely not what we want to do.

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1445 bytes --]

From ac82620c1fd80c83336ea1fa2869aec53604d0ab Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

---
 srcpkgs/base-files/files/locale.sh | 10 ++++++++--
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf..743ef5517b9d 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,15 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
-if [ -s /etc/locale.conf ]; then
-	. /etc/locale.conf
+
+if [ -z "$LANG" ]; then
+	if [ -s /etc/locale.conf ]; then
+		. /etc/locale.conf
+	fi
 fi
 
+# define default LANG to C.UTF-8 if not already defined
+LANG=${LANG:-C.UTF-8}
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
 export LC_INDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index b96d09351a08..3f2696ba6954 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.143
-revision=2
+revision=3
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: [PR REVIEW] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (15 preceding siblings ...)
  2023-06-20  3:00 ` oreo639
@ 2023-06-20  3:14 ` classabbyamp
  2023-06-20  3:18 ` [PR PATCH] [Updated] " oreo639
                   ` (54 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: classabbyamp @ 2023-06-20  3:14 UTC (permalink / raw)
  To: ml

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

New review comment by classabbyamp on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#discussion_r1234685978

Comment:
```suggestion
LANG="${LANG:-C.UTF-8}"
```

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (16 preceding siblings ...)
  2023-06-20  3:14 ` [PR REVIEW] " classabbyamp
@ 2023-06-20  3:18 ` oreo639
  2023-06-20  3:43 ` oreo639
                   ` (53 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-06-20  3:18 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

According to the locale.conf specification:

> The locale settings configured in /etc/locale.conf are
> system-wide and are inherited by every service or user, unless
> overridden or unset by individual programs or users.

https://man7.org/linux/man-pages/man5/locale.conf.5.html

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which afaict goes against what is stated above.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

Fedora does something way way more complicated using include guards and having bashrc and profile load each other and is definitely not what we want to do.

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1447 bytes --]

From efa03095e06e5e37b0202da3c42fe8bb0a6be028 Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

---
 srcpkgs/base-files/files/locale.sh | 10 ++++++++--
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf..00c625c50838 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,15 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
-if [ -s /etc/locale.conf ]; then
-	. /etc/locale.conf
+
+if [ -z "$LANG" ]; then
+	if [ -s /etc/locale.conf ]; then
+		. /etc/locale.conf
+	fi
 fi
 
+# define default LANG to C.UTF-8 if not already defined
+LANG="${LANG:-C.UTF-8}"
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
 export LC_INDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index b96d09351a08..3f2696ba6954 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.143
-revision=2
+revision=3
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (17 preceding siblings ...)
  2023-06-20  3:18 ` [PR PATCH] [Updated] " oreo639
@ 2023-06-20  3:43 ` oreo639
  2023-06-20  4:29 ` oreo639
                   ` (52 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-06-20  3:43 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

According to the locale.conf specification:

> The locale settings configured in /etc/locale.conf are
> system-wide and are inherited by every service or user, unless
> overridden or unset by individual programs or users.

https://man7.org/linux/man-pages/man5/locale.conf.5.html

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which afaict goes against what is stated above.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

Fedora does something way way more complicated using include guards and having bashrc and profile load each other and is definitely not what we want to do.

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 3363 bytes --]

From e431b4a1df6299b882b51e2a5f1be487161727c4 Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

---
 srcpkgs/base-files/files/locale.sh | 67 ++++++++++++++++++++++++++++++
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 68 insertions(+), 1 deletion(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf..d5b583d82b53 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,76 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
+
+_backup_LANG="${LANG}"
+_backup_LANGUAGE="${LANGUAGE}"
+_backup_LC_CTYPE="${LC_CTYPE}"
+_backup_LC_NUMERIC="${LC_NUMERIC}"
+_backup_LC_TIME="${LC_TIME}"
+_backup_LC_COLLATE="${LC_COLLATE}"
+_backup_LC_MONETARY="${LC_MONETARY}"
+_backup_LC_MESSAGES="${LC_MESSAGES}"
+_backup_LC_PAPER="${LC_PAPER}"
+_backup_LC_NAME="${LC_NAME}"
+_backup_LC_ADDRESS="${LC_ADDRESS}"
+_backup_LC_TELEPHONE="${LC_TELEPHONE}"
+_backup_LC_MEASUREMENT="${LC_MEASUREMENT}"
+_backup_LC_INDENTIFICATION="${LC_INDENTIFICATION}"
+
 if [ -s /etc/locale.conf ]; then
 	. /etc/locale.conf
 fi
 
+if [ -n "${_backup_LANG}" ]; then
+    LANG="${_backup_LANG}"
+fi
+if [ -n "${_backup_LANGUAGE}" ]; then
+    LANGUAGE="${_backup_LANGUAGE}"
+fi
+if [ -n "${_backup_LC_CTYPE}" ]; then
+    LC_CTYPE="${_backup_LC_CTYPE}"
+fi
+if [ -n "${_backup_LC_NUMERIC}" ]; then
+    LC_NUMERIC="${_backup_LC_NUMERIC}"
+fi
+if [ -n "${_backup_LC_TIME}" ]; then
+    LC_TIME="${_backup_LC_TIME}"
+fi
+if [ -n "${_backup_LC_COLLATE}" ]; then
+    LC_COLLATE="${_backup_LC_COLLATE}"
+fi
+if [ -n "${_backup_LC_MONETARY}" ]; then
+    LC_MONETARY="${_backup_LC_MONETARY}"
+fi
+if [ -n "${_backup_LC_MESSAGES}" ]; then
+    LC_MESSAGES="${_backup_LC_MESSAGES}"
+fi
+if [ -n "${_backup_LC_PAPER}" ]; then
+    LC_PAPER="${_backup_LC_PAPER}"
+fi
+if [ -n "${_backup_LC_NAME}" ]; then
+    LC_NAME="${_backup_LC_NAME}"
+fi
+if [ -n "${_backup_LC_ADDRESS}" ]; then
+    LC_ADDRESS="${_backup_LC_ADDRESS}"
+fi
+if [ -n "${_backup_LC_TELEPHONE}" ]; then
+    LC_TELEPHONE="${_backup_LC_TELEPHONE}"
+fi
+if [ -n "${_backup_LC_MEASUREMENT}" ]; then
+    LC_MEASUREMENT="${_backup_LC_MEASUREMENT}"
+fi
+if [ -n "${_backup_LC_INDENTIFICATION}" ]; then
+    LC_INDENTIFICATION="${_backup_LC_INDENTIFICATION}"
+fi
+
+unset _backup_LANG _backup_LANGUAGE _backup_LC_CTYPE _backup_LC_NUMERIC
+unset _backup_LC_TIME _backup_LC_COLLATE _backup_LC_MONETARY _backup_LC_MESSAGES
+unset _backup_LC_PAPER _backup_LC_NAME _backup_LC_ADDRESS _backup_LC_TELEPHONE
+unset _backup_LC_MEASUREMENT _backup_LC_INDENTIFICATION 
+
+# define default LANG to C.UTF-8 if not already defined
+LANG="${LANG:-C.UTF-8}"
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
 export LC_INDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index b96d09351a08..3f2696ba6954 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.143
-revision=2
+revision=3
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (18 preceding siblings ...)
  2023-06-20  3:43 ` oreo639
@ 2023-06-20  4:29 ` oreo639
  2023-06-20 21:08 ` oreo639
                   ` (51 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-06-20  4:29 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

According to the locale.conf specification:

> The locale settings configured in /etc/locale.conf are
> system-wide and are inherited by every service or user, unless
> overridden or unset by individual programs or users.

https://man7.org/linux/man-pages/man5/locale.conf.5.html

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which afaict goes against what is stated above.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

Fedora does something way way more complicated using include guards and having bashrc and profile load each other and is definitely not what we want to do.

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1846 bytes --]

From 7960f3ff73e0c21241b76b33cc36b1913f800758 Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

---
 srcpkgs/base-files/files/locale.sh | 18 ++++++++++++++++++
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf..6218dbae4b3e 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,27 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
+
+for a in LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY \
+ LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT \
+ LC_INDENTIFICATION; do
+	eval '_backup_'${a}'="${'${a}'}"'
+done
+
 if [ -s /etc/locale.conf ]; then
 	. /etc/locale.conf
 fi
 
+for a in LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY \
+ LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT \
+ LC_INDENTIFICATION; do
+	eval 'if [ -n ${_backup_'${a}'} ]; then
+		'${a}'="${_backup_'${a}'}"
+	fi'
+done
+
+# define default LANG to C.UTF-8 if not already defined
+LANG="${LANG:-C.UTF-8}"
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
 export LC_INDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index b96d09351a08..3f2696ba6954 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.143
-revision=2
+revision=3
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (19 preceding siblings ...)
  2023-06-20  4:29 ` oreo639
@ 2023-06-20 21:08 ` oreo639
  2023-06-20 21:21 ` oreo639
                   ` (50 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-06-20 21:08 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which causes issues with GDM.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

You can see what Fedora does here:
https://gist.github.com/oreo639/3b83b852ce0db21e21eed102a57c5148
(taken from the setup package)

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1844 bytes --]

From 5c46541000e158b40ae6f886ddbd599bed0bd8aa Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

---
 srcpkgs/base-files/files/locale.sh | 18 ++++++++++++++++++
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf..68206544b7bc 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,27 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
+
+for a in LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY \
+ LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT \
+ LC_INDENTIFICATION; do
+	eval '_backup_'${a}'="$'${a}'"'
+done
+
 if [ -s /etc/locale.conf ]; then
 	. /etc/locale.conf
 fi
 
+for a in LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY \
+ LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT \
+ LC_INDENTIFICATION; do
+	eval 'if [ -n "$_backup_'${a}'" ]; then
+		'${a}'="${_backup_'${a}'}"
+	fi'
+done
+
+# define default LANG to C.UTF-8 if not already defined
+LANG="${LANG:-C.UTF-8}"
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
 export LC_INDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index b96d09351a08..3f2696ba6954 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.143
-revision=2
+revision=3
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (20 preceding siblings ...)
  2023-06-20 21:08 ` oreo639
@ 2023-06-20 21:21 ` oreo639
  2023-06-21 10:37 ` oreo639
                   ` (49 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-06-20 21:21 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which causes issues with GDM.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

You can see what Fedora does here:
https://gist.github.com/oreo639/3b83b852ce0db21e21eed102a57c5148
(taken from the setup package)

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1842 bytes --]

From 4e8cd730904e46a42f52670935f37bdfafc6bd87 Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

---
 srcpkgs/base-files/files/locale.sh | 18 ++++++++++++++++++
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf..03ede1ea2a36 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,27 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
+
+for a in LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY \
+ LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT \
+ LC_INDENTIFICATION; do
+	eval '_backup_'${a}'="$'${a}'"'
+done
+
 if [ -s /etc/locale.conf ]; then
 	. /etc/locale.conf
 fi
 
+for a in LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY \
+ LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT \
+ LC_INDENTIFICATION; do
+	eval 'if [ -n "$_backup_'${a}'" ]; then
+		'${a}'="$_backup_'${a}'"
+	fi'
+done
+
+# define default LANG to C.UTF-8 if not already defined
+LANG="${LANG:-C.UTF-8}"
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
 export LC_INDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index b96d09351a08..3f2696ba6954 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.143
-revision=2
+revision=3
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (21 preceding siblings ...)
  2023-06-20 21:21 ` oreo639
@ 2023-06-21 10:37 ` oreo639
  2023-06-21 11:08 ` oreo639
                   ` (48 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-06-21 10:37 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which causes issues with GDM.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

You can see what Fedora does here:
https://gist.github.com/oreo639/3b83b852ce0db21e21eed102a57c5148
(taken from the setup package)

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1908 bytes --]

From c2fc7d91f9e5a86a1bdbe66ccfd3371273fa900e Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

Correct spelling of LC_IDENTIFICATION.
---
 srcpkgs/base-files/files/locale.sh | 20 +++++++++++++++++++-
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf..3cdea42cd497 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,27 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
+
+for a in LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY \
+ LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT \
+ LC_IDENTIFICATION; do
+	eval '_backup_'${a}'="$'${a}'"'
+done
+
 if [ -s /etc/locale.conf ]; then
 	. /etc/locale.conf
 fi
 
+for a in LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY \
+ LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT \
+ LC_IDENTIFICATION; do
+	eval 'if [ -n "$_backup_'${a}'" ]; then
+		'${a}'="$_backup_'${a}'"
+	fi'
+done
+
+# define default LANG to C.UTF-8 if not already defined
+LANG="${LANG:-C.UTF-8}"
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
-export LC_INDENTIFICATION
+export LC_IDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index b96d09351a08..3f2696ba6954 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.143
-revision=2
+revision=3
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (22 preceding siblings ...)
  2023-06-21 10:37 ` oreo639
@ 2023-06-21 11:08 ` oreo639
  2023-06-21 11:10 ` oreo639
                   ` (47 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-06-21 11:08 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which causes issues with GDM.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

You can see what Fedora does here:
https://gist.github.com/oreo639/3b83b852ce0db21e21eed102a57c5148
(taken from the setup package)

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1826 bytes --]

From 27155ac29a2d0fe9af70259cbda491733a79e9f9 Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

Correct spelling of LC_IDENTIFICATION.
---
 srcpkgs/base-files/files/locale.sh | 23 ++++++++++++++++++++---
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf..e7042543506c 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,26 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
+_localevars="LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
+ LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
+ LC_IDENTIFICATION"
+
+for a in $_localevars; do
+	eval '_backup_'${a}'="$'${a}'"'
+done
+
 if [ -s /etc/locale.conf ]; then
 	. /etc/locale.conf
 fi
 
-export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
-export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
-export LC_INDENTIFICATION
+for a in $_localevars; do
+	eval 'if [ -n "$_backup_'${a}'" ]; then
+		'${a}'="$_backup_'${a}'"
+	fi'
+	unset "_backup_${a}"
+done
+
+# define default LANG to C.UTF-8 if not already defined
+LANG="${LANG:-C.UTF-8}"
+
+export $_localevars
+unset _localevars
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index b96d09351a08..3f2696ba6954 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.143
-revision=2
+revision=3
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (23 preceding siblings ...)
  2023-06-21 11:08 ` oreo639
@ 2023-06-21 11:10 ` oreo639
  2023-06-21 11:14 ` oreo639
                   ` (46 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-06-21 11:10 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which causes issues with GDM.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

You can see what Fedora does here:
https://gist.github.com/oreo639/3b83b852ce0db21e21eed102a57c5148
(taken from the setup package)

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1782 bytes --]

From 3c16589da22f69c8f65005edb22b5c47265e4011 Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

Correct spelling of LC_IDENTIFICATION.
---
 srcpkgs/base-files/files/locale.sh | 21 ++++++++++++++++++---
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf..a1e02b27ff68 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,24 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
+_localevars="LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
+ LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
+ LC_IDENTIFICATION"
+
+for a in $_localevars; do
+	eval '_backup_'${a}'="$'${a}'"'
+done
+
 if [ -s /etc/locale.conf ]; then
 	. /etc/locale.conf
 fi
 
-export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
-export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
-export LC_INDENTIFICATION
+for a in $_localevars; do
+	eval 'if [ -n "$_backup_'${a}'" ]; then
+		'${a}'="$_backup_'${a}'"
+	fi'
+done
+
+# define default LANG to C.UTF-8 if not already defined
+LANG="${LANG:-C.UTF-8}"
+
+export $_localevars
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index b96d09351a08..3f2696ba6954 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.143
-revision=2
+revision=3
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (24 preceding siblings ...)
  2023-06-21 11:10 ` oreo639
@ 2023-06-21 11:14 ` oreo639
  2023-06-21 11:47 ` oreo639
                   ` (45 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-06-21 11:14 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which causes issues with GDM.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

You can see what Fedora does here:
https://gist.github.com/oreo639/3b83b852ce0db21e21eed102a57c5148
(taken from the setup package)

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1826 bytes --]

From 992fb1b70c3a64920cfdc175852b800f2c3af90d Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

Correct spelling of LC_IDENTIFICATION.
---
 srcpkgs/base-files/files/locale.sh | 23 ++++++++++++++++++++---
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf..e7042543506c 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,26 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
+_localevars="LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
+ LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
+ LC_IDENTIFICATION"
+
+for a in $_localevars; do
+	eval '_backup_'${a}'="$'${a}'"'
+done
+
 if [ -s /etc/locale.conf ]; then
 	. /etc/locale.conf
 fi
 
-export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
-export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
-export LC_INDENTIFICATION
+for a in $_localevars; do
+	eval 'if [ -n "$_backup_'${a}'" ]; then
+		'${a}'="$_backup_'${a}'"
+	fi'
+	unset "_backup_${a}"
+done
+
+# define default LANG to C.UTF-8 if not already defined
+LANG="${LANG:-C.UTF-8}"
+
+export $_localevars
+unset _localevars
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index b96d09351a08..3f2696ba6954 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.143
-revision=2
+revision=3
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (25 preceding siblings ...)
  2023-06-21 11:14 ` oreo639
@ 2023-06-21 11:47 ` oreo639
  2023-09-20  1:45 ` github-actions
                   ` (44 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-06-21 11:47 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which causes issues with GDM.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

You can see what Fedora does here:
https://gist.github.com/oreo639/3b83b852ce0db21e21eed102a57c5148
(taken from the setup package)

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1828 bytes --]

From 7d281b0b7af798fdc9be7f7a7dd1cd02c9231e10 Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

Correct spelling of LC_IDENTIFICATION.
---
 srcpkgs/base-files/files/locale.sh | 23 ++++++++++++++++++++---
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf..3c5f495a4353 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,26 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
+_localevars="LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
+ LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
+ LC_IDENTIFICATION"
+
+for a in $_localevars; do
+	eval '_backup_'${a}'="$'${a}'"'
+done
+
 if [ -s /etc/locale.conf ]; then
 	. /etc/locale.conf
 fi
 
-export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
-export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
-export LC_INDENTIFICATION
+for a in $_localevars; do
+	eval 'if [ -n "$_backup_'${a}'" ]; then
+		'${a}'="$_backup_'${a}'"
+	fi'
+	unset "_backup_${a}"
+done
+
+# define default LANG to C.UTF-8 if not already defined
+LANG="${LANG:-C.UTF-8}"
+
+export $_localevars
+unset _localevars a
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index b96d09351a08..3f2696ba6954 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.143
-revision=2
+revision=3
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (26 preceding siblings ...)
  2023-06-21 11:47 ` oreo639
@ 2023-09-20  1:45 ` github-actions
  2023-09-20  5:06 ` oreo639
                   ` (43 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: github-actions @ 2023-09-20  1:45 UTC (permalink / raw)
  To: ml

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

New comment by github-actions[bot] on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1726759978

Comment:
Pull Requests become stale 90 days after last activity and are closed 14 days after that.  If this pull request is still relevant bump it or assign it.

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (27 preceding siblings ...)
  2023-09-20  1:45 ` github-actions
@ 2023-09-20  5:06 ` oreo639
  2023-09-21 16:05 ` leahneukirchen
                   ` (42 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-09-20  5:06 UTC (permalink / raw)
  To: ml

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

New comment by oreo639 on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1726977012

Comment:
bump

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (28 preceding siblings ...)
  2023-09-20  5:06 ` oreo639
@ 2023-09-21 16:05 ` leahneukirchen
  2023-09-21 19:09 ` oreo639
                   ` (41 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: leahneukirchen @ 2023-09-21 16:05 UTC (permalink / raw)
  To: ml

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

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1729878548

Comment:
This feels very crude... I wonder if this would work instead:

```
while read -r line < /etc/locale.conf; do
	eval ": \${{$line}}"
done
```

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (29 preceding siblings ...)
  2023-09-21 16:05 ` leahneukirchen
@ 2023-09-21 19:09 ` oreo639
  2023-09-21 20:37 ` oreo639
                   ` (40 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-09-21 19:09 UTC (permalink / raw)
  To: ml

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

New comment by oreo639 on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1730149488

Comment:
Instead of sourcing the conf file?

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (30 preceding siblings ...)
  2023-09-21 19:09 ` oreo639
@ 2023-09-21 20:37 ` oreo639
  2023-09-21 21:03 ` [PR PATCH] [Updated] " oreo639
                   ` (39 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-09-21 20:37 UTC (permalink / raw)
  To: ml

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

New comment by oreo639 on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1730149488

Comment:
Instead of sourcing the conf file?

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (31 preceding siblings ...)
  2023-09-21 20:37 ` oreo639
@ 2023-09-21 21:03 ` oreo639
  2023-09-21 21:06 ` oreo639
                   ` (38 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-09-21 21:03 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which causes issues with GDM.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

You can see what Fedora does here:
https://gist.github.com/oreo639/3b83b852ce0db21e21eed102a57c5148
(taken from the setup package)

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1563 bytes --]

From 08d9a2dcf1458d7eed22be06afa313e0cc3ceb76 Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

Correct spelling of LC_IDENTIFICATION.
---
 srcpkgs/base-files/files/locale.sh | 13 +++++++++++--
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf9..0e7320d724000 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,18 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
+
 if [ -s /etc/locale.conf ]; then
-	. /etc/locale.conf
+	while read -r line; do
+		line="${line%#*}"
+		if [ ! -z "$line" ]; then
+			eval ": \${$line}"
+		fi
+	done < /etc/locale.conf
 fi
 
+# define default LANG to C.UTF-8 if not already defined
+LANG="${LANG:-C.UTF-8}"
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
-export LC_INDENTIFICATION
+export LC_IDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index c3b59c8e6cd28..80b65683d2a34 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.143
-revision=3
+revision=4
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (32 preceding siblings ...)
  2023-09-21 21:03 ` [PR PATCH] [Updated] " oreo639
@ 2023-09-21 21:06 ` oreo639
  2023-09-21 21:10 ` oreo639
                   ` (37 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-09-21 21:06 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which causes issues with GDM.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

You can see what Fedora does here:
https://gist.github.com/oreo639/3b83b852ce0db21e21eed102a57c5148
(taken from the setup package)

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1564 bytes --]

From 830489561af66b6c1eff13c43875e861cdceeb44 Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

Correct spelling of LC_IDENTIFICATION.
---
 srcpkgs/base-files/files/locale.sh | 13 +++++++++++--
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf9..cd19adc678f4a 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,18 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
+
 if [ -s /etc/locale.conf ]; then
-	. /etc/locale.conf
+	while read -r line; do
+		line="${line%%#*}"
+		if [ ! -z "$line" ]; then
+			eval ": \${$line}"
+		fi
+	done < /etc/locale.conf
 fi
 
+# define default LANG to C.UTF-8 if not already defined
+LANG="${LANG:-C.UTF-8}"
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
-export LC_INDENTIFICATION
+export LC_IDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index c3b59c8e6cd28..80b65683d2a34 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.143
-revision=3
+revision=4
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (33 preceding siblings ...)
  2023-09-21 21:06 ` oreo639
@ 2023-09-21 21:10 ` oreo639
  2023-09-21 21:11 ` [PR PATCH] [Updated] " oreo639
                   ` (36 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-09-21 21:10 UTC (permalink / raw)
  To: ml

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

New comment by oreo639 on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1730307385

Comment:
Thanks.

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (34 preceding siblings ...)
  2023-09-21 21:10 ` oreo639
@ 2023-09-21 21:11 ` oreo639
  2023-09-21 21:14 ` oreo639
                   ` (35 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-09-21 21:11 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which causes issues with GDM.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

You can see what Fedora does here:
https://gist.github.com/oreo639/3b83b852ce0db21e21eed102a57c5148
(taken from the setup package)

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1561 bytes --]

From a25a1eeb9d00c039a92e9aca105872592f02946f Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

Correct spelling of LC_IDENTIFICATION.
---
 srcpkgs/base-files/files/locale.sh | 12 ++++++++++--
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf9..bb578970c3100 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,17 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
 if [ -s /etc/locale.conf ]; then
-	. /etc/locale.conf
+	while read -r line; do
+		line="${line%%#*}"
+		if [ ! -z "$line" ]; then
+			echo ": \${$line}"
+		fi
+	done < /etc/locale.conf
 fi
 
+# define default LANG to C.UTF-8 if not already defined
+LANG="${LANG:-C.UTF-8}"
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
-export LC_INDENTIFICATION
+export LC_IDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index c3b59c8e6cd28..80b65683d2a34 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.143
-revision=3
+revision=4
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (35 preceding siblings ...)
  2023-09-21 21:11 ` [PR PATCH] [Updated] " oreo639
@ 2023-09-21 21:14 ` oreo639
  2023-09-22 20:35 ` ahesford
                   ` (34 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-09-21 21:14 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which causes issues with GDM.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

You can see what Fedora does here:
https://gist.github.com/oreo639/3b83b852ce0db21e21eed102a57c5148
(taken from the setup package)

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1559 bytes --]

From ab59a164deaf7feba7f4d07a830da33df5499da1 Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

Correct spelling of LC_IDENTIFICATION.
---
 srcpkgs/base-files/files/locale.sh | 12 ++++++++++--
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf9..c148584f1afaa 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,17 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
 if [ -s /etc/locale.conf ]; then
-	. /etc/locale.conf
+	while read -r line; do
+		line="${line%%#*}"
+		if [ -n "$line" ]; then
+			eval ": \${$line}"
+		fi
+	done < /etc/locale.conf
 fi
 
+# define default LANG to C.UTF-8 if not already defined
+LANG="${LANG:-C.UTF-8}"
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
-export LC_INDENTIFICATION
+export LC_IDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index c3b59c8e6cd28..80b65683d2a34 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.143
-revision=3
+revision=4
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (36 preceding siblings ...)
  2023-09-21 21:14 ` oreo639
@ 2023-09-22 20:35 ` ahesford
  2023-12-22  1:46 ` github-actions
                   ` (33 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: ahesford @ 2023-09-22 20:35 UTC (permalink / raw)
  To: ml

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

New comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1732005475

Comment:
I don't think we should be worrying about this. The stuff in `/etc/profile` and `/etc/profile.d` is supposed to be read for *login* shells, which means that the shell is expected to stand up the environment from scratch. It isn't really a bug that login shells overwrite whatever locale information already exists in the environment.

Hacking around the fact that GDM expects its forcing of these variables to be respected seems best resolved by looking to `GDM_LANG` in some gdm-specific profile.d snippet that runs *after* the default locale is configured.

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (37 preceding siblings ...)
  2023-09-22 20:35 ` ahesford
@ 2023-12-22  1:46 ` github-actions
  2023-12-22  2:14 ` oreo639
                   ` (32 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: github-actions @ 2023-12-22  1:46 UTC (permalink / raw)
  To: ml

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

New comment by github-actions[bot] on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1867127964

Comment:
Pull Requests become stale 90 days after last activity and are closed 14 days after that.  If this pull request is still relevant bump it or assign it.

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (38 preceding siblings ...)
  2023-12-22  1:46 ` github-actions
@ 2023-12-22  2:14 ` oreo639
  2023-12-22  2:52 ` ahesford
                   ` (31 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-12-22  2:14 UTC (permalink / raw)
  To: ml

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

New comment by oreo639 on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1867145489

Comment:
bump

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (39 preceding siblings ...)
  2023-12-22  2:14 ` oreo639
@ 2023-12-22  2:52 ` ahesford
  2023-12-22  3:02 ` oreo639
                   ` (30 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: ahesford @ 2023-12-22  2:52 UTC (permalink / raw)
  To: ml

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

New comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1867166947

Comment:
The parsing of `locale.conf` seem to be holdovers from aborted attempts to save and restore variables. Reading the lines, trying to strip out comments and then running the lines through `eval` doesn't really do anything different than sourcing the file, except inject some incomplete and cumbersome parsing logic here.

The `locale.conf` parsing should just be restored to simply sourcing the file, leavening only the default LANG and typo fix.

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (40 preceding siblings ...)
  2023-12-22  2:52 ` ahesford
@ 2023-12-22  3:02 ` oreo639
  2023-12-22  3:04 ` oreo639
                   ` (29 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-12-22  3:02 UTC (permalink / raw)
  To: ml

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

New comment by oreo639 on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1867175158

Comment:
> Reading the lines, trying to strip out comments and then running the lines through eval doesn't really do anything different than sourcing the file, except inject some incomplete and cumbersome parsing logic here.

It prevents locale.sh from overwriting e.g. LANG if it was already defined and uses locale.conf as the default values if they are not defined.


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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (41 preceding siblings ...)
  2023-12-22  3:02 ` oreo639
@ 2023-12-22  3:04 ` oreo639
  2023-12-22 11:33 ` ahesford
                   ` (28 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-12-22  3:04 UTC (permalink / raw)
  To: ml

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

New comment by oreo639 on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1867175158

Comment:
> Reading the lines, trying to strip out comments and then running the lines through eval doesn't really do anything different than sourcing the file, except inject some incomplete and cumbersome parsing logic here.

It prevents locale.sh from overwriting e.g. LANG if it was already defined and uses locale.conf as the default values if they are not defined.

e.g. `: ${LANG=en_US.UTF-8}`

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (42 preceding siblings ...)
  2023-12-22  3:04 ` oreo639
@ 2023-12-22 11:33 ` ahesford
  2023-12-22 11:33 ` ahesford
                   ` (27 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: ahesford @ 2023-12-22 11:33 UTC (permalink / raw)
  To: ml

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

New comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1867580017

Comment:
Thanks; I wasn't reasoning through the assignment properly.

There are still problems sanitizing input. For example, if somebody has a file like

```sh
LANG=en_US.UTF-8 # English
```

it will contain a trailing space after the change but is currently properly parsed. I don't know whether any of the consumers of locale variables would be harmed by the addition of spurious whitespace, but I'd be surprised if this *didn't* introduce problems.

I have not find any documentation on `locale.conf` besides systemd manual pages. As I said before (apparently elsewhere; I thought I commented here earlier), we should not feel compelled to abide by the restrictions imposed by systemd against using other shell features in the configuration. Because we offer no manual page on the file, the code is the documentation; the code documents that the file is simply sourced. (The limitation in systemd, I assume, is that it parses the file directly. We don't parse the file anywhere but in shell profiles.) Users may currently be exploiting that to add extra logic to the locale configuration.

What Red Hat does to interpret the file is an ugly kludge that we should avoid. If anything, I think the Arch way is preferable; just let a pre-set LANG gate the sourcing of the file and, if some users really care about more complex preservation of the whole gamut of variables, they can implement a custom `post-locale.sh` to do so. However, I again question the need for this. Given we have established precedent that `locale.conf` is just sourced by a shell, users should feel free to do things like

```sh
: ${LANG=my-lang}
```

if they need to preserve a pre-set value.

Whatever the final form looks like, we should include a manual page or at least fully define on the docs web site what we accept as a valid configuration.



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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (43 preceding siblings ...)
  2023-12-22 11:33 ` ahesford
@ 2023-12-22 11:33 ` ahesford
  2023-12-23  8:14 ` oreo639
                   ` (26 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: ahesford @ 2023-12-22 11:33 UTC (permalink / raw)
  To: ml

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

New comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1867580017

Comment:
Thanks; I wasn't reasoning through the assignment properly.

There are still problems sanitizing input. For example, if somebody has a file like

```sh
LANG=en_US.UTF-8 # English
```

it will contain a trailing space after the change but is currently properly parsed. I don't know whether any of the consumers of locale variables would be harmed by the addition of spurious whitespace, but I'd be surprised if this *didn't* introduce problems.

I have not found any documentation on `locale.conf` besides systemd manual pages. As I said before (apparently elsewhere; I thought I commented here earlier), we should not feel compelled to abide by the restrictions imposed by systemd against using other shell features in the configuration. Because we offer no manual page on the file, the code is the documentation; the code documents that the file is simply sourced. (The limitation in systemd, I assume, is that it parses the file directly. We don't parse the file anywhere but in shell profiles.) Users may currently be exploiting that to add extra logic to the locale configuration.

What Red Hat does to interpret the file is an ugly kludge that we should avoid. If anything, I think the Arch way is preferable; just let a pre-set LANG gate the sourcing of the file and, if some users really care about more complex preservation of the whole gamut of variables, they can implement a custom `post-locale.sh` to do so. However, I again question the need for this. Given we have established precedent that `locale.conf` is just sourced by a shell, users should feel free to do things like

```sh
: ${LANG=my-lang}
```

if they need to preserve a pre-set value.

Whatever the final form looks like, we should include a manual page or at least fully define on the docs web site what we accept as a valid configuration.



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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (44 preceding siblings ...)
  2023-12-22 11:33 ` ahesford
@ 2023-12-23  8:14 ` oreo639
  2023-12-23  8:21 ` oreo639
                   ` (25 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-12-23  8:14 UTC (permalink / raw)
  To: ml

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

New comment by oreo639 on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1868238585

Comment:
> There are still problems sanitizing input. For example, if somebody has a file like

Thank you for pointing that out.

> I have not found any documentation on `locale.conf` besides systemd manual pages.

`locale.conf` originates from systemd, before that distributions had their own locale configuration files, e.g. `/etc/sysconfig/i18n` on RHEL or `/etc/default/locale` on debian.

> I think the Arch way is preferable; just let a pre-set LANG gate the sourcing of the file

That was the original way I implemented this PR and people didn't like it.

> Given we have established precedent that `locale.conf` is just sourced by a shell, users should feel free to do things like

Personally, I would prefer for that to continue to work as it did before to not break things for people, although I don't think it should be promoted or listed as supported.

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (45 preceding siblings ...)
  2023-12-23  8:14 ` oreo639
@ 2023-12-23  8:21 ` oreo639
  2023-12-23  8:21 ` oreo639
                   ` (24 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-12-23  8:21 UTC (permalink / raw)
  To: ml

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

New comment by oreo639 on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1868238585

Comment:
> There are still problems sanitizing input. For example, if somebody has a file like

Thank you for pointing that out.

> I have not found any documentation on `locale.conf` besides systemd manual pages.

`locale.conf` originates from systemd, before that distributions had their own locale configuration files, e.g. `/etc/sysconfig/i18n` on RHEL or `/etc/default/locale` on debian. Arch Linux used to recommend just setting LANG in your `.bashrc` (or `/etc/rc.conf` for systemwide).

> I think the Arch way is preferable; just let a pre-set LANG gate the sourcing of the file

That was the original way I implemented this PR and people didn't like it.

> Given we have established precedent that `locale.conf` is just sourced by a shell, users should feel free to do things like

Personally, I would prefer for that to continue to work as it did before to not break things for people, although I don't think it should be promoted or listed as supported.

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (46 preceding siblings ...)
  2023-12-23  8:21 ` oreo639
@ 2023-12-23  8:21 ` oreo639
  2024-03-01  2:36 ` [PR PATCH] [Updated] " oreo639
                   ` (23 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2023-12-23  8:21 UTC (permalink / raw)
  To: ml

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

New comment by oreo639 on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1868238585

Comment:
> There are still problems sanitizing input. For example, if somebody has a file like

Thank you for pointing that out.

> I have not found any documentation on `locale.conf` besides systemd manual pages.

`locale.conf` originates from systemd, before that distributions had their own locale configuration files, e.g. `/etc/sysconfig/i18n` on RHEL or `/etc/default/locale` on debian. Arch Linux used to recommend just setting LANG in your `.bashrc` (or `/etc/rc.conf` for system wide).

> I think the Arch way is preferable; just let a pre-set LANG gate the sourcing of the file

That was the original way I implemented this PR and people didn't like it.

> Given we have established precedent that `locale.conf` is just sourced by a shell, users should feel free to do things like

Personally, I would prefer for that to continue to work as it did before to not break things for people, although I don't think it should be promoted or listed as supported.

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (47 preceding siblings ...)
  2023-12-23  8:21 ` oreo639
@ 2024-03-01  2:36 ` oreo639
  2024-03-01  2:41 ` oreo639
                   ` (22 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2024-03-01  2:36 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which causes issues with GDM.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

You can see what Fedora does here:
https://gist.github.com/oreo639/3b83b852ce0db21e21eed102a57c5148
(taken from the setup package)

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1629 bytes --]

From 1d2392f34e9e21a1b5bd04385e84bb48f9ea619b Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

Correct spelling of LC_IDENTIFICATION.
---
 srcpkgs/base-files/files/locale.sh | 14 ++++++++++++--
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf90..f7e48289972717 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,19 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
 if [ -s /etc/locale.conf ]; then
-	. /etc/locale.conf
+	while read -r line; do
+		line="${line%%#*}"
+		if expr "$line" : '^[[:space:]]*[A-Z_]\+=.*' > /dev/null; then
+			eval ": \${$line}"
+		else
+			eval "$line"
+		fi
+	done < /etc/locale.conf
 fi
 
+# define default LANG to C.UTF-8 if not already defined
+LANG="${LANG:-C.UTF-8}"
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
-export LC_INDENTIFICATION
+export LC_IDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index 64e756be34dee2..1877a88e14324e 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.144
-revision=1
+revision=2
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (48 preceding siblings ...)
  2024-03-01  2:36 ` [PR PATCH] [Updated] " oreo639
@ 2024-03-01  2:41 ` oreo639
  2024-03-01  2:41 ` oreo639
                   ` (21 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2024-03-01  2:41 UTC (permalink / raw)
  To: ml

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

New comment by oreo639 on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1972363031

Comment:
Alright, I made it so that it will check for a plain assignment before doing the `eval ": \${$line}"`, and otherwise it will fall back to a regular eval (and not barfing on non-plain assignments).

This also means you can force locale.conf to override e.g. LANG by doing, for example, `: LANG=en_US.UTF-8`

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (49 preceding siblings ...)
  2024-03-01  2:41 ` oreo639
@ 2024-03-01  2:41 ` oreo639
  2024-03-01  2:42 ` oreo639
                   ` (20 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2024-03-01  2:41 UTC (permalink / raw)
  To: ml

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

New comment by oreo639 on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1972363031

Comment:
Alright, I made it so that it will check for a plain assignment before doing the `eval ": \${$line}"`, and otherwise it will fall back to a regular eval (and not barfing on non-plain assignments).

This also means you can force locale.sh to override e.g. LANG by doing, for example, `: LANG=en_US.UTF-8`

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (50 preceding siblings ...)
  2024-03-01  2:41 ` oreo639
@ 2024-03-01  2:42 ` oreo639
  2024-03-01  2:50 ` oreo639
                   ` (19 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2024-03-01  2:42 UTC (permalink / raw)
  To: ml

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

New comment by oreo639 on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1972363031

Comment:
Alright, I made it so that it will check for a plain assignment before doing the `eval ": \${$line}"`, and otherwise it will fall back to a regular eval (and not barfing on non-plain assignments).

This also means you can force locale.sh to override e.g. LANG by doing, for example, `: LANG=en_US.UTF-8`

(I tested and it seems to work fine with both bash and dash)

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (51 preceding siblings ...)
  2024-03-01  2:42 ` oreo639
@ 2024-03-01  2:50 ` oreo639
  2024-03-01  2:54 ` oreo639
                   ` (18 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2024-03-01  2:50 UTC (permalink / raw)
  To: ml

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

New comment by oreo639 on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1972363031

Comment:
Alright, I made it so that it will check for a plain assignment before doing the `eval ": \${$line}"`, and otherwise it will fall back to a regular eval (and not barf on shell stuff).

This also means you can force locale.sh to override e.g. LANG by doing, for example, `: LANG=en_US.UTF-8`

(I tested and it seems to work fine with both bash and dash)

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (52 preceding siblings ...)
  2024-03-01  2:50 ` oreo639
@ 2024-03-01  2:54 ` oreo639
  2024-03-01  3:09 ` [PR PATCH] [Updated] " oreo639
                   ` (17 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2024-03-01  2:54 UTC (permalink / raw)
  To: ml

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

New comment by oreo639 on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1972363031

Comment:
Alright, I made it so that it will check for a plain assignment before doing the `eval ": \${$line}"`, and otherwise it will fall back to a regular eval (and not barf on shell stuff).

This also means you can force locale.sh to override e.g. LANG by doing, for example, `: LANG=en_US.UTF-8`

(I tested and it seems to work fine with both bash and dash)

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (53 preceding siblings ...)
  2024-03-01  2:54 ` oreo639
@ 2024-03-01  3:09 ` oreo639
  2024-03-01  4:01 ` oreo639
                   ` (16 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2024-03-01  3:09 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which causes issues with GDM.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

You can see what Fedora does here:
https://gist.github.com/oreo639/3b83b852ce0db21e21eed102a57c5148
(taken from the setup package)

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1661 bytes --]

From ae2290e8354943c3b85c9d961facbcb2ca822ced Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

Correct spelling of LC_IDENTIFICATION.
---
 srcpkgs/base-files/files/locale.sh | 17 +++++++++++++++--
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf90..92a8006a4e68c6 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,22 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
 if [ -s /etc/locale.conf ]; then
-	. /etc/locale.conf
+	lines=""
+	while read -r line; do
+		line="${line%%#*}"
+		if expr "$line" : '^[[:space:]]*[A-Z_]\+=.*' > /dev/null; then
+			lines="$lines: \${$line}
+"
+		else
+			lines="$lines$line
+"
+		fi
+	done < /etc/locale.conf
 fi
 
+# define default LANG to C.UTF-8 if not already defined
+LANG="${LANG:-C.UTF-8}"
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
-export LC_INDENTIFICATION
+export LC_IDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index 64e756be34dee2..1877a88e14324e 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.144
-revision=1
+revision=2
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (54 preceding siblings ...)
  2024-03-01  3:09 ` [PR PATCH] [Updated] " oreo639
@ 2024-03-01  4:01 ` oreo639
  2024-03-01  5:26 ` oreo639
                   ` (15 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2024-03-01  4:01 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which causes issues with GDM.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

You can see what Fedora does here:
https://gist.github.com/oreo639/3b83b852ce0db21e21eed102a57c5148
(taken from the setup package)

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1694 bytes --]

From 1c6993bca93f0118d7c29bab2299a389d48a4fff Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

Correct spelling of LC_IDENTIFICATION.
---
 srcpkgs/base-files/files/locale.sh | 18 ++++++++++++++++--
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf90..cab05e52e2f367 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,23 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
 if [ -s /etc/locale.conf ]; then
-	. /etc/locale.conf
+	lines=""
+	while read -r line; do
+		line="${line%%#*}"
+		if expr "$line" : '^[[:space:]]*[A-Z_]\+=.*' > /dev/null; then
+			lines="$lines: \${$line}"
+		else
+			lines="$lines$line"
+		fi
+		lines="$lines
+"
+	done < /etc/locale.conf
+	eval "$lines"
 fi
 
+# define default LANG to C.UTF-8 if not already defined
+LANG="${LANG:-C.UTF-8}"
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
-export LC_INDENTIFICATION
+export LC_IDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index 64e756be34dee2..1877a88e14324e 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.144
-revision=1
+revision=2
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (55 preceding siblings ...)
  2024-03-01  4:01 ` oreo639
@ 2024-03-01  5:26 ` oreo639
  2024-03-01  8:14 ` oreo639
                   ` (14 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2024-03-01  5:26 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which causes issues with GDM.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

You can see what Fedora does here:
https://gist.github.com/oreo639/3b83b852ce0db21e21eed102a57c5148
(taken from the setup package)

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1755 bytes --]

From 5351aa0fc7de5e38c53d236561c9202d5c61e013 Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

Correct spelling of LC_IDENTIFICATION.
---
 srcpkgs/base-files/files/locale.sh | 19 +++++++++++++++++--
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf90..9599432113e020 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,24 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
 if [ -s /etc/locale.conf ]; then
-	. /etc/locale.conf
+	lc_lines=""
+	while read -r line || [ "$line" ]; do
+		line="${line%%#*}"
+		if expr "$line" : '^[[:space:]]*[A-Z_]\+=.*' > /dev/null; then
+			lc_lines="$lc_lines: \${$line}"
+		else
+			lc_lines="$lc_lines$line"
+		fi
+		lc_lines="$lc_lines
+"
+	done < /etc/locale.conf
+	eval "$lc_lines"
 fi
+unset lc_lines line
+
+# define default LANG to C.UTF-8 if not already defined
+LANG="${LANG:-C.UTF-8}"
 
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
-export LC_INDENTIFICATION
+export LC_IDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index 64e756be34dee2..1877a88e14324e 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.144
-revision=1
+revision=2
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (56 preceding siblings ...)
  2024-03-01  5:26 ` oreo639
@ 2024-03-01  8:14 ` oreo639
  2024-03-01 11:26 ` ahesford
                   ` (13 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2024-03-01  8:14 UTC (permalink / raw)
  To: ml

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

New comment by oreo639 on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1972715987

Comment:
I updated this to only replace plain declarations (e.g. `VAR=x`, but not `: VAR=x`, `export VAR=x`, etc)
This allows everything else to work as it did before (e.g. if statements) and you can force overriding with `: LANG=en_US.UTF-8`

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (57 preceding siblings ...)
  2024-03-01  8:14 ` oreo639
@ 2024-03-01 11:26 ` ahesford
  2024-03-01 22:31 ` [PR PATCH] [Updated] " oreo639
                   ` (12 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: ahesford @ 2024-03-01 11:26 UTC (permalink / raw)
  To: ml

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

New comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1973016786

Comment:
I think this is getting far too complicated for the simple intent of preserving variables that have already been set. I had to read that loop several times to figure out what it was doing even knowing your intent.

It's also fragile. You're effectively just sourcing the file after wrapping all simple variable assignments in `: ${VAR=value}` to preserve variables already set by the environment while trying to honor existing workflows that might try to inject more complicated behavior into `locale.conf`, but there's no way to guarantee that these kinds of modifications to what's executed during the `eval` won't have all sorts of unintended consequences.

I think there are four reasonable ways to solve your problem (with varying degrees of reasonability):
1. Leave the behavior as is and let users guard variables they might not want to overwrite, knowing that `locale.conf` is executed by the shell.
2. Gate the sourcing like in Arch, which you said people don't like. But do those people who objected really prefer writing trying to implement an even more complex shell parser in the shell itself?
3. Make backup copies of all relevant variables, just source the file as we already do, and restore the backup copies if they were nonempty before the source. I think you did this, in a couple of different ways, in an earlier proposal.
4. Properly validate that `locale.conf` contains nothing more than comments or simple `VAR=value` assignments. Reject it entirely if it does not conform, otherwise parse accordingly.

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (58 preceding siblings ...)
  2024-03-01 11:26 ` ahesford
@ 2024-03-01 22:31 ` oreo639
  2024-03-01 22:31 ` oreo639
                   ` (11 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2024-03-01 22:31 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which causes issues with GDM.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

You can see what Fedora does here:
https://gist.github.com/oreo639/3b83b852ce0db21e21eed102a57c5148
(taken from the setup package)

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1775 bytes --]

From 424cf9f731fba36201d519201561351a34740f75 Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

Correct spelling of LC_IDENTIFICATION.
---
 srcpkgs/base-files/files/locale.sh | 21 +++++++++++++++++++--
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf90..01bd54a8257001 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,26 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
+_parse_lc_conf() {
+	lineno=
+	while read -r line || [ "$line" ]; do
+		line="${line%%#*}"
+		lineno="$(($lineno+1))"
+		if ! expr "$line" : '^[A-Z_]\+=.*' > /dev/null; then
+			echo "$1: invalid assignment on line $lineno"
+		else
+			eval ": \${$line}"
+		fi
+	done < "$1"
+	unset lineno line
+}
+
 if [ -s /etc/locale.conf ]; then
-	. /etc/locale.conf
+	_parse_lc_conf ./locale.conf
 fi
 
+# define default LANG to C.UTF-8 if not already defined
+LANG="${LANG:-C.UTF-8}"
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
-export LC_INDENTIFICATION
+export LC_IDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index 64e756be34dee2..1877a88e14324e 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.144
-revision=1
+revision=2
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (59 preceding siblings ...)
  2024-03-01 22:31 ` [PR PATCH] [Updated] " oreo639
@ 2024-03-01 22:31 ` oreo639
  2024-03-01 22:33 ` oreo639
                   ` (10 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2024-03-01 22:31 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which causes issues with GDM.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

You can see what Fedora does here:
https://gist.github.com/oreo639/3b83b852ce0db21e21eed102a57c5148
(taken from the setup package)

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1778 bytes --]

From 7c2ab0582c2a34fe0e32480cbfab22543b9de39d Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

Correct spelling of LC_IDENTIFICATION.
---
 srcpkgs/base-files/files/locale.sh | 21 +++++++++++++++++++--
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf90..0f89991d7c573e 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,26 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
+_parse_lc_conf() {
+	lineno=
+	while read -r line || [ "$line" ]; do
+		line="${line%%#*}"
+		lineno="$(($lineno+1))"
+		if ! expr "$line" : '^[A-Z_]\+=.*' > /dev/null; then
+			echo "$1: invalid assignment on line $lineno"
+		else
+			eval ": \${$line}"
+		fi
+	done < "$1"
+	unset lineno line
+}
+
 if [ -s /etc/locale.conf ]; then
-	. /etc/locale.conf
+	_parse_lc_conf /etc/locale.conf
 fi
 
+# define default LANG to C.UTF-8 if not already defined
+LANG="${LANG:-C.UTF-8}"
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
-export LC_INDENTIFICATION
+export LC_IDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index 64e756be34dee2..1877a88e14324e 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.144
-revision=1
+revision=2
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (60 preceding siblings ...)
  2024-03-01 22:31 ` oreo639
@ 2024-03-01 22:33 ` oreo639
  2024-03-01 22:54 ` [PR PATCH] [Updated] " oreo639
                   ` (9 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2024-03-01 22:33 UTC (permalink / raw)
  To: ml

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

New comment by oreo639 on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1974023999

Comment:
> 3\. I think you did this, in a couple of different ways, in an earlier proposal.

Here is what I did for that: https://gist.github.com/oreo639/850ddb140df502781f1f54fc1ffaba0c

> 4\. Properly validate that `locale.conf` contains nothing more than comments or simple `VAR=value` assignments. Reject it entirely if it does not conform, otherwise parse accordingly.

I pushed a version using that approach, although it will still accept lines that are valid (instead of rejecting the entire file)

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (61 preceding siblings ...)
  2024-03-01 22:33 ` oreo639
@ 2024-03-01 22:54 ` oreo639
  2024-03-01 22:55 ` oreo639
                   ` (8 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2024-03-01 22:54 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which causes issues with GDM.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

You can see what Fedora does here:
https://gist.github.com/oreo639/3b83b852ce0db21e21eed102a57c5148
(taken from the setup package)

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1854 bytes --]

From 8e43ab4dcd835469b89d62906fa2e08fb03b909a Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

Correct spelling of LC_IDENTIFICATION.
---
 srcpkgs/base-files/files/locale.sh | 21 +++++++++++++++++++--
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf90..dcf9a4e4beb7ad 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,26 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
+_parse_lc_conf() {
+	lineno=
+	while read -r line || [ "$line" ]; do
+		lc=$(expr "${line%%#*}" : '^\([[:upper:]_]\+=\([[:print:][:digit:]\._-]\+\|"[[:upper:][:digit:]\._-]"\)\)')
+		lineno="$(($lineno+1))"
+		if [ "$lc" ]; then
+			eval ": \${$line}"
+		elif [ "$line" ]; then
+			echo "$1: invalid assignment on line $lineno"
+		fi
+	done < "$1"
+	unset lineno line lc
+}
+
 if [ -s /etc/locale.conf ]; then
-	. /etc/locale.conf
+	_parse_lc_conf /etc/locale.conf
 fi
 
+# define default LANG to C.UTF-8 if not already defined
+LANG="${LANG:-C.UTF-8}"
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
-export LC_INDENTIFICATION
+export LC_IDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index 64e756be34dee2..1877a88e14324e 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.144
-revision=1
+revision=2
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (62 preceding siblings ...)
  2024-03-01 22:54 ` [PR PATCH] [Updated] " oreo639
@ 2024-03-01 22:55 ` oreo639
  2024-03-01 22:57 ` oreo639
                   ` (7 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2024-03-01 22:55 UTC (permalink / raw)
  To: ml

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

New comment by oreo639 on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1974023999

Comment:
> 3\. I think you did this, in a couple of different ways, in an earlier proposal.

Here is what I did for that: https://gist.github.com/oreo639/850ddb140df502781f1f54fc1ffaba0c

> 4\. Properly validate that `locale.conf` contains nothing more than comments or simple `VAR=value` assignments. Reject it entirely if it does not conform, otherwise parse accordingly.

I pushed a version using that approach, although it will still accept lines that are valid (instead of rejecting the entire file)
In this case, it is using the regex from Fedora to check for a valid assignment.

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (63 preceding siblings ...)
  2024-03-01 22:55 ` oreo639
@ 2024-03-01 22:57 ` oreo639
  2024-03-01 23:11 ` [PR PATCH] [Updated] " oreo639
                   ` (6 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2024-03-01 22:57 UTC (permalink / raw)
  To: ml

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

New comment by oreo639 on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1974023999

Comment:
> 3\. I think you did this, in a couple of different ways, in an earlier proposal.

Here is what I did for that: https://gist.github.com/oreo639/850ddb140df502781f1f54fc1ffaba0c

> 4\. Properly validate that `locale.conf` contains nothing more than comments or simple `VAR=value` assignments. Reject it entirely if it does not conform, otherwise parse accordingly.

I pushed a version using that approach, although it will still accept lines that are valid (instead of rejecting the entire file)
I also updated it to use the regex from Fedora to check for a valid assignment.

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (64 preceding siblings ...)
  2024-03-01 22:57 ` oreo639
@ 2024-03-01 23:11 ` oreo639
  2024-03-01 23:13 ` oreo639
                   ` (5 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2024-03-01 23:11 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which causes issues with GDM.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

You can see what Fedora does here:
https://gist.github.com/oreo639/3b83b852ce0db21e21eed102a57c5148
(taken from the setup package)

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1881 bytes --]

From 3127bc7e84359aaa4548bf37707b7df245ebef44 Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

Correct spelling of LC_IDENTIFICATION.
---
 srcpkgs/base-files/files/locale.sh | 22 ++++++++++++++++++++--
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf90..d1ab0a4cd08e20 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,27 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
+_parse_lc_conf() {
+	lineno=
+	while read -r line || [ "$line" ]; do
+		line="${line%%#*}"
+		lc=$(expr "$line" : '^\([[:upper:]_]\+=\([[:alnum:][:digit:]\._-]\+\|"[[:upper:][:digit:]\._-]"\)\)')
+		lineno="$(($lineno+1))"
+		if [ "$line" = "$lc" ]; then
+			eval ": \${$line}"
+		elif [ "$line" ]; then
+			echo "$1: invalid assignment on line $lineno"
+		fi
+	done < "$1"
+	unset lineno line lc
+}
+
 if [ -s /etc/locale.conf ]; then
-	. /etc/locale.conf
+	_parse_lc_conf /etc/locale.conf
 fi
 
+# define default LANG to C.UTF-8 if not already defined
+LANG="${LANG:-C.UTF-8}"
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
-export LC_INDENTIFICATION
+export LC_IDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index 64e756be34dee2..1877a88e14324e 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.144
-revision=1
+revision=2
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (65 preceding siblings ...)
  2024-03-01 23:11 ` [PR PATCH] [Updated] " oreo639
@ 2024-03-01 23:13 ` oreo639
  2024-03-02  0:06 ` oreo639
                   ` (4 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2024-03-01 23:13 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which causes issues with GDM.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

You can see what Fedora does here:
https://gist.github.com/oreo639/3b83b852ce0db21e21eed102a57c5148
(taken from the setup package)

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1881 bytes --]

From 04104c319c94f6e92256fba47d4fcf42152f0ed2 Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

Correct spelling of LC_IDENTIFICATION.
---
 srcpkgs/base-files/files/locale.sh | 22 ++++++++++++++++++++--
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf90..c027b4549f22be 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,27 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
+_parse_lc_conf() {
+	lineno=
+	while read -r line || [ "$line" ]; do
+		line="${line%%#*}"
+		lc=$(expr "$line" : '^\([[:upper:]_]\+=\([[:alnum:][:digit:]\._-]\+\|"[[:print:][:digit:]\._-]"\)\)')
+		lineno="$(($lineno+1))"
+		if [ "$line" = "$lc" ]; then
+			eval ": \${$line}"
+		elif [ "$line" ]; then
+			echo "$1: invalid assignment on line $lineno"
+		fi
+	done < "$1"
+	unset lineno line lc
+}
+
 if [ -s /etc/locale.conf ]; then
-	. /etc/locale.conf
+	_parse_lc_conf /etc/locale.conf
 fi
 
+# define default LANG to C.UTF-8 if not already defined
+LANG="${LANG:-C.UTF-8}"
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
-export LC_INDENTIFICATION
+export LC_IDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index 64e756be34dee2..1877a88e14324e 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.144
-revision=1
+revision=2
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (66 preceding siblings ...)
  2024-03-01 23:13 ` oreo639
@ 2024-03-02  0:06 ` oreo639
  2024-03-02  0:12 ` oreo639
                   ` (3 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2024-03-02  0:06 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which causes issues with GDM.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

You can see what Fedora does here:
https://gist.github.com/oreo639/3b83b852ce0db21e21eed102a57c5148
(taken from the setup package)

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1888 bytes --]

From b30ffc710e502ec6dbf28b6712e0212e64c20b7c Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

Correct spelling of LC_IDENTIFICATION.
---
 srcpkgs/base-files/files/locale.sh | 22 ++++++++++++++++++++--
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf90..9c39b6877b5b19 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,27 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
+_parse_lc_conf() {
+	lineno=
+	while read -r line || [ "$line" ]; do
+		line="${line%%#*}"
+		lc=$(expr "$line" : '^\([[:upper:]_]\+=\([[:alnum:][:digit:]\._-]\+\|"[[:print:][:digit:]\._-]"\)\)')
+		lineno="$(($lineno+1))"
+		if [ "$lc" ] && [ "$line" = "$lc" ]; then
+			eval ": \${$lc}"
+		elif [ "$line" ]; then
+			echo "$1: invalid assignment on line $lineno"
+		fi
+	done < "$1"
+	unset lineno line lc
+}
+
 if [ -s /etc/locale.conf ]; then
-	. /etc/locale.conf
+	_parse_lc_conf /etc/locale.conf
 fi
 
+# define default LANG to C.UTF-8 if not already set
+LANG="${LANG:-C.UTF-8}"
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
-export LC_INDENTIFICATION
+export LC_IDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index 64e756be34dee2..1877a88e14324e 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.144
-revision=1
+revision=2
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (67 preceding siblings ...)
  2024-03-02  0:06 ` oreo639
@ 2024-03-02  0:12 ` oreo639
  2024-03-02  0:15 ` oreo639
                   ` (2 subsequent siblings)
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2024-03-02  0:12 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which causes issues with GDM.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

You can see what Fedora does here:
https://gist.github.com/oreo639/3b83b852ce0db21e21eed102a57c5148
(taken from the setup package)

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1895 bytes --]

From f77b269bb7cd93d2c19a95cb8f2829665f93fa58 Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

Correct spelling of LC_IDENTIFICATION.
---
 srcpkgs/base-files/files/locale.sh | 24 ++++++++++++++++++++++--
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf90..646c3454416f69 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,29 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
+_parse_lc_conf() {
+	lineno=
+	while read -r line || [ "$line" ]; do
+		line="${line%%#*}"
+		lineno="$(($lineno+1))"
+		if [ "$line" ]; then
+			lc=$(expr "$line" : '^\([[:upper:]_]\+=\([[:alnum:][:digit:]\._-]\+\|"[[:print:][:digit:]\._-]"\)\)')
+			if [ "$line" = "$lc" ]; then
+				eval ": \${$lc}"
+			else
+				echo "$1: invalid assignment on line $lineno"
+			fi
+		fi
+	done < "$1"
+	unset lineno line lc
+}
+
 if [ -s /etc/locale.conf ]; then
-	. /etc/locale.conf
+	_parse_lc_conf /etc/locale.conf
 fi
 
+# define default LANG to C.UTF-8 if not already set
+LANG="${LANG:-C.UTF-8}"
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
-export LC_INDENTIFICATION
+export LC_IDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index 64e756be34dee2..1877a88e14324e 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.144
-revision=1
+revision=2
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (68 preceding siblings ...)
  2024-03-02  0:12 ` oreo639
@ 2024-03-02  0:15 ` oreo639
  2024-03-04 15:31 ` leahneukirchen
  2024-03-04 19:52 ` [PR PATCH] [Updated] " oreo639
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2024-03-02  0:15 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which causes issues with GDM.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

You can see what Fedora does here:
https://gist.github.com/oreo639/3b83b852ce0db21e21eed102a57c5148
(taken from the setup package)

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1888 bytes --]

From f599828fed62ff52c8abe24205503ca2a2def76b Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

Correct spelling of LC_IDENTIFICATION.
---
 srcpkgs/base-files/files/locale.sh | 22 ++++++++++++++++++++--
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf90..59a33ef3e5d01f 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,27 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
+_parse_lc_conf() {
+	lineno=
+	while read -r line || [ "$line" ]; do
+		line="${line%%#*}"
+		lineno="$(($lineno+1))"
+		lc=$(expr "$line" : '^\([[:upper:]_]\+=\([[:alnum:][:digit:]\._-]\+\|"[[:print:][:digit:]\._-]"\)\)')
+		if [ "$lc" ] && [ "$line" = "$lc" ]; then
+			eval ": \${$lc}"
+		elif [ "$line" ]; then
+			echo "$1: invalid assignment on line $lineno"
+		fi
+	done < "$1"
+	unset lineno line lc
+}
+
 if [ -s /etc/locale.conf ]; then
-	. /etc/locale.conf
+	_parse_lc_conf /etc/locale.conf
 fi
 
+# define default LANG to C.UTF-8 if not already set
+LANG="${LANG:-C.UTF-8}"
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
-export LC_INDENTIFICATION
+export LC_IDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index 64e756be34dee2..1877a88e14324e 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.144
-revision=1
+revision=2
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

* Re: base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (69 preceding siblings ...)
  2024-03-02  0:15 ` oreo639
@ 2024-03-04 15:31 ` leahneukirchen
  2024-03-04 19:52 ` [PR PATCH] [Updated] " oreo639
  71 siblings, 0 replies; 73+ messages in thread
From: leahneukirchen @ 2024-03-04 15:31 UTC (permalink / raw)
  To: ml

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

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/39264#issuecomment-1976851756

Comment:
error messages should go to stderr

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

* Re: [PR PATCH] [Updated] base-files: don't overwrite existing locale and define default LANG
  2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
                   ` (70 preceding siblings ...)
  2024-03-04 15:31 ` leahneukirchen
@ 2024-03-04 19:52 ` oreo639
  71 siblings, 0 replies; 73+ messages in thread
From: oreo639 @ 2024-03-04 19:52 UTC (permalink / raw)
  To: ml

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

There is an updated pull request by oreo639 against master on the void-packages repository

https://github.com/oreo639/void-packages files
https://github.com/void-linux/void-packages/pull/39264

base-files: don't overwrite existing locale and define default LANG
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

Fixes overwriting user/desktop specified locale.

Currently we always overwrite LANG on login, even if it was already set by the desktop or user which causes issues with GDM.

You can see what Arch does here:
https://bugs.archlinux.org/task/42162
https://github.com/archlinux/svntogit-packages/blob/master/filesystem/trunk/locale.sh

You can see what Fedora does here:
https://gist.github.com/oreo639/3b83b852ce0db21e21eed102a57c5148
(taken from the setup package)

Closes: https://github.com/void-linux/void-packages/issues/15292

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/39264.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-files-39264.patch --]
[-- Type: text/x-diff, Size: 1892 bytes --]

From b9c9cfee1a0e7059c692dab8764e96859058efb2 Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Tue, 13 Sep 2022 10:22:19 -0700
Subject: [PATCH] base-files: don't overwrite existing locale and define
 default LANG

Correct spelling of LC_IDENTIFICATION.
---
 srcpkgs/base-files/files/locale.sh | 22 ++++++++++++++++++++--
 srcpkgs/base-files/template        |  2 +-
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/base-files/files/locale.sh b/srcpkgs/base-files/files/locale.sh
index 8486367bfabf90..7bc33c2eda8efb 100644
--- a/srcpkgs/base-files/files/locale.sh
+++ b/srcpkgs/base-files/files/locale.sh
@@ -1,9 +1,27 @@
 # Sets up locale system settings from /etc/locale.conf.
 #
+_parse_lc_conf() {
+	lineno=
+	while read -r line || [ "$line" ]; do
+		line="${line%%#*}"
+		lineno="$(($lineno+1))"
+		lc=$(expr "$line" : '^\([[:upper:]_]\+=\([[:alnum:][:digit:]\._-]\+\|"[[:print:][:digit:]\._-]"\)\)')
+		if [ "$lc" ] && [ "$line" = "$lc" ]; then
+			eval ": \${$lc}"
+		elif [ "$line" ]; then
+			echo "$1: invalid assignment on line $lineno" >&2
+		fi
+	done < "$1"
+	unset lineno line lc
+}
+
 if [ -s /etc/locale.conf ]; then
-	. /etc/locale.conf
+	_parse_lc_conf /etc/locale.conf
 fi
 
+# define default LANG to C.UTF-8 if not already set
+LANG="${LANG:-C.UTF-8}"
+
 export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
 export LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
-export LC_INDENTIFICATION
+export LC_IDENTIFICATION
diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template
index 64e756be34dee2..1877a88e14324e 100644
--- a/srcpkgs/base-files/template
+++ b/srcpkgs/base-files/template
@@ -1,7 +1,7 @@
 # Template file for 'base-files'
 pkgname=base-files
 version=0.144
-revision=1
+revision=2
 bootstrap=yes
 depends="xbps-triggers"
 short_desc="Void Linux base system files"

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

end of thread, other threads:[~2024-03-04 19:52 UTC | newest]

Thread overview: 73+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-13 18:23 [PR PATCH] base-files: don't overwrite existing locale and define default LANG oreo639
2022-09-13 18:25 ` [PR PATCH] [Updated] " oreo639
2022-09-26  6:36 ` oreo639
2022-09-26  6:36 ` oreo639
2022-09-26  6:37 ` oreo639
2022-12-26  1:57 ` github-actions
2022-12-26  2:02 ` oreo639
2022-12-26  2:22 ` [PR PATCH] [Updated] " oreo639
2023-01-02 15:29 ` leahneukirchen
2023-01-02 19:53 ` oreo639
2023-01-02 19:54 ` oreo639
2023-01-02 20:23 ` oreo639
2023-01-03  5:45 ` oreo639
2023-01-03  5:45 ` oreo639
2023-01-03  5:45 ` oreo639
2023-04-03  2:41 ` [PR PATCH] [Updated] " oreo639
2023-06-20  3:00 ` oreo639
2023-06-20  3:14 ` [PR REVIEW] " classabbyamp
2023-06-20  3:18 ` [PR PATCH] [Updated] " oreo639
2023-06-20  3:43 ` oreo639
2023-06-20  4:29 ` oreo639
2023-06-20 21:08 ` oreo639
2023-06-20 21:21 ` oreo639
2023-06-21 10:37 ` oreo639
2023-06-21 11:08 ` oreo639
2023-06-21 11:10 ` oreo639
2023-06-21 11:14 ` oreo639
2023-06-21 11:47 ` oreo639
2023-09-20  1:45 ` github-actions
2023-09-20  5:06 ` oreo639
2023-09-21 16:05 ` leahneukirchen
2023-09-21 19:09 ` oreo639
2023-09-21 20:37 ` oreo639
2023-09-21 21:03 ` [PR PATCH] [Updated] " oreo639
2023-09-21 21:06 ` oreo639
2023-09-21 21:10 ` oreo639
2023-09-21 21:11 ` [PR PATCH] [Updated] " oreo639
2023-09-21 21:14 ` oreo639
2023-09-22 20:35 ` ahesford
2023-12-22  1:46 ` github-actions
2023-12-22  2:14 ` oreo639
2023-12-22  2:52 ` ahesford
2023-12-22  3:02 ` oreo639
2023-12-22  3:04 ` oreo639
2023-12-22 11:33 ` ahesford
2023-12-22 11:33 ` ahesford
2023-12-23  8:14 ` oreo639
2023-12-23  8:21 ` oreo639
2023-12-23  8:21 ` oreo639
2024-03-01  2:36 ` [PR PATCH] [Updated] " oreo639
2024-03-01  2:41 ` oreo639
2024-03-01  2:41 ` oreo639
2024-03-01  2:42 ` oreo639
2024-03-01  2:50 ` oreo639
2024-03-01  2:54 ` oreo639
2024-03-01  3:09 ` [PR PATCH] [Updated] " oreo639
2024-03-01  4:01 ` oreo639
2024-03-01  5:26 ` oreo639
2024-03-01  8:14 ` oreo639
2024-03-01 11:26 ` ahesford
2024-03-01 22:31 ` [PR PATCH] [Updated] " oreo639
2024-03-01 22:31 ` oreo639
2024-03-01 22:33 ` oreo639
2024-03-01 22:54 ` [PR PATCH] [Updated] " oreo639
2024-03-01 22:55 ` oreo639
2024-03-01 22:57 ` oreo639
2024-03-01 23:11 ` [PR PATCH] [Updated] " oreo639
2024-03-01 23:13 ` oreo639
2024-03-02  0:06 ` oreo639
2024-03-02  0:12 ` oreo639
2024-03-02  0:15 ` oreo639
2024-03-04 15:31 ` leahneukirchen
2024-03-04 19:52 ` [PR PATCH] [Updated] " oreo639

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).