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

run virsh with timeout command failed in shell script

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • rhel-8.8.0
    • polkit
    • None
    • Important
    • rhel-sst-cs-plumbers
    • ssg_core_services
    • 4
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • If docs needed, set a value
    • None

      Description of problem:
      when test script run "timeout -v --preserve-status 4s bash -c 'virsh list'", command exit with TERM

      Version-Release number of selected component (if applicable):
      libvirt-client-8.0.0-19.module+el8.8.0+18453+e0bf0d1d.x86_64
      kernel version:4.18.0-477.10.1.el8_8.x86_64
      polkit-debuginfo-0.115-13.el8_5.2.x86_64
      polkit-0.115-13.el8_5.2.x86_64
      polkit-pkla-compat-0.1-12.el8.x86_64
      polkit-debugsource-0.115-13.el8_5.2.x86_64
      polkit-libs-0.115-13.el8_5.2.x86_64

      How reproducible: 100%

      Steps to Reproduce:
      1. create a shell script as below:
      #!/bin/bash
      set -x
      echo $$
      timeout -v --preserve-status 4s bash -c "virsh list && echo $$"
      timeout -v --preserve-status 4s bash -c "ls -l && echo $$"

      2. run test script and got output as below:

      1. sh test-juzhou.sh
        + echo 8192
        8192
        + timeout -v --preserve-status 4s bash -c 'virsh list && echo 8192'
        timeout: sending signal TERM to command ‘bash’
        + timeout -v --preserve-status 4s bash -c 'ls -l && echo 8192'
        total 9200
        rw------. 1 root root 22659 Apr 1 11:25 anaconda-ks.cfg
        -rwxrwxrwx. 1 root root 10151 Apr 13 11:16 irqstat.py
        drwxr-xr-x. 2 root root 4096 Apr 14 03:06 libvirt
        rw-rr-. 1 root root 67144 Apr 1 20:13 memoryinfo
        rw-rr-. 1 root root 26602 Apr 1 11:27 my-ks-post.log
        rw-rr-. 1 root root 4 Apr 1 11:25 NETBOOT_METHOD.TXT
        rw------. 1 root root 24198 Apr 1 11:27 original-ks.cfg
        rw-r----. 1 root root 3327246 Apr 1 20:14 ovs-vswitchd.log
        rw-rr-. 1 root root 331210 Apr 1 20:14 ovs-vswitchd.log.gz
        rw-rr-. 1 root root 723364 Apr 1 20:13 ovs-vswitchd-maps
        rw-rr-. 1 root root 632196 Apr 1 20:13 ovs-vswitchd-numa_maps
        rw-rr-. 1 root root 2060356 Apr 1 20:13 qemu-maps
        rw-rr-. 1 root root 2141430 Apr 1 20:13 qemu-numa_maps
        rw-rr-. 1 root root 9 Apr 1 11:25 RECIPE.TXT
        drwxr-xr-x. 2 root root 4096 Apr 13 23:47 rt-kernel
        drwxr-xr-x. 2 root root 4096 Apr 13 23:56 stock-kernel
        rw-rr-. 1 root root 150 Apr 14 03:16 test-juzhou.sh
        8192

      3. run in shell interactive mode

      1. timeout -v --preserve-status 4s bash -c "virsh list && echo $$"
        Id Name State
        --------------------

      2278

      4. run test script with '.'
      [root@dell-per750-03 ~]# . ./test-juzhou.sh
      ++ echo 2278
      2278
      ++ timeout -v --preserve-status 4s bash -c 'virsh list && echo 2278'
      Id Name State
      --------------------

      2278
      ++ timeout -v --preserve-status 4s bash -c 'ls -l && echo 2278'
      total 9200
      rw------. 1 root root 22659 Apr 1 11:25 anaconda-ks.cfg
      -rwxrwxrwx. 1 root root 10151 Apr 13 11:16 irqstat.py
      drwxr-xr-x. 2 root root 4096 Apr 14 03:06 libvirt
      rw-rr-. 1 root root 67144 Apr 1 20:13 memoryinfo
      rw-rr-. 1 root root 26602 Apr 1 11:27 my-ks-post.log
      rw-rr-. 1 root root 4 Apr 1 11:25 NETBOOT_METHOD.TXT
      rw------. 1 root root 24198 Apr 1 11:27 original-ks.cfg
      rw-r----. 1 root root 3327246 Apr 1 20:14 ovs-vswitchd.log
      rw-rr-. 1 root root 331210 Apr 1 20:14 ovs-vswitchd.log.gz
      rw-rr-. 1 root root 723364 Apr 1 20:13 ovs-vswitchd-maps
      rw-rr-. 1 root root 632196 Apr 1 20:13 ovs-vswitchd-numa_maps
      rw-rr-. 1 root root 2060356 Apr 1 20:13 qemu-maps
      rw-rr-. 1 root root 2141430 Apr 1 20:13 qemu-numa_maps
      rw-rr-. 1 root root 9 Apr 1 11:25 RECIPE.TXT
      drwxr-xr-x. 2 root root 4096 Apr 13 23:47 rt-kernel
      drwxr-xr-x. 2 root root 4096 Apr 13 23:56 stock-kernel
      rw-rr-. 1 root root 150 Apr 14 03:16 test-juzhou.sh
      2278
      ++ printf '\033]0;%s@%s:%s\007' root dell-per750-03 '~'

      Actual results:
      1. from step2, run test script with sh failed.

      Expected results:
      1. from step2, run test script should be successes.

      Additional info:
      [root@dell-per750-03 ~]# cat test-juzhou.sh
      + cat test-juzhou.sh
      #!/bin/bash
      set -x
      timeout -v --preserve-status 4s virsh list

      1. sh test-juzhou.sh
        + sh test-juzhou.sh
        + timeout -v --preserve-status 4s virsh list

              jrybar@redhat.com Jan Rybar
              mhou@redhat.com Minxi Hou
              Jan Rybar Jan Rybar
              qe-baseos-daemons qe-baseos-daemons
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated: