x-cmd icon indicating copy to clipboard operation
x-cmd copied to clipboard

[BUG] x ping运行不了 | inetutils-ping 不提供 `-O` 无法用于 `x ping` | [mod=ping] [v0.5.11]

Open EndBoy520 opened this issue 8 months ago • 7 comments

💬 Describe the bug

x ping bing.com 以热图形式显示 ping 的结果

/usr/bin/ping: invalid option -- 'O' Try 'ping --help' or 'ping --usage' for more information.

sh x ping --heatmap 8.8.8.8 以条形图模式显示 ping 的结果

/usr/bin/ping: invalid option -- 'O' Try 'ping --help' or 'ping --usage' for more information.

sh x ping --bar bing.com 对 ping 的结果进行处理,并以热图形式显示

/usr/bin/ping: invalid option -- 'O' Try 'ping --help' or 'ping --usage' for more information.

sh ping bing.com | x ping vis --heatmap

1  107   87  101   70   79   78   70   70   70   71                         
                                                                            
                                                                            
   71.875 ms ∈ [ 70 , 107 ] | AVG = 80.85 ± 13.10                           
  150.171.27.10    TTL=112 BYTE=64  SEQ=10    FAIL=0     

x ping开头的命令都没法使用,只有ping bing.com | x ping vis --heatmap在这种形式能用

📄 System

- name: x-cmd
  info: |-
    ___X_CMD_VERSION:           .e1c775a4
    ___X_CMD_PKG_VERSION:       
    ___X_CMD_WEBSRC_REGION:     cn
    x-cmd sum:                  e1c775a4d0c665c06bf9e04e659d84449813d267bd492c5162b6930afeb7d65cdd88116c172331e64e2a8a2950e837dab66128b1b6b2e6af99f9efde9a5a323d
    
    ==== root ls ====
    V:          <<HOME-STRING>>/.x-cmd.root/v
    CODE:       <<HOME-STRING>>/.x-cmd.root/v/.e1c775a4
    ADV:        <<HOME-STRING>>/.x-cmd.root/v/.e1c775a4/adv
    MOD:        <<HOME-STRING>>/.x-cmd.root/v/.e1c775a4/mod
    METADATA:   <<HOME-STRING>>/.x-cmd.root/v/.e1c775a4/.x-cmd/metadata
    GDATA:      <<HOME-STRING>>/.x-cmd.root/global/data
    DATA:       <<HOME-STRING>>/.x-cmd.root/local/data
    USR:        <<HOME-STRING>>/.x-cmd.root/local/usr
    ART:        <<HOME-STRING>>/.x-cmd.root/local/art
    GCFG:       <<HOME-STRING>>/.x-cmd.root/global/cfg
    CFG:        <<HOME-STRING>>/.x-cmd.root/local/cfg
    LOG:        <<HOME-STRING>>/.x-cmd.root/local/log
    CACHE:      <<HOME-STRING>>/.x-cmd.root/local/cache
    TMP:        <<HOME-STRING>>/.x-cmd.root/local/tmp
    SHARED:     <<HOME-STRING>>/.x-cmd.root/global/shared
    
    ==== boot rc ====
- name: shell
  info: bash
- name: awk
  info: mawk 1.3.4 20200120
- name: sed
  info: |-
    /usr/bin/sed (GNU sed) 4.9
    由 Debian 打包
    Copyright (C) 2022 Free Software Foundation, Inc.
    许可证 GPLv3+:GNU 通用公共许可证第 3 版或更新版本<https://gnu.org/licenses/gpl.html>。
    本软件是自由软件:您可以自由修改和重新发布它。
    在法律范围内没有其他保证。
    
    由 Jay Fenlason、Tom Lord、Ken Pizzini、
    Paolo Bonzini、Jim Meyering 和 Assaf Gordon 编写。
    
    本 sed 程序构建时含有 SELinux 支持。
    此系统已禁用 SELinux。
    
    GNU sed 主页:<https://www.gnu.org/software/sed/>。
    使用 GNU 软件的一般性帮助:<https://www.gnu.org/gethelp/>。
    请将错误报告发送至:<[email protected]>。
