Page MenuHomeVyOS Platform

op-cmd: Interrupting the "tech-support report" command generates error
Open, NormalPublicBUG

Description

Description: After generating this command "show tech-support report":

Bug #1
Interrupting the output with 'q', throws the following error:

vyos@vyos:~$ sh tech-support report

--------------------------------
VyOS Version and Package Changes
--------------------------------
Version:          VyOS 1.5-rolling-202310021845
Release train:    current

Built by:         [email protected]
Built on:         Mon 02 Oct 2023 20:06 UTC
Build UUID:       51c6bd24-f741-4df2-8dc2-053ffa2e992c
Build commit ID:  86f80f99c57240

Architecture:     x86_64
Boot via:         installed image
System type:      KVM guest

Hardware vendor:  QEMU
Hardware model:   Standard PC (i440FX + PIIX, 1996)
Hardware S/N:
Hardware UUID:    b78d1414-6c0b-485c-b20a-7418cf5668c7

Copyright:        VyOS maintainers and contributors

Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf>
BrokenPipeError: [Errno 32] Broken pipe

Bug #2:
Searching for a keyword , types two alphabets at a time, seems to be a cosmetic bug (as it searches for the exact word)

image.png (216×740 px, 18 KB)

Bug #3:
While progressing through "sh tech-support report" output, issuing Ctrl-C doesn't allow for a graceful exit:

            ...config output before Ctrl-C pressed...
            network "2a05:b0c6:a000::/39"
            network "2a05:b0c6:a200::/39"
            network "2a05:b0c7:6000::/36"
            network "2a06:e80:3000::/36"
:    main()
  File "/usr/libexec/vyos/op_mode/show_techsupport_report.py", line 258, in main
    show_config_file()
  File "/usr/libexec/vyos/op_mode/show_techsupport_report.py", line 76, in show_config_file
    execute_command('cat /opt/vyatta/etc/config/config.boot', 'Configuration file')
  File "/usr/libexec/vyos/op_mode/show_techsupport_report.py", line 53, in execute_command
    print(output)
KeyboardInterrupt
            network "2a06:d240::/29"
            network "2a06:e480::/29"
            network "2a07:5c0::/29"
            network "2a07:4180::/29"
            ...config output continued after Ctrl-C pressed...

Details

Difficulty level
Unknown (require assessment)
Version
1.5-rolling-202310021845
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Unspecified (please specify)

Event Timeline

Viacheslav triaged this task as Normal priority.Jan 20 2024, 1:31 PM
dmbaturin added a project: Restricted Project.Apr 4 2024, 7:40 PM

Can this be assigned to me please, will give it a go.

Updated task description to denote two issues (Bug 1 and Bug 2) with show tech-support report.

Giggum updated the task description. (Show Details)

Documenting what I've found regarding Bug #2:

How to reproduce:

  1. vyos@vyos:~$ show tech-support report
  2. attempt to search a keyword by typing "/ethernet" shows "/eetthheerrnneett". Continuing with typing a four backspaces expecting to see characters removed from screen append more characters instead specifically the ^ symbol: "/eetthheerrnneett^^^^".
vyos@vyos:~$ show tech-support report

--------------------------------
VyOS Version and Package Changes
--------------------------------
Version:          VyOS 1.5-rolling-202406060020
Release train:    current
Release flavor:   generic

Built by:         [email protected]
Built on:         Thu 06 Jun 2024 03:11 UTC
Build UUID:       e0cb746f-5572-4aaf-8d6c-536ac82e5957
Build commit ID:  9c2ec5e3d31713

Architecture:     x86_64
Boot via:         installed image
System type:      QEMU guest

Hardware vendor:  QEMU
Hardware model:   Standard PC (Q35 + ICH9, 2009)
Hardware S/N:     
Hardware UUID:    b165d52d-5db7-4edb-990a-09d083799a23

Copyright:        VyOS maintainers and contributors

---------------------
Running configuration
---------------------
interfaces {
    ethernet eth0 {
        address dhcp
        address 2001:db8:3456::1/48
        mtu 1492
        offload {
            gro
            gso
/eetthheerrnneett^^^^

What's causing the issue:
All function calls within show_techsupport_report.py that utilize the "op()" function cause the output on screen to appear as above.

def op(cmd: str) -> str:
    """Returns a command with the VyOS operational mode wrapper."""
    return f'/opt/vyatta/bin/vyatta-op-cmd-wrapper {cmd}'

How to confirm this?

  1. cd /usr/libexec/vyos/op_mode/
  2. type: vyos@vyos:~$ sudo nano show_techsupport_report.py
  3. under the main function "def main()", edit the file to comment out all function calls that make use of the op() command: such as #show_version(), #show_running_config(), and so on (make sure to get them all). Save the file and exit.
  4. type: vyos@vyos:~$ show tech-support report and attempt to search for "/ethernet" as above" and notice no extraneous characters and entering backspace works as expected.
  5. Go back and edit show_techsupport_report.py to undo the changes made in step 3 to return the behaviour of the op command back to its default.
vyos@vyos:/usr/libexec/vyos/op_mode$ show tech-support report

------------------
Configuration file
------------------
interfaces {
    ethernet eth0 {
        address "dhcp"
        address "2001:db8:3456::1/48"
        mtu "1492"
        offload {
            gro
            gso
            sg
            tso
        }
    }
    loopback lo {
    }
}
service {
    dhcpv6-server {
        shared-network-name VyOS-DHCPv6 {
            subnet 2001:db8:3456::/64 {
                option {
                    name-server "2001:db8:daad::1"
                }
                range 1 {
                    start "2001:db8:3456::100"
                    stop "2001:db8:3456::1ff"
                }
                subnet-id "1"
            }
        }
    }
    ntp {
/ethernet

Root cause
Unknown though it's something within vyatta-op-cmd-wrapper and its subscripts

Workaround
None identified