Fix a guard that prevents a comparison with a non-digit to fail the
script.
Details
Details
touch ${entropy_dir}/saved-entropy. # SKIP touch ${entropy_dir}/saved-entropyx # SKIP touch ${entropy_dir}/saved-entropy.\* # THE CURRENT CHECK (SKIP) touch ${entropy_dir}/saved-entropy.0 # PASS touch ${entropy_dir}/saved-entropy.01 # PASS touch ${entropy_dir}/saved-entropy.1a # SKIP touch ${entropy_dir}/saved-entropy.9 # PASS touch ${entropy_dir}/saved-entropy.a # SKIP
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped - Build Status
Buildable 60635 Build 57519: arc lint + arc unit
Event Timeline
Comment Actions
While studying for D47502, I stumbled upon the save-entropy.sh script. This part of the script seems wrong to me.
What I can infer is that this tries to guard against failing a comparison with a non-digit on the next line, by checking that whatever comes after saved-entropy. is a digit. Currently it is only checking for saved-entropy.\* (a literal *).
I don't know whom to ask for review. This change is low-priority, as it only verifies correctness, only root can write to the $entropy_dir.
Thank you!
libexec/save-entropy/save-entropy.sh | ||
---|---|---|
72 | Your suggestion would fail if there is a file named saved-entropy.1a, for example ([: 1a: bad number). |
libexec/save-entropy/save-entropy.sh | ||
---|---|---|
72 | You'll have to weigh how likely that is to happen up against the cost of the added complexity required to deal with the situation. |