- name: grep
  info: |-
    grep (GNU grep) 3.8
    Copyright © 2022 Free Software Foundation, Inc.
    许可证 GPLv3+:GNU 通用公共许可证第 3 版或更新版本 <https://gnu.org/licenses/gpl.html>。
    本软件是自由软件:您可以自由修改和重新发布它。
    在法律允许的范围内,不提供任何保证。
    
    由 Mike Haerhtel 等人编写;作者信息请参见
    <https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>。
- name: find
  info: |-
    find (GNU findutils) 4.9.0
    Copyright (C) 2022 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    
    Written by Eric B. Decker, James Youngman, and Kevin Dalley.
    开启的特性: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS(FTS_CWDFD) CBO(level=2) 
- name: busybox
  info: 
- name: curl
  info: |-
    curl 7.88.1 (aarch64-unknown-linux-gnu) libcurl/7.88.1 OpenSSL/3.0.15 zlib/1.2.13 brotli/1.0.9 zstd/1.5.4 libidn2/2.3.3 libpsl/0.21.2 (+libidn2/2.3.3) libssh2/1.10.0 nghttp2/1.52.0 librtmp/2.3 OpenLDAP/2.5.13
    Release-Date: 2023-02-20, security patched: 7.88.1-10+deb12u12
    Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
    Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd
- name: wget
  info: |-
    GNU Wget 1.21.3 在 linux-gnu 上编译。
    
    -cares +digest -gpgme +https +ipv6 +iri +large-file -metalink +nls 
    +ntlm +opie +psl +ssl/gnutls 
    
    Wgetrc: 
        /etc/wgetrc (系统)
    语区: 
        /usr/share/locale 
    编译: 
        gcc -DHAVE_CONFIG_H -DSYSTEM_WGETRC="/etc/wgetrc" 
        -DLOCALEDIR="/usr/share/locale" -I. -I../../src -I../lib 
        -I../../lib -Wdate-time -D_FORTIFY_SOURCE=2 
        -I/usr/include/p11-kit-1 -DHAVE_LIBGNUTLS -DNDEBUG -g -O2 
        -ffile-prefix-map=/build/reproducible-path/wget-1.21.3=. 
        -fstack-protector-strong -Wformat -Werror=format-security 
        -DNO_SSLv2 -D_FILE_OFFSET_BITS=64 -g -Wall 
    链接: 
        gcc -I/usr/include/p11-kit-1 -DHAVE_LIBGNUTLS -DNDEBUG -g -O2 
        -ffile-prefix-map=/build/reproducible-path/wget-1.21.3=. 
        -fstack-protector-strong -Wformat -Werror=format-security 
        -DNO_SSLv2 -D_FILE_OFFSET_BITS=64 -g -Wall -Wl,-z,relro -Wl,-z,now 
        -lpcre2-8 -luuid -lidn2 -lnettle -lgnutls -lz -lpsl ../lib/libgnu.a 
    
    Copyright © 2015 Free Software Foundation, Inc.
    授权 GPLv3+: GNU GPL 第三版或更高版本
    <http://www.gnu.org/licenses/gpl.html>。
    这是自由软件:您可以自由地更改并重新分发它。
    在法律所允许的范围内,没有任何担保。
    
    最初由 Hrvoje Nikšić <[email protected]> 编写。
    请将错误报告或建议寄给 <[email protected]>。
- name: release
  info: |-
    debian
    "12"

🔎 To Reproduce

  1. Start up service: ...
  2. Type command: ...

Expected behavior

🗂️ Additional Context

No response

EndBoy520 avatar Apr 24 '25 11:04 EndBoy520

看样子应该是 x ping 使用了一些参数, 与该系统中的 ping 不兼容.

/usr/bin/ping: invalid option -- 'O'

谢谢, 我们将会尽快处理.

edwinjhlee avatar Apr 24 '25 11:04 edwinjhlee

我不太确定你系统的 ping 版本. 我们当前实现是要依赖 -O 来确保超时的时候有输出

