Skip to content
This repository was archived by the owner on Jan 16, 2024. It is now read-only.

Commit 6c18bfb

Browse files
authored
Merge pull request #261 from ospalax/enforce-lang-c
B #251: Enforce POSIX C locale
2 parents 40efc92 + 8c875a1 commit 6c18bfb

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/usr/sbin/one-contextd

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22

33
# -------------------------------------------------------------------------- #
4-
# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
4+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
55
# #
66
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
77
# not use this file except in compliance with the License. You may obtain #
@@ -18,6 +18,23 @@
1818

1919
set -e
2020

21+
# Save original locale variables and enforce POSIX C locale
22+
#
23+
# We provide the user a way to fallback to the correct locale when a command
24+
# should or must respect system's locale by saving the original values into the
25+
# '_one_orig*' variables...
26+
27+
export _one_orig_LANG="${LANG}"
28+
export _one_orig_LC_ALL="${LC_ALL}"
29+
export _one_orig_LC_COLLATE="${LC_COLLATE}"
30+
export _one_orig_LC_CTYPE="${LC_CTYPE}"
31+
export _one_orig_LC_MESSAGES="${LC_MESSAGES}"
32+
export _one_orig_LC_MONETARY="${LC_MONETARY}"
33+
export _one_orig_LC_NUMERIC="${LC_NUMERIC}"
34+
export _one_orig_LC_TIME="${LC_TIME}"
35+
export LANG=C
36+
export LC_ALL=C
37+
2138
TYPE="${1:-all}" # local, online, network, all
2239
COMMAND="${2}" # force, reconfigure?
2340

0 commit comments

Comments
 (0)