populate-volatile.sh: normalize repeated leading slashes in TNAME
PATCH 1/1 populate-volatile.sh: normalize repeated leading slashes in TNAME
--- meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh +1 -1
@@ -150,7 +150,7 @@ apply_cfgfile() { cat ${CFGFILE} | grep -v "^#" | \ while read LINE; do eval `echo "$LINE" | sed -n "s/\(.*\)\ \(.*\) \(.*\)\ \(.*\)\ \(.*\)\ \(.*\)/TTYPE=\1 ; TUSER=\2; TGROUP=\3; TMODE=\4; TNAME=\5 TLTARGET=\6/p"` - TNAME=${ROOT_DIR}/${TNAME} + TNAME=`echo ${ROOT_DIR}/${TNAME} | sed -e 's@^//*@/@'` [ "${VERBOSE}" != "no" ] && echo "Checking for -${TNAME}-." [ "${TTYPE}" = "l" ] && {
Signature · 1 line
1.8.2.3
meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh apply_cfgfile() { · line 153
Quoted 2 lines · Jonathan Liu
meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh +1
-1- TNAME=${ROOT_DIR}/${TNAME} + TNAME=`echo ${ROOT_DIR}/${TNAME} | sed -e 's@^//*@/@'`
Why is this a good thing? Your commit message is rather terse.
p.
Quoted 6 lines · Phil Blundell
meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh apply_cfgfile() { · line 153
Quoted 2 lines · Jonathan Liu
meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh +1
-1- TNAME=${ROOT_DIR}/${TNAME} + TNAME=`echo ${ROOT_DIR}/${TNAME} | sed -e 's@^//*@/@'`Why is this a good thing? Your commit message is rather terse.
p.
It reduces the size of /etc/volatile.cache.
Otherwise for example if you have ROOT_DIR=/, TNAME=/var/log, TNAME becomes ///var/log. Also if you have verbose mode enabled it actually prints out the extra unnecessary leading slashes.
Regards,
Jonathan
Quoted 6 lines · Jonathan Liu
Quoted 5 lines · Phil Blundell
meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh apply_cfgfile() { · line 153
Quoted 2 lines · Jonathan Liu
meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh +1
-1- TNAME=${ROOT_DIR}/${TNAME} + TNAME=`echo ${ROOT_DIR}/${TNAME} | sed -e 's@^//*@/@'`Why is this a good thing? Your commit message is rather terse.
Quoted 7 lines
Quoted 1 line
p.
It reduces the size of
/etc/volatile.cache.
Otherwise for example if you have ROOT_DIR=/, TNAME=/var/log, TNAME becomes ///var/log.Also if you have verbose mode enabled it actually prints out the extra unnecessary leading slashes.
How many bytes does it actually save on a typical system? Is this worth the overhead of forking an extra 2 processes for every line in the file?
Would it not be better fixed by requiring TNAME to start with a slash (which it probably does already), ROOT_DIR to not end with a slash, and just dropping the intermediate separator?
p.
Quoted 18 lines · Phil Blundell
Quoted 6 lines · Jonathan Liu
Quoted 5 lines · Phil Blundell
meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh apply_cfgfile() { · line 153
Quoted 2 lines · Jonathan Liu
meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh +1
-1- TNAME=${ROOT_DIR}/${TNAME} + TNAME=`echo ${ROOT_DIR}/${TNAME} | sed -e 's@^//*@/@'`Why is this a good thing? Your commit message is rather terse.
Quoted 7 lines
Quoted 1 line
p.
It reduces the size of
/etc/volatile.cache.
Otherwise for example if you have ROOT_DIR=/, TNAME=/var/log, TNAME becomes ///var/log.Also if you have verbose mode enabled it actually prints out the extra unnecessary leading slashes.
How many bytes does it actually save on a typical system? Is this worth the overhead of forking an extra 2 processes for every line in the file?
Quoted 5 lines
Would it not be better fixed by requiring TNAME to start with a slash (which it probably does already),
ROOT_DIRto not end with a slash, and just dropping the intermediate separator?p.
That does sound like a better solution, let's go with that.
Regards,
Jonathan