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

use globbing instead of find #409

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dennisse
Copy link

linuxserver.io


  • I have read the contributing guideline and understand that I have made the correct modifications

Description:

Use bash globbing instead of find.

find doesn't seem to recognize any of the files in my /dev/dri-folder as character special files. Bash's [[ -c file ]] does.

root@061899068dcd:/dev/dri# find /dev/dri -type c
root@061899068dcd:/dev/dri# for f in /dev/dri/*; do [[ -c "$f" ]] && echo "$f is a special character file"; done
/dev/dri/card0 is a special character file
/dev/dri/renderD128 is a special character file

Also, using globbing should be a little bit safer. It's hard to loop over files from another program. So hard it's one of the top bash pitfalls. Using globbing is simpler and cleaner.

Benefits of this PR and context:

A little bit cleaner code, that also works on my system.

How Has This Been Tested?

I ran the script.

It's not a big change :)

podman version 5.2.3, on Debian Testing. Image id 88b59fbfee1f

Source / References:

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this pull request! Be sure to follow the pull request template!

@aptalca
Copy link
Member

aptalca commented Oct 10, 2024

It's not a big change :)

It is when you consider how many images we publish use the same code. You should look into why in your environment find doesn't find them as we can't reproduce it.

@LinuxServer-CI
Copy link
Contributor

I am a bot, here are the test results for this PR:
https://ci-tests.linuxserver.io/lspipepr/plex/1.41.0.8994-f2c27da23-pkg-31d1465e-dev-24897def28c458d7b4e8a87b949c6b31f603e1f0-pr-409/index.html
https://ci-tests.linuxserver.io/lspipepr/plex/1.41.0.8994-f2c27da23-pkg-31d1465e-dev-24897def28c458d7b4e8a87b949c6b31f603e1f0-pr-409/shellcheck-result.xml

Tag Passed
amd64-1.41.0.8994-f2c27da23-pkg-31d1465e-dev-24897def28c458d7b4e8a87b949c6b31f603e1f0-pr-409
arm64v8-1.41.0.8994-f2c27da23-pkg-31d1465e-dev-24897def28c458d7b4e8a87b949c6b31f603e1f0-pr-409

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

Successfully merging this pull request may close these issues.

3 participants