facebook / zstd

Zstandard - Fast real-time compression algorithm
http://www.zstd.net
Other
23.67k stars 2.1k forks source link

Version 1.5.5 A use case failed when executing the make test-cli-tests command #3641

Open simon28li opened 1 year ago

simon28li commented 1 year ago

Describe the bug The new test compress-file-to-dir-without-write- perm.sh in version 1.5.5 reported an error.

To Reproduce Steps to reproduce the behavior: ./run.py --zstd=../../programs/zstd --datagen=../datagen --preserve --verbose file-stat/compress-file-to-dir-without-write-perm.sh

[root@centos cli-tests]# ./run.py  --zstd=../../programs/zstd --datagen=../datagen --preserve --verbose file-stat/compress-file-to-dir-without-write-perm.sh
$ZSTD_SYMLINK_DIR='/home/stage/root/spack-stage-zstd-1.5.5-kiimc7qox4kxmdnu7vhabl4xx5to5myu/spack-src/tests/cli-tests/bin/symlinks'
$ZSTD_REPO_DIR='/home/stage/root/spack-stage-zstd-1.5.5-kiimc7qox4kxmdnu7vhabl4xx5to5myu/spack-src'
$DATAGEN_BIN='/home/stage/root/spack-stage-zstd-1.5.5-kiimc7qox4kxmdnu7vhabl4xx5to5myu/spack-src/tests/datagen'
$ZSTDGREP_BIN='/home/stage/root/spack-stage-zstd-1.5.5-kiimc7qox4kxmdnu7vhabl4xx5to5myu/spack-src/programs/zstdgrep'
$ZSTDLESS_BIN='/home/stage/root/spack-stage-zstd-1.5.5-kiimc7qox4kxmdnu7vhabl4xx5to5myu/spack-src/programs/zstdless'
$COMMON='/home/stage/root/spack-stage-zstd-1.5.5-kiimc7qox4kxmdnu7vhabl4xx5to5myu/spack-src/tests/cli-tests/common'
$PATH='/home/stage/root/spack-stage-zstd-1.5.5-kiimc7qox4kxmdnu7vhabl4xx5to5myu/spack-src/tests/cli-tests/bin:/home/spack/opt/spack/linux-centos8-aarch64/gcc-8.5.0/python-3.8.8-m3k3pvne56yo7wyd7a3bwf7mugupszik/bin:/home/spack/opt/spack/linux-centos8-aarch64/gcc-8.5.0/util-linux-uuid-2.36-gngqn5ianbhxkzusnsbqsm7rpxw7eskp/bin:/home/spack/opt/spack/linux-centos8-aarch64/gcc-8.5.0/sqlite-3.34.0-fm34wwryu7d5dez4etbua7thcx4uez66/bin:/home/spack/opt/spack/linux-centos8-aarch64/gcc-8.5.0/openssl-1.1.1j-6ukggdjrujsa67n7fgoxui2lywmdbb7s/bin:/home/spack/opt/spack/linux-centos8-aarch64/gcc-8.5.0/gettext-0.21-agpjbt6kp2vxpbm7cbc4kvk2shodfrb2/bin:/home/spack/opt/spack/linux-centos8-aarch64/gcc-8.5.0/tar-1.32-wzvl7zgvkhllfkmwuapr2ztyfvdgxo4c/bin:/home/spack/opt/spack/linux-centos8-aarch64/gcc-8.5.0/libxml2-2.9.10-p2zbio6leqamjhzvrktdymelul5u35tu/bin:/home/spack/opt/spack/linux-centos8-aarch64/gcc-8.5.0/xz-5.2.5-txmghn3bh35fg7lps5svisf37d6rq6d3/bin:/home/spack/opt/spack/linux-centos8-aarch64/gcc-8.5.0/libiconv-1.16-recpgbfshhsiqtcsz7xblullkfyppri5/bin:/home/spack/opt/spack/linux-centos8-aarch64/gcc-8.5.0/gdbm-1.18.1-ndulcsnnue4pjdtxj3bjiob42nlg6lyc/bin:/home/spack/opt/spack/linux-centos8-aarch64/gcc-8.5.0/readline-8.0-4wgwwetj7tua3jon2tjm3af3afclkc36/bin:/home/spack/opt/spack/linux-centos8-aarch64/gcc-8.5.0/ncurses-6.2-clr7wse7upcf7sq7ig5mhrf3goo2nher/bin:/home/spack/opt/spack/linux-centos8-aarch64/gcc-8.5.0/expat-2.2.10-qyaogchht4n46c3kafpo7yrd4m3mmozp/bin:/home/spack/opt/spack/linux-centos8-aarch64/gcc-8.5.0/bzip2-1.0.8-kgibgbpqrqctysed3vihxxj3lxq47zrg/bin:/home/spack/opt/spack/linux-centos8-aarch64/gcc-8.5.0/zstd-1.5.5-kiimc7qox4kxmdnu7vhabl4xx5to5myu/bin:/root/.cargo/bin:/home/spack/bin:/home/spack/opt/spack/linux-centos8-aarch64/gcc-8.5.0/environment-modules-5.0.0-okydb2jm42f372sjdoq33hs3jyq4wsbp/bin:/home/spack/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/home/spack/bin:/root/bin'
$LC_ALL='C'
FAIL: file-stat/compress-file-to-dir-without-write-perm.sh
PASS: file-stat/compress-file-to-dir-without-write-perm.sh.check_exit
Exit code matches!
FAIL: file-stat/compress-file-to-dir-without-write-perm.sh.check_stderr
stderr does not match!
> diff expected actual
25,26c25,42
< zstd: out/file.zst: Permission denied
< zstd: can't stat out/file.zst : Permission denied -- ignored
---
> Trace:FileStat: > UTIL_isRegularFile(out/file.zst)
> Trace:FileStat:  > UTIL_stat(-1, out/file.zst)
> Trace:FileStat:  < 1
> Trace:FileStat: < 1
> Trace:FileStat: > UTIL_getFileSize(file)
> Trace:FileStat:  > UTIL_stat(-1, file)
> Trace:FileStat:  < 1
> Trace:FileStat: < 65537
> Trace:FileStat: > UTIL_setFileStat(4, out/file.zst)
> Trace:FileStat:  > UTIL_stat(4, out/file.zst)
> Trace:FileStat:  < 1
> Trace:FileStat:  > UTIL_chmod(out/file.zst, 0644)
> Trace:FileStat:   > fchmod
> Trace:FileStat:   < 0
> Trace:FileStat:  < 0
> Trace:FileStat: < 0
> Trace:FileStat: > UTIL_utime(out/file.zst)
> Trace:FileStat: < 0

PASS: file-stat/compress-file-to-dir-without-write-perm.sh.check_stdout
stdout ignored!
----------------------------------------
FAIL: file-stat/compress-file-to-dir-without-write-perm.sh
FAILED 1 / 1 tests!

Expected behavior

All test cases can be successful.

Screenshots and charts

Desktop (please complete the following information):

Additional context

felixhandte commented 1 year ago

Oh I see. You're running this test as root. This test attempts to create an unwritable directory (here). But root can write to it even with 000 permissions.

I'm not sure there's an easy patch to the test to address this case...

@terrelln, maybe we want to add support for precondition checks to the cli-tests, so that we can have tests that are skipped when they aren't valid in the calling environment.