1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

locales: use higher prio LC_ALL variable

For reseting locale environment into significantly less memory
consuming version 'C' - use LC_ALL instead of LANG since it has
higher priority in locale settings.

Otherwise we may observe whole locale-archive which might be
over 100MB on i.e. Fedora systems locked in memory with
some daemons.
This commit is contained in:
Zdenek Kabelac 2013-01-22 11:25:02 +01:00
parent 142c4bf9f0
commit 8bcc1da2f3
5 changed files with 14 additions and 13 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.99 - Version 2.02.99 -
=================================== ===================================
Set locales with LC_ALL instead of lower priority LANG variable.
Fix a crash-inducing race condition in lvmetad. Fix a crash-inducing race condition in lvmetad.
Add log/debug_classes to lvm.conf to control debug log messages. Add log/debug_classes to lvm.conf to control debug log messages.
Synchronize with udev in pvscan --cache and fix dangling udev_sync cookies. Synchronize with udev in pvscan --cache and fix dangling udev_sync cookies.

View File

@ -440,8 +440,8 @@ int main(int argc, char *argv[])
* used by some glibc (on some distributions it takes over 100MB). * used by some glibc (on some distributions it takes over 100MB).
* Daemon currently needs to use mlockall(). * Daemon currently needs to use mlockall().
*/ */
if (setenv("LANG", "C", 1)) if (setenv("LC_ALL", "C", 1))
perror("Cannot set LANG to C"); perror("Cannot set LC_ALL to C");
/* Setting debug options on an existing clvmd */ /* Setting debug options on an existing clvmd */
if (debug_opt && !check_local_clvmd()) { if (debug_opt && !check_local_clvmd()) {

View File

@ -1965,8 +1965,8 @@ int main(int argc, char *argv[])
* used by some glibc (on some distributions it takes over 100MB). * used by some glibc (on some distributions it takes over 100MB).
* Daemon currently needs to use mlockall(). * Daemon currently needs to use mlockall().
*/ */
if (setenv("LANG", "C", 1)) if (setenv("LC_ALL", "C", 1))
perror("Cannot set LANG to C"); perror("Cannot set LC_ALL to C");
if (_restart) if (_restart)
restart(); restart();

View File

@ -456,8 +456,8 @@ void daemon_start(daemon_state s)
* some glibc (on some distributions it takes over 100MB). Some daemons * some glibc (on some distributions it takes over 100MB). Some daemons
* need to use mlockall(). * need to use mlockall().
*/ */
if (setenv("LANG", "C", 1)) if (setenv("LC_ALL", "C", 1))
perror("Cannot set LANG to C"); perror("Cannot set LC_ALL to C");
#ifdef linux #ifdef linux
_systemd_activation = _systemd_handover(&s); _systemd_activation = _systemd_handover(&s);

View File

@ -213,8 +213,8 @@ detect_mounted() {
# for systems with different device names - check also mount output # for systems with different device names - check also mount output
if test -z "$MOUNTED" ; then if test -z "$MOUNTED" ; then
MOUNTED=$(LANG=C "$MOUNT" | "$GREP" "^$VOLUME[ \t]") MOUNTED=$(LC_ALL=C "$MOUNT" | "$GREP" "^$VOLUME[ \t]")
test -z "$MOUNTED" && MOUNTED=$(LANG=C "$MOUNT" | "$GREP" "^$RVOLUME[ \t]") test -z "$MOUNTED" && MOUNTED=$(LC_ALL=C "$MOUNT" | "$GREP" "^$RVOLUME[ \t]")
MOUNTED=${MOUNTED##* on } MOUNTED=${MOUNTED##* on }
MOUNTED=${MOUNTED% type *} # allow type in the mount name MOUNTED=${MOUNTED% type *} # allow type in the mount name
fi fi
@ -283,7 +283,7 @@ validate_parsing() {
#################################### ####################################
resize_ext() { resize_ext() {
verbose "Parsing $TUNE_EXT -l \"$VOLUME\"" verbose "Parsing $TUNE_EXT -l \"$VOLUME\""
for i in $(LANG=C "$TUNE_EXT" -l "$VOLUME"); do for i in $(LC_ALL=C "$TUNE_EXT" -l "$VOLUME"); do
case "$i" in case "$i" in
"Block size"*) BLOCKSIZE=${i##* } ;; "Block size"*) BLOCKSIZE=${i##* } ;;
"Block count"*) BLOCKCOUNT=${i##* } ;; "Block count"*) BLOCKCOUNT=${i##* } ;;
@ -318,7 +318,7 @@ resize_reiser() {
detect_mounted && verbose "ReiserFS resizes only unmounted filesystem" && try_umount detect_mounted && verbose "ReiserFS resizes only unmounted filesystem" && try_umount
REMOUNT=$MOUNTED REMOUNT=$MOUNTED
verbose "Parsing $TUNE_REISER \"$VOLUME\"" verbose "Parsing $TUNE_REISER \"$VOLUME\""
for i in $(LANG=C "$TUNE_REISER" "$VOLUME"); do for i in $(LC_ALL=C "$TUNE_REISER" "$VOLUME"); do
case "$i" in case "$i" in
"Blocksize"*) BLOCKSIZE=${i##*: } ;; "Blocksize"*) BLOCKSIZE=${i##*: } ;;
"Count of blocks"*) BLOCKCOUNT=${i##*: } ;; "Count of blocks"*) BLOCKCOUNT=${i##*: } ;;
@ -347,7 +347,7 @@ resize_xfs() {
temp_mount || error "Cannot mount Xfs filesystem" temp_mount || error "Cannot mount Xfs filesystem"
fi fi
verbose "Parsing $TUNE_XFS \"$MOUNTPOINT\"" verbose "Parsing $TUNE_XFS \"$MOUNTPOINT\""
for i in $(LANG=C "$TUNE_XFS" "$MOUNTPOINT"); do for i in $(LC_ALL=C "$TUNE_XFS" "$MOUNTPOINT"); do
case "$i" in case "$i" in
"data"*) BLOCKSIZE=${i##*bsize=} ; BLOCKCOUNT=${i##*blocks=} ;; "data"*) BLOCKSIZE=${i##*bsize=} ; BLOCKCOUNT=${i##*blocks=} ;;
esac esac
@ -389,7 +389,7 @@ resize() {
#################################### ####################################
# Calclulate diff between two dates # Calclulate diff between two dates
# LANG=C input is expected the # LC_ALL=C input is expected the
# only one supported # only one supported
#################################### ####################################
diff_dates() { diff_dates() {
@ -410,7 +410,7 @@ check() {
"ext2"|"ext3"|"ext4") "ext2"|"ext3"|"ext4")
IFS_CHECK=$IFS IFS_CHECK=$IFS
IFS=$NL IFS=$NL
for i in $(LANG=C "$TUNE_EXT" -l "$VOLUME"); do for i in $(LC_ALL=C "$TUNE_EXT" -l "$VOLUME"); do
case "$i" in case "$i" in
"Last mount"*) LASTMOUNT=${i##*: } ;; "Last mount"*) LASTMOUNT=${i##*: } ;;
"Last checked"*) LASTCHECKED=${i##*: } ;; "Last checked"*) LASTCHECKED=${i##*: } ;;