Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-47145

Warning 'grep: warning: stray \ before x' in get_maj_min

    • dracut-102-2.el10
    • None
    • None
    • rhel-sst-cs-plumbers
    • ssg_core_services
    • 26
    • 3
    • Dev ack
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • aarch64
    • None

      What were you trying to do that didn't work?

      When trying to build a kdump initrd on aarch64 for a nfs target it prints a 'grep: warning: stray \ before x' message. The warning is emitted by dracut-functions.sh:get_maj_min called from dracut-functions:get_persistent_dev when iterating over the different /dev/disk/by-*. On aarch64 there's a /dev/disk/by-partlabel/EFI\x20System\x20Partition which triggers the warning.

      The following patch suppresses the warning for me

      diff --git a/dracut-functions.sh b/dracut-functions.sh
      index 4535871b..781bc571 100755
      --- a/dracut-functions.sh
      +++ b/dracut-functions.sh
      @@ -243,7 +243,7 @@ get_maj_min() {
           local _out
       
           if [[ $get_maj_min_cache_file ]]; then
      -        _out="$(grep -m1 -oE "^$1 \S+$" "$get_maj_min_cache_file" | awk '{print $NF}')"
      +        _out="$(grep -m1 -oE "^${1//\\/\\\\} \S+$" "$get_maj_min_cache_file" | awk '{print $NF}')"
           fi
       
           if ! [[ "$_out" ]]; then

      Not sure though if everything still works as intended.

      Please provide the package NVR for which bug is seen:

      dracut-101-2.el10.aarch64

      How reproducible:

      100%

              pvalena@redhat.com Pavel Valena
              rh-ee-prudo Philipp Rudo
              dracut maint mailing list dracut maint mailing list
              Frantisek Sumsal Frantisek Sumsal
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: