[GH-ISSUE #937] [BUG] generate_secrets.sh does not run when default shell is dash #344

Closed
opened 2026-02-27 08:16:47 +03:00 by kerem · 2 comments
Owner

Originally created by @ChevySSinSD on GitHub (Jul 23, 2024).
Original GitHub issue: https://github.com/lldap/lldap/issues/937

Describe the bug
The generate_secrets.sh does not run in recent Debian-based distributions, generating this error:
./generate_secrets.sh: 3: Syntax error: "(" unexpected

Additional Context
The shebang on line 1 calls the default shell: #! /bin/sh

However, the function definition on line 3 uses the bash convention, which is not compatible with dash, the default shell for recent Debian-based linux distributions (and others):
function print_random () {

I have modified generate_secrets.sh in two separate ways, both solutions work on Debian:

  • Change the shebang on line 1 to #! /bin/bash
  • Change line 3 to print_random () { (i.e., remove "function" in front of the function definition). Reference: Function Definition Command.
Originally created by @ChevySSinSD on GitHub (Jul 23, 2024). Original GitHub issue: https://github.com/lldap/lldap/issues/937 **Describe the bug** The generate_secrets.sh does not run in recent Debian-based distributions, generating this error: `./generate_secrets.sh: 3: Syntax error: "(" unexpected` **Additional Context** The shebang on line 1 calls the default shell: `#! /bin/sh` However, the function definition on line 3 uses the bash convention, which is not compatible with dash, the default shell for recent Debian-based linux distributions (and others): `function print_random () {` I have modified generate_secrets.sh in two separate ways, both solutions work on Debian: - Change the shebang on line 1 to `#! /bin/bash` - Change line 3 to `print_random () {` (i.e., remove "function" in front of the function definition). Reference: [Function Definition Command](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_05).
kerem 2026-02-27 08:16:47 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@nitnelave commented on GitHub (Jul 23, 2024):

Sounds good! Can you make a PR with change number 2? Let's keep it POSIX and as compatible as possible.

<!-- gh-comment-id:2244214313 --> @nitnelave commented on GitHub (Jul 23, 2024): Sounds good! Can you make a PR with change number 2? Let's keep it POSIX and as compatible as possible.
Author
Owner

@ChevySSinSD commented on GitHub (Jul 23, 2024):

Will do

<!-- gh-comment-id:2245364526 --> @ChevySSinSD commented on GitHub (Jul 23, 2024): Will do
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/lldap-lldap#344
No description provided.