Skip to content

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

@clushie

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.*'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions