On 04/09/15 at 09:38am, Dave Young wrote:
On 04/07/15 at 05:20pm, Minfei Huang wrote:
> Now kdump cannt parse the path correctly, if the path contains
> duplicated "/". Following is an example to explain it detail.
>
> path //mnt/var/crash
>
> Then the warning will raise, as kdump cannt parse this path correctly.
>
> Force rebuild /boot/initramfs-3.19.1kdump.img
> Rebuilding /boot/initramfs-3.19.1kdump.img
> df: ‘/mnt///mnt/var/crash’: No such file or directory
> /sbin/mkdumprd: line 239: [: -lt: unary operator expected
> kexec: loaded kdump kernel
> Starting kdump: [OK]
>
> Kdump fails to cut out the substring, if the string contains dumplicated
> "/".
>
> Add the new function which it will cut out the substring accurately.
>
> Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
> ---
> dracut-module-setup.sh | 7 +++----
> kdump-lib.sh | 8 ++++++++
> mkdumprd | 2 +-
> 3 files changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
> index 4641025..477ede1 100755
> --- a/dracut-module-setup.sh
> +++ b/dracut-module-setup.sh
> @@ -311,9 +311,8 @@ kdump_install_net() {
> default_dump_target_install_conf()
> {
> local _target _fstype
> - local _s _t
> local _mntpoint
> - local _path _save_path
> + local _save_path
>
> is_user_configured_dump_target && return
>
> @@ -334,11 +333,11 @@ default_dump_target_install_conf()
>
> echo "$_fstype $_target" >> ${initdir}/tmp/$$-kdump.conf
>
> - _path=${_save_path##"$_mntpoint"}
> + _save_path=$(cut_out_substring $_save_path $_mntpoint)
>
> #erase the old path line, then insert the parsed path
> sed -i "/^path/d" ${initdir}/tmp/$$-kdump.conf
> - echo "path $_path" >> ${initdir}/tmp/$$-kdump.conf
> + echo "path $_save_path" >> ${initdir}/tmp/$$-kdump.conf
> fi
>
> }
> diff --git a/kdump-lib.sh b/kdump-lib.sh
> index f24f08d..ab01d74 100755
> --- a/kdump-lib.sh
> +++ b/kdump-lib.sh
> @@ -188,3 +188,11 @@ is_ipv6_target()
> _server=${_server:-$_server_tmp}
> echo $_server | grep -q ":"
> }
> +
> +cut_out_substring()
> +{
> + # filter out the duplicated "/"
> + local _main_str=$(echo $1|sed "s#/\{1,\}#/#g")
> + local _sub_str=$(echo $2|sed "s#/\{1,\}#/#g")
> + echo ${_main_str#*"$_sub_str"}
> +}
> diff --git a/mkdumprd b/mkdumprd
> index 4d251ba..a8f9cbb 100644
> --- a/mkdumprd
> +++ b/mkdumprd
> @@ -364,7 +364,7 @@ handle_default_dump_target()
> _mntpoint=$(get_mntpoint_from_path $SAVE_PATH)
> _target=$(get_target_from_path $SAVE_PATH)
> if [ "$_mntpoint" != "/" ]; then
> - SAVE_PATH=${SAVE_PATH##"$_mntpoint"}
> + SAVE_PATH=$(cut_out_substring $SAVE_PATH $_mntpoint)
> _fstype=$(get_fs_type_from_target $_target)
>
> if $(is_fs_type_nfs $_fstype); then
> --
> 1.9.3
>
NACK the patch until the issues are addressed per previous discussion
thanks for you review. I will repost a new patch to fix this issue,
until we all agree it.
Thanks
Minfei
Thanks
Dave