nextcloud / nextcloud/docker

"In POSIX sh, 'local' is undefined." ShellCheck problem in the entrypoint scripts

Open
#2,428 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage bug good first issue image priority: low
Dominant language
Shell
Stars
7.4k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

In the run_path function and a few other places in the entrypoint.sh shell scripts, the following errors are found by the ShellCheck linter:

In 31/apache/entrypoint.sh line 24:
    local hook_folder_path="/docker-entrypoint-hooks.d/$1"
    ^--------------------^ SC3043 (warning): In POSIX sh, 'local' is undefined.


In 31/apache/entrypoint.sh line 25:
    local return_code=0
    ^---------------^ SC3043 (warning): In POSIX sh, 'local' is undefined.

Although the script does function correctly in this state, we probably should:

  • Drop the local command usage.
  • Change the shell interpreter to bash.
  • Suppress the warning using ShellCheck directives and call it a day.

References

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

Start with the linked 31/apache/entrypoint.sh run_path function, then inspect the other entrypoint.sh scripts for the same ShellCheck SC3043 warning. Run ShellCheck against the affected scripts and make the handling of local consistent; done means the warnings are resolved or explicitly suppressed without changing script behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.