Skip to content

Schemantic error in verification no system-ruby packages installed Dockerfile #341

Description

@clushie

This line

# verify we have no "ruby" packages installed
! dpkg -l | grep -i ruby; \

won't work as expected. Because of the ! it will always succeed.

Shellcheck tracks this behavior with

! dpkg -l | grep -i ruby
^-- SC2251: This ! is not on a condition and skips errexit. Use `&& exit 1` instead, or make sure $? is checked.

I can't see a clean one-liner to solve this, I think the correct way is to rather run:

if dpkg -l | grep -i 'ruby'; then return 1; fi

also dpkg -l can list previously uninstalled packages, to verify a package is actually installed it would rather be | grep -iP '^ii.*ruby.*'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions