openwall / openwall/john

possible problem in .pre-commit.sh

Open
#5,063 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

maintenance/cleanup
Dominant language
C
Stars
13.6k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

It looks like there might be a problem in .pre-commit.sh:

TXT_FILES=`git diff --cached --name-only | grep -E $TXT_FILE_PATTERN`
TXT_FILES="$TXT_FILES"`git diff --cached --name-only | grep -E ^doc/`

I guess the last line from original $TXT_FILES would be joined with the first line from appended git diff ...:

$ (T=`echo a; echo b`; T="$T"`echo c`; printf '%s\n' "$T")
a
bc

Fix might use $'\n' but it would not work on dash. OTOH there is grep -lU $'\x0D' already. So shebang should be changed to /bin/bash anyway.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect .pre-commit.sh and reproduce the staged filename handling with files matching the text pattern and files under doc/. Check the hook under the shells it is intended to support, including dash and bash. Done means the collected filenames remain correctly separated and the pre-commit check works without shell-specific breakage.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, shell
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.