Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why use "which" to check existed file? #358

Open
wzhen12 opened this issue Aug 20, 2024 · 2 comments
Open

Why use "which" to check existed file? #358

wzhen12 opened this issue Aug 20, 2024 · 2 comments

Comments

@wzhen12
Copy link
Contributor

wzhen12 commented Aug 20, 2024

./runtests -f sdsi/tests
==> /tmp/stderr <==
|0816_074419.075|ERROR| common.sh:155:block_test() - block_test() is called by common.sh:571:check_fms_list()|
|0816_074419.077|ERROR| common.sh:156:block_test() - Result ====BLOCK==== : No family model stepping list file:sdsi_fms_list found|

The function of check_fms_list is in common.sh for checking existed files.
$fms_list_file is the existed file.
"
list_file=$(which "$fms_list_file" 2>/dev/null)
[[ -n "$list_file" ]] || block_test "No family model stepping list file:$fms_list_file found"
"
Why use "which" to check the existed file of "$fms_list_file"?
It should get the not right results.

@qwang59
Copy link
Contributor

qwang59 commented Aug 20, 2024

The sdsi_fms_list file should have its execute permissions, which has been addressed in the recent patch.

@wzhen12
Copy link
Contributor Author

wzhen12 commented Sep 2, 2024

You mean that we can copy sdsi_fms_list to such as /usr/bin or set the local path to $PATH?
If not, the command of "which" will not find sdsi_fms_list in local path.
The command of "which" only find the related command with execute attribute in /usr/bin or $PATH.

Or we will not use the command of "which" to check the local file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants