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

[DEVEL] setup-testdb invalid function syntax, mktemp: too few X's in template #16179

Open
petermetz opened this issue Jan 31, 2025 · 0 comments · May be fixed by #16181
Open

[DEVEL] setup-testdb invalid function syntax, mktemp: too few X's in template #16179

petermetz opened this issue Jan 31, 2025 · 0 comments · May be fixed by #16181

Comments

@petermetz
Copy link

Description

The make setup-testdb script is broken on Linux. It fails with the error pasted below when I try to run it:

$ make setup-testdb
./core/scripts/setup_testdb.sh
./core/scripts/setup_testdb.sh: 3: function: not found
Error: 
make: *** [GNUmakefile:137: setup-testdb] Error 1

Your Environment

$ bash --version
GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ mktemp --version
mktemp (GNU coreutils) 8.32
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Jim Meyering and Eric Blake.
$ go version
go version go1.23.4 linux/amd64
$ docker info
Client: Docker Engine - Community
 Version:    27.5.0
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.19.3
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.32.4
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 17
  Running: 1
  Paused: 0
  Stopped: 16
 Images: 52
 Server Version: 27.5.0
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 nvidia runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: bcc810d6b9066471b0b6fa75f557a15a1cbf31bb
 runc version: v1.2.4-0-g6c52b3f
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.9.3-76060903-generic
 Operating System: Pop!_OS 22.04 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 16
 Total Memory: 46.37GiB
 Name: zend
 ID: 8293dc4a-8497-4fd7-9ecd-0d5907cb2af3
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Username: [email protected]
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
$ cat /etc/os-release
NAME="Pop!_OS"
VERSION="22.04 LTS"
ID=pop
ID_LIKE="ubuntu debian"
PRETTY_NAME="Pop!_OS 22.04 LTS"
VERSION_ID="22.04"
HOME_URL="https://pop.system76.com"
SUPPORT_URL="https://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=jammy
UBUNTU_CODENAME=jammy
LOGO=distributor-logo-pop-os
$ uname -a
Linux myhostname 6.9.3-76060903-generic #202405300957~1736980680~22.04~44ea8a9 SMP PREEMPT_DYNAMIC Thu J x86_64 x86_64 x86_64 GNU/Linux
$ npx systeminformation info
Need to install the following packages:
[email protected]
Ok to proceed? (y) y
┌─────────────────────────────────────────────────────────────────────────────────────────┐
│  SYSTEMINFORMATION                                                     Version: 5.25.11 │
└─────────────────────────────────────────────────────────────────────────────────────────┘

Operating System:
──────────────────────────────────────────────────────────────────────────────────────────
Platform         : linux
Distro           : Pop
Release          : 22.04 LTS
Codename         : jammy
Kernel           : 6.9.3-76060903-generic
Arch             : x64
Hostname         : zend
Codepage         : UTF-8
Build            : 

System:
──────────────────────────────────────────────────────────────────────────────────────────
Manufacturer     : ASUSTeK COMPUTER INC.
Model            : ROG Zephyrus G14 GA402XV_GA402XV
Version          : 1.0
Virtual          : 

CPU:
──────────────────────────────────────────────────────────────────────────────────────────
Manufacturer     : AMD
Brand            : Ryzen 9 7940HS w/ Radeon 780M Graphics
Family           : 25
Model            : 116
Stepping         : 1
Speed            : 3.3
Cores            : 16
PhysicalCores    : 8
PerformanceCores : 8
EfficiencyCores  : 
Processors       : 1
Socket           : 

Basic Information

There are two issues with the script in my environment at present:

  1. The function declaration is not valid syntax for sh (which is explicitly specified to be the shell for the script on the first line)
  2. Once the function declaration syntax is fixed, then the mktemp call crashes because of invalid parameters (assuming the version of it on Mac is having a looser validation and that's why this has gone unnoticed)
  3. After fixing the mktemp template by adding some X characters to it, it than crashes with ./core/scripts/setup_testdb.sh: 58: pushd: not found which is allegedly happening because the script declares that it wants to run in sh instead of bash. So finally, updating the hashbang to use bash solves all the issues. Happy days!

Sources:

Steps to Reproduce

Execute the steps exactly as specified in the README's ## Development --> ### Running tests section

Additional Information

The fixes to all three issues are relatively easy, here's the diff that I needed to make it work on my machine:

Image

petermetz added a commit to petermetz/chainlink that referenced this issue Jan 31, 2025
…template

Address the 3 problems with the setup_testdb.sh script on Linux
1. Invalid function declaration syntax
2. Invalid template syntax for mktemp (missing X characters)
3. Usage of `bash`-only commands in a script that wants to run in `sh` (pushd)

Fixes smartcontractkit#16179

Signed-off-by: Peter Somogyvari <[email protected]>
petermetz added a commit to petermetz/chainlink that referenced this issue Jan 31, 2025
…template

Address the 3 problems with the setup_testdb.sh script on Linux
1. Invalid function declaration syntax
2. Invalid template syntax for mktemp (missing X characters)
3. Usage of `bash`-only commands in a script that wants to run in `sh` (pushd)

Fixes smartcontractkit#16179

Signed-off-by: Peter Somogyvari <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant