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:
parent
142c4bf9f0
commit
8bcc1da2f3
@ -1,5 +1,6 @@
|
||||
Version 2.02.99 -
|
||||
===================================
|
||||
Set locales with LC_ALL instead of lower priority LANG variable.
|
||||
Fix a crash-inducing race condition in lvmetad.
|
||||
Add log/debug_classes to lvm.conf to control debug log messages.
|
||||
Synchronize with udev in pvscan --cache and fix dangling udev_sync cookies.
|
||||
|
@ -440,8 +440,8 @@ int main(int argc, char *argv[])
|
||||
* used by some glibc (on some distributions it takes over 100MB).
|
||||
* Daemon currently needs to use mlockall().
|
||||
*/
|
||||
if (setenv("LANG", "C", 1))
|
||||
perror("Cannot set LANG to C");
|
||||
if (setenv("LC_ALL", "C", 1))
|
||||
perror("Cannot set LC_ALL to C");
|
||||
|
||||
/* Setting debug options on an existing clvmd */
|
||||
if (debug_opt && !check_local_clvmd()) {
|
||||
|
@ -1965,8 +1965,8 @@ int main(int argc, char *argv[])
|
||||
* used by some glibc (on some distributions it takes over 100MB).
|
||||
* Daemon currently needs to use mlockall().
|
||||
*/
|
||||
if (setenv("LANG", "C", 1))
|
||||
perror("Cannot set LANG to C");
|
||||
if (setenv("LC_ALL", "C", 1))
|
||||
perror("Cannot set LC_ALL to C");
|
||||
|
||||
if (_restart)
|
||||
restart();
|
||||
|
@ -456,8 +456,8 @@ void daemon_start(daemon_state s)
|
||||
* some glibc (on some distributions it takes over 100MB). Some daemons
|
||||
* need to use mlockall().
|
||||
*/
|
||||
if (setenv("LANG", "C", 1))
|
||||
perror("Cannot set LANG to C");
|
||||
if (setenv("LC_ALL", "C", 1))
|
||||
perror("Cannot set LC_ALL to C");
|
||||
|
||||
#ifdef linux
|
||||
_systemd_activation = _systemd_handover(&s);
|
||||
|
@ -213,8 +213,8 @@ detect_mounted() {
|
||||
|
||||
# for systems with different device names - check also mount output
|
||||
if test -z "$MOUNTED" ; then
|
||||
MOUNTED=$(LANG=C "$MOUNT" | "$GREP" "^$VOLUME[ \t]")
|
||||
test -z "$MOUNTED" && MOUNTED=$(LANG=C "$MOUNT" | "$GREP" "^$RVOLUME[ \t]")
|
||||
MOUNTED=$(LC_ALL=C "$MOUNT" | "$GREP" "^$VOLUME[ \t]")
|
||||
test -z "$MOUNTED" && MOUNTED=$(LC_ALL=C "$MOUNT" | "$GREP" "^$RVOLUME[ \t]")
|
||||
MOUNTED=${MOUNTED##* on }
|
||||
MOUNTED=${MOUNTED% type *} # allow type in the mount name
|
||||
fi
|
||||
@ -283,7 +283,7 @@ validate_parsing() {
|
||||
####################################
|
||||
resize_ext() {
|
||||
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
|
||||
"Block size"*) BLOCKSIZE=${i##* } ;;
|
||||
"Block count"*) BLOCKCOUNT=${i##* } ;;
|
||||
@ -318,7 +318,7 @@ resize_reiser() {
|
||||
detect_mounted && verbose "ReiserFS resizes only unmounted filesystem" && try_umount
|
||||
REMOUNT=$MOUNTED
|
||||
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
|
||||
"Blocksize"*) BLOCKSIZE=${i##*: } ;;
|
||||
"Count of blocks"*) BLOCKCOUNT=${i##*: } ;;
|
||||
@ -347,7 +347,7 @@ resize_xfs() {
|
||||
temp_mount || error "Cannot mount Xfs filesystem"
|
||||
fi
|
||||
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
|
||||
"data"*) BLOCKSIZE=${i##*bsize=} ; BLOCKCOUNT=${i##*blocks=} ;;
|
||||
esac
|
||||
@ -389,7 +389,7 @@ resize() {
|
||||
|
||||
####################################
|
||||
# Calclulate diff between two dates
|
||||
# LANG=C input is expected the
|
||||
# LC_ALL=C input is expected the
|
||||
# only one supported
|
||||
####################################
|
||||
diff_dates() {
|
||||
@ -410,7 +410,7 @@ check() {
|
||||
"ext2"|"ext3"|"ext4")
|
||||
IFS_CHECK=$IFS
|
||||
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
|
||||
"Last mount"*) LASTMOUNT=${i##*: } ;;
|
||||
"Last checked"*) LASTCHECKED=${i##*: } ;;
|
||||
|
Loading…
Reference in New Issue
Block a user