Bug 2312 - [Anolis OS 8.6][bzip2]bzegrep -r递归查找不符合预期,只能搜索到普通文件中匹配的内容,不能查找到.bz2”压缩包中匹配的内容
Summary: [Anolis OS 8.6][bzip2]bzegrep -r递归查找不符合预期,只能搜索到普通文件中匹配的内容,不能查找到.bz2”压缩包中匹配的内容
Status: NEW
Alias: None
Product: Anolis OS 8
Classification: Anolis OS
Component: BaseOS Packages (show other bugs) BaseOS Packages
Version: 8.6
Hardware: All Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: Jacob
QA Contact: shuming
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-29 11:32 UTC by wangpingping
Modified: 2022-09-29 11:34 UTC (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description wangpingping alibaba_cloud_group 2022-09-29 11:32:57 UTC
[缺陷描述]:
bzip2包中的bzegrep和bzfgrep中 -r参数不符合预期,bzegrep -r不能搜索.bz2中匹配的内容,只能搜索到普通文件中匹配的内容

具体现象如下:
在bzegrep_test目录下,创建2个目录dir1,dir2,目录下各有包含hello\nWORLD的test1.txt.bz2和包含hello\nchina的test2.txt.bz2;
(1)递归搜索,提示是目录,搜索不到bz2文件中匹配的内容
# bzegrep -r 'hello' ./
bzip2: Input file ./ is a directory.

具体步骤:
# mkdir bzegrep_test
# cd bzegrep_test/
# echo -e "hello\nWORLD" >test1.txt
# echo -e "hello\nchina" >test2.txt
# bzip2 test1.txt test2.txt
# ls -lR
.:
total 8
drwxr-xr-x 2 root root 4096 Sep 29 10:53 dir1
drwxr-xr-x 2 root root 4096 Sep 29 10:53 dir2

./dir1:
total 4
-rw-r--r-- 1 root root 51 Sep 29 10:51 test1.txt.bz2

./dir2:
total 4
-rw-r--r-- 1 root root 47 Sep 29 10:52 test2.txt.bz2
# bzegrep -r 'hello' ./
bzip2: Input file ./ is a directory.

(2)递归搜索,在dir1目录下新增一个普通aaa.txt文件,只能搜索到普通文件中匹配的内容,bz2压缩包中匹配的内容搜索不到;
# bzegrep -r 'hello' ./
bzip2: Input file ./ is a directory.
dir1/aaa.txt:hello

具体步骤:
# cd dir1/
# echo -e "hello\nzhongguo" >aaa.txt
# ls -lR
.:
total 8
drwxr-xr-x 2 root root 4096 Sep 29 11:19 dir1
drwxr-xr-x 2 root root 4096 Sep 29 10:53 dir2

./dir1:
total 8
-rw-r--r-- 1 root root 15 Sep 29 11:19 aaa.txt
-rw-r--r-- 1 root root 51 Sep 29 10:51 test1.txt.bz2

./dir2:
total 4
-rw-r--r-- 1 root root 47 Sep 29 10:52 test2.txt.bz2
# bzegrep -r 'hello' ./
bzip2: Input file ./ is a directory.
dir1/aaa.txt:hello

[重现步骤]:
# mkdir bzegrep_test 
# cd bzegrep_test/
# mkdir dir1 dir2
# echo -e "hello\nWORLD" >test1.txt
# echo -e "hello\nchina" >test2.txt
# bzip2 test1.txt test2.txt
# mv test1.txt.bz2 dir1
# mv test2.txt.bz2 dir2
# cd dir1
# echo -e "hello\nzhongguo" >aaa.txt
# bzegrep -r 'hello' ./

[测试环境]
内核:4.19.91-26.1.an8.x86_64

# cat /etc/os-release
NAME="Anolis OS"
VERSION="8.6"
ID="anolis"
ID_LIKE="rhel fedora centos"
VERSION_ID="8.6"
PLATFORM_ID="platform:an8"
PRETTY_NAME="Anolis OS 8.6"
ANSI_COLOR="0;31"
HOME_URL="https://openanolis.cn/"

CPU信息:
# lscpu
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              2
On-line CPU(s) list: 0,1
Thread(s) per core:  2
Core(s) per socket:  1
Socket(s):           1
NUMA node(s):        1
Vendor ID:           GenuineIntel
BIOS Vendor ID:      Alibaba Cloud
CPU family:          6
Model:               106
Model name:          Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
BIOS Model name:     pc-i440fx-2.1
Stepping:            6
CPU MHz:             2699.998
BogoMIPS:            5399.99
Hypervisor vendor:   KVM
Virtualization type: full
L1d cache:           48K
L1i cache:           32K
L2 cache:            1280K
L3 cache:            49152K
NUMA node0 CPU(s):   0,1
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid tsc_known_freq pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single ibrs_enhanced fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves wbnoinvd arat avx512vbmi pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq rdpid fsrm arch_capabilities

内存信息:
# free -h
              total        used        free      shared  buff/cache   available
Mem:          7.4Gi       302Mi       5.9Gi       0.0Ki       1.2Gi       6.8Gi
Swap:            0B          0B          0B


[期望结果]:
bzegrep -r和bzfgrep -r参数可以递归搜索到bz2压缩包中匹配的内容

[实际结果]:
bzegrep -r和bzfgrep -r参数不能递归搜索到bz2压缩包中匹配的内容,只能搜索到普通文件中匹配的内容