Compare commits

...
Sign in to create a new pull request.

2 commits

Author SHA1 Message Date
Jesus Checa Hidalgo
a2b93f39c8 ld-alternative: Update check on alternatives/ld symlink
Before LLD 19 /usr/bin/ld.lld was a file, and now it's a symlink to /usr/bin/lld.
Hence, /etc/alternative/ld symlink now resolves to /usr/bin/lld,
breaking our check and raising false positives.

Updating the expression to match "lld" only fixes the issue.
2024-10-14 10:06:13 +02:00
Jesus Checa Hidalgo
a9a9883a60 Shell static analysis
Add pre-commit hook for static analysis on shell scripts (shellcheck)
Fixed issues flagged by shellcheck.
2024-08-05 09:34:31 +02:00
2 changed files with 11 additions and 4 deletions

View file

@ -12,3 +12,10 @@ repos:
rev: 1.32.2
hooks:
- id: tmt-lint
- repo: https://github.com/koalaman/shellcheck-precommit
rev: v0.10.0
hooks:
- id: shellcheck
require_serial: true # Podman has trouble running concurrently
args: ["--exclude=SC1091"] # Ignore "Not following" sourced scripts

View file

@ -1,11 +1,11 @@
#!/bin/sh -eux
#!/bin/bash -eux
# This test assumes lld is already installed.
function verify_ld_bfd {
verify_ld_bfd (){
# Verify that /usr/bin/ld points to ld.bfd.
ls -l /etc/alternatives/ld | grep ld.bfd
[[ $(readlink -f /etc/alternatives/ld) == *"ld.bfd" ]]
# Run ld and verify it invokes ld.bfd
/usr/bin/ld --version | grep 'GNU ld'
@ -19,7 +19,7 @@ verify_ld_bfd
update-alternatives --set ld /usr/bin/ld.lld
# Verify that /usr/bin/ld points to lld
ls -l /etc/alternatives/ld | grep ld.lld
[[ $(readlink -f /etc/alternatives/ld) == *"lld" ]]
# Run ld and verify it invokes lld
/usr/bin/ld --version | grep 'LLD'