请提供一下 ping -hping -V 的输出, 谢谢.


我在 debian:12 镜像所安装的 ping 是能支持 -O 参数的.

root@d8385a08f835:/# ping -V
ping from iputils 20221126
libcap: yes, IDN: yes, NLS: no, error.h: yes, getrandom(): yes, __fpending(): yes
root@d8385a08f835:/# ping -h

Usage
  ping [options] <destination>

Options:
  <destination>      dns name or ip address
  -a                 use audible ping
  -A                 use adaptive ping
  -B                 sticky source address
  -c <count>         stop after <count> replies
  -C                 call connect() syscall on socket creation
  -D                 print timestamps
  -d                 use SO_DEBUG socket option
  -e <identifier>    define identifier for ping session, default is random for
                     SOCK_RAW and kernel defined for SOCK_DGRAM
                     Imply using SOCK_RAW (for IPv4 only for identifier 0)
  -f                 flood ping
  -h                 print help and exit
  -I <interface>     either interface name or address
  -i <interval>      seconds between sending each packet
  -L                 suppress loopback of multicast packets
  -l <preload>       send <preload> number of packages while waiting replies
  -m <mark>          tag the packets going out
  -M <pmtud opt>     define mtu discovery, can be one of <do|dont|want>
  -n                 no dns name resolution
  -O                 report outstanding replies
  -p <pattern>       contents of padding byte
  -q                 quiet output
  -Q <tclass>        use quality of service <tclass> bits
  -s <size>          use <size> as number of data bytes to be sent
  -S <size>          use <size> as SO_SNDBUF socket option value
  -t <ttl>           define time to live
  -U                 print user-to-user latency
  -v                 verbose output
  -V                 print version and exit
  -w <deadline>      reply wait <deadline> in seconds
  -W <timeout>       time to wait for response

IPv4 options:
  -4                 use IPv4
  -b                 allow pinging broadcast
  -R                 record route
  -T <timestamp>     define timestamp, can be one of <tsonly|tsandaddr|tsprespec>

IPv6 options:
  -6                 use IPv6
  -F <flowlabel>     define flow label, default is random
  -N <nodeinfo opt>  use icmp6 node info query, try <help> as argument

For more details see ping(8).

edwinjhlee avatar Apr 24 '25 11:04 edwinjhlee

我不太确定你系统的 ping 版本. 我们当前实现是要依赖 -O 来确保超时的时候有输出

请提供一下 ping -hping -V 的输出, 谢谢.

我在 debian:12 镜像所安装的 ping 是能支持 -O 参数的.

root@d8385a08f835:/# ping -V
ping from iputils 20221126
libcap: yes, IDN: yes, NLS: no, error.h: yes, getrandom(): yes, __fpending(): yes
root@d8385a08f835:/# ping -h

Usage
  ping [options] <destination>

Options:
  <destination>      dns name or ip address
  -a                 use audible ping
  -A                 use adaptive ping
  -B                 sticky source address
  -c <count>         stop after <count> replies
  -C                 call connect() syscall on socket creation
  -D                 print timestamps
  -d                 use SO_DEBUG socket option
  -e <identifier>    define identifier for ping session, default is random for
                     SOCK_RAW and kernel defined for SOCK_DGRAM
                     Imply using SOCK_RAW (for IPv4 only for identifier 0)
  -f                 flood ping
  -h                 print help and exit
  -I <interface>     either interface name or address
  -i <interval>      seconds between sending each packet
  -L                 suppress loopback of multicast packets
  -l <preload>       send <preload> number of packages while waiting replies
  -m <mark>          tag the packets going out
  -M <pmtud opt>     define mtu discovery, can be one of <do|dont|want>
  -n                 no dns name resolution
  -O                 report outstanding replies
  -p <pattern>       contents of padding byte
  -q                 quiet output
  -Q <tclass>        use quality of service <tclass> bits
  -s <size>          use <size> as number of data bytes to be sent
  -S <size>          use <size> as SO_SNDBUF socket option value
  -t <ttl>           define time to live
  -U                 print user-to-user latency
  -v                 verbose output
  -V                 print version and exit
  -w <deadline>      reply wait <deadline> in seconds
  -W <timeout>       time to wait for response

