Git Product home page Git Product logo

Comments (4)

joe-lawrence avatar joe-lawrence commented on July 30, 2024

Hi @taotieren ,

I believe the check target was intended to invoke any static code analyzers (like shellcheck) during development and review. I'm not sure if that squares with Arch's notion of building a package, but perhaps it doesn't need to gate your distro's package build.

That said, thanks for the report. Let us know if you would like to take a crack at fixing them. Patches welcome :) A quick review of the report, my suggestions would be:

  1. Unreachable break
  break
  ^---^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

Yup, the preceding die function will end the script. The break is redundant.

  1. Globbing flag command line arguments
In kpatch-build/kpatch-build line 1346:
		"$TOOLSDIR"/create-diff-object $CDO_FLAGS "orig/$i" "patched/$i" "$KOBJFILE_NAME" \
                                               ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.
In kpatch-build/kpatch-build line 1432:
	"$TOOLSDIR"/create-klp-module $extra_flags "$TEMPDIR/patch/tmp.ko" "$TEMPDIR/patch/$MODNAME.ko" 2>&1 | logger 1
                                      ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

These two are the same problem and the shellcheck suggestion is wrong. We need the first exception documented here:
https://www.shellcheck.net/wiki/SC2086

Sometimes you want to split on spaces, like when building a command line:

options="-j 5 -B"
[[ $debug == "yes" ]] && options="$options -d"
make $options file

Just quoting this doesn't work. Instead, you should have used an array (bash, ksh, zsh):

options=(-j 5 -B) # ksh88: set -A options -- -j 5 -B
[[ $debug == "yes" ]] && options=("${options[@]}" -d)
make "${options[@]}" file
  1. Arithmetic syntax style
In kpatch-build/kpatch-build line 1416:
    MAKEVARS[$idx]=${MAKEVARS[$idx]/${KPATCH_CC_PREFIX}/}
             ^--^ SC2004 (style): $/${} is unnecessary on arithmetic variables.

I don't have a strong opinion on this one, but would follow shellcheck's suggestion here.

from kpatch.

taotieren avatar taotieren commented on July 30, 2024

Thanks for the answer, I will comment the check function in the AUR package.

from kpatch.

github-actions avatar github-actions commented on July 30, 2024

This issue has been open for 30 days with no activity and no assignee. It will be closed in 7 days unless a comment is added.

from kpatch.

github-actions avatar github-actions commented on July 30, 2024

This issue was closed because it was inactive for 7 days after being marked stale.

from kpatch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.