7 Star 13 Fork 43

openEuler/easybox

column存在可触发的panic等问题

已完成
缺陷
创建于  
2024-09-05 18:36

环境信息

openEuler-22.03 kernel-5.15.133.1 util-linux-2.37.2

问题信息

可触发的panic

Q1:-c, --output-width选项解析中的unwrap()导致的panic

[xubiang@BIIIANGPC easybox]$ column -c invalid
column: invalid columns argument: 'invalid'
[xubiang@BIIIANGPC easybox]$ echo $?
1

[xubiang@BIIIANGPC easybox]$ ./target/debug/easybox column -c invalid
thread 'main' panicked at src/oe/column/src/column_common.rs:206:41:
called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[xubiang@BIIIANGPC easybox]$ echo $?
101

Q2: -R, --table-right-H, --table-hide选项解析中的panic

[xubiang@BIIIANGPC easybox]$ column --table-right invalid --table ./tests/fixtures/column/table
column: undefined column name 'invalid'
[xubiang@BIIIANGPC easybox]$ echo $?
1

[xubiang@BIIIANGPC easybox]$ ./target/debug/easybox column --table-right invalid --table ./tests/fixtures/column/table
thread 'main' panicked at src/oe/column/src/lib_column.rs:831:13:
Column 'invalid' not found
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[xubiang@BIIIANGPC easybox]$ echo $?
101

Q3: -T, --table-truncate-W, --table-wrap选项解析逻辑错误导致的panic

[xubiang@BIIIANGPC easybox]$ column --table-wrap 2a --table ./tests/fixtures/column/table
column: undefined column name '2a'
[xubiang@BIIIANGPC easybox]$ column --table-truncate 2a --table ./tests/fixtures/column/table
column: undefined column name '2a'

[xubiang@BIIIANGPC easybox]$ ./target/debug/easybox column --table-wrap 2a --table ./tests/fixtures/column/table
thread 'main' panicked at src/oe/column/src/lib_column.rs:665:30:
attempt to divide by zero
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[xubiang@BIIIANGPC easybox]$ ./target/debug/easybox column --table-truncate 2a --table ./tests/fixtures/column/table
thread 'main' panicked at src/oe/column/src/lib_column.rs:583:30:
attempt to divide by zero
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Q4: file参数解析中的unwrap()导致的panic

[xubiang@BIIIANGPC ~]$ column f
column: f: No such file or directory
[xubiang@BIIIANGPC ~]$ echo $?
1

[xubiang@BIIIANGPC ~]$ easybox column f
thread 'main' panicked at src/oe/column/src/column_common.rs:508:70:
called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[xubiang@BIIIANGPC ~]$ echo $?
101

Q5: --tree--tree-id--tree-parent选项使用时的unwrap()导致的panic

[xubiang@BIIIANGPC ~]$ column --table --tree 1 ./tests/fixtures/column/table
column: options --tree-id and --tree-parent are required for tree formatting
[xubiang@BIIIANGPC ~]$ echo $?
1

[xubiang@BIIIANGPC ~]$ ./target/debug/easybox column --table --tree 1 ./tests/fixtures/column/table
thread 'main' panicked at src/oe/column/src/lib_column.rs:764:43:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[xubiang@BIIIANGPC ~]$ echo $?
101

Q6: -l, --table-columns-limit选项解析中的unwrap()导致的panic

[xubiang@BIIIANGPC easybox]$ column --table-columns-limit invalid
column: invalid columns limit argument: 'invalid'
[xubiang@BIIIANGPC easybox]$ echo $?
1

[xubiang@BIIIANGPC easybox]$ ./target/debug/easybox column --table-columns-limit invalid
thread 'main' panicked at src/oe/column/src/column_common.rs:183:41:
called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[xubiang@BIIIANGPC easybox]$ echo $?
101

其他问题

  • -m, --table-maxout选项在util-linux 2.37.2中不存在且程序未进行实现;
  • 未对-t, --table-x, --fillrows同时出现、-J, --json-x, --fillrows同时出现的情况进行处理;
  • --tree选项存在时未对--tree-id--tree-parent选项进行存在性检查;
  • 无法通过util-linux的--tree选项测试等。

评论 (1)

BIIIANG 创建了缺陷 9个月前
openeuler-ci-bot 添加了
 
sig/sig-memsafety
标签
9个月前
BIIIANG 通过合并 Pull Request !43: 修复column存在的可触发的panic等问题任务状态待办的 修改为已完成 9个月前

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(2)
5329419 openeuler ci bot 1632792936 7603128 biiiang 1640266292
1
https://gitee.com/openeuler/easybox.git
git@gitee.com:openeuler/easybox.git
openeuler
easybox
easybox

搜索帮助