IPv4 options:
  -4                 use IPv4
  -b                 allow pinging broadcast
  -R                 record route
  -T <timestamp>     define timestamp, can be one of <tsonly|tsandaddr|tsprespec>

IPv6 options:
  -6                 use IPv6
  -F <flowlabel>     define flow label, default is random
  -N <nodeinfo opt>  use icmp6 node info query, try <help> as argument

For more details see ping(8).

=================================================================================== ping --h Usage: ping [OPTION...] HOST ... Send ICMP ECHO_REQUEST packets to network hosts.

Options controlling ICMP request types: --address send ICMP_ADDRESS packets (root only) --echo send ICMP_ECHO packets (default) --mask same as --address --timestamp send ICMP_TIMESTAMP packets -t, --type=TYPE send TYPE packets

Options valid for all request types:

-c, --count=NUMBER stop after sending NUMBER packets -d, --debug set the SO_DEBUG option -i, --interval=NUMBER wait NUMBER seconds between sending each packet -n, --numeric do not resolve host addresses -r, --ignore-routing send directly to a host on an attached network --ttl=N specify N as time-to-live -T, --tos=NUM set type of service (TOS) to NUM -v, --verbose verbose output -w, --timeout=N stop after N seconds -W, --linger=N number of seconds to wait for response

Options valid for --echo requests:

-f, --flood flood ping (root only) --ip-timestamp=FLAG IP timestamp of type FLAG, which is one of "tsonly" and "tsaddr" -l, --preload=NUMBER send NUMBER packets as fast as possible before falling into normal mode of behavior (root only) -p, --pattern=PATTERN fill ICMP packet with given pattern (hex) -q, --quiet quiet output -R, --route record route -s, --size=NUMBER send NUMBER data octets

-?, --help give this help list --usage give a short usage message -V, --version print program version

Mandatory or optional arguments to long options are also mandatory or optional for any corresponding short options.

Options marked with (root only) are available only to superuser.

Report bugs to [email protected].

ping -V ping (GNU inetutils) 2.4 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later https://gnu.org/licenses/gpl.html. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

Written by Sergey Poznyakoff.

No LSB modules are available. Distributor ID: Debian Description: Armbian 25.2.3 bookworm Release: 12 Codename: bookworm Linux Panther-X2 6.1.134-ophub #1 SMP Mon Apr 14 03:02:43 EDT 2025 aarch64 GNU/Linux

我的是armbian的debian12,跟你不一样

EndBoy520 avatar Apr 26 '25 16:04 EndBoy520

root@Panther-X2:~# apt install ping
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成                 
虚拟软件包 ping 由下面的软件包提供:
  iputils-ping 3:20221126-1+deb12u1
  inetutils-ping 2:2.4-2+deb12u1
请您明确地选择安装其中一个。

E: 软件包 ping 没有可安装候选

EndBoy520 avatar Apr 26 '25 16:04 EndBoy520

我记得我安装的是 iputils-ping

edwinjhlee avatar Apr 26 '25 17:04 edwinjhlee

从你的 help 看来, 应该是 inetutils-ping ~ 所以没有 -O 这个参数.

这个问题有点麻烦, 我们要测一下 inetutils 的行为. 在之前的测试中, 如果不提供 -O, 超时的 ping 不会有输出.

我们倒是可以排除掉 inetutils 的 ping, 并引入 nping 作为 fallback backend.

edwinjhlee avatar Apr 26 '25 17:04 edwinjhlee

我已经复原了错误环境了:

  1. 采用了 inetutils-ping

解决方案:

  1. 识别出 inetutils-ping
  2. 引入 nping 作为替换的 backend.

edwinjhlee avatar Apr 26 '25 18:04 edwinjhlee

Provided at https://x-cmd.com/v/0.5.11/#ping

I am closing this issue ~ If problems occured, feel free to reopen.

Thank you. @EndBoy520

curry798 avatar Sep 04 '25 08:09 curry798