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

Libcperciva import #374

Merged
merged 3 commits into from
Sep 20, 2023
Merged

Libcperciva import #374

merged 3 commits into from
Sep 20, 2023

Conversation

gperciva
Copy link
Member

No description provided.

Reported by:	cppcheck-2.11
There were two problems with ${s_count} and ${s_count_str}.

1) ${s_count} and ${s_count_str} are both misnamed: they count the
   checks, not the scenarios.

   FIX 1/3: both variables should be prefixed with with "c_", not "s_".

2) There was an off-by-one error with ${c_count} and ${c_count_str}.
   After running setup_check_variables for the Nth time, ${c_count}
   is N, while ${c_count_str} is a zero-padded string containing N-1.

   For example, after the first time setup_check_variables() is run, we have:
       c_exitfile=tests-output/01-example-00.exit
       c_count_str=00
       c_count=1

   FIX 2/3: ${c_count} should be renamed to ${c_count_next}.

   When 15-readpass-file.sh used ${c_count_new} for the stdout file, we
   ended up with:
       output=tests-output/01-example-1.stdout
   which corresponded to 15-readpass-file-00.exit, which is wrong.

   FIX 3/3: ${c_count_new} should not be used by anything other than
   setup_check_variables(); everything else should use ${c_count_str}.
   This should have included when we added it in:

    2023-06-29 scripts: misc fixes
    ed4c19ad5a55963e69792209a1eafc12f14c068d
This should only have one level of indentation.

Check with:
    git grep -A1 -h "#define" -- "*.h" "*.c" | ggrep -P "^\t\t"

There are two instances remaining: getopt.h and readpass.c.  Keep those as is.

(The "ggrep" is not a typo; this requires gnu grep to find the tabs.)
@gperciva
Copy link
Member Author

This does not include optional_mutex because scrypt doesn't need it.

@cperciva cperciva merged commit 3d75191 into master Sep 20, 2023
@gperciva gperciva deleted the libcperciva-import branch September 20, 2023 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants