Skip to content

fix-permissions script exits successfully on missing target, potentially masking errors #2691

@coderabbitai

Description

@coderabbitai

Context

The fix-permissions script at base-images/utils/fix-permissions currently logs an error but exits with status 0 when the target path doesn't exist (lines 17-21):

if ! [ -e "$1" ] ; then
  echo "ERROR: File or directory $1 does not exist." >&2
  # We still want to end successfully
  exit 0
fi

This behavior could mask configuration bugs (e.g., incorrect paths in Dockerfile) that would be better caught at build time.

Background

The script is a modified version of the upstream s2i/scl script:
https://github.com/sclorg/s2i-python-container/blob/master/3.13-minimal/root/usr/bin/fix-permissions

The rationale for this behavior in the upstream script is unclear.

Potential improvements

Consider one or more of the following:

  • Make the script fail loudly (exit 1) when the target doesn't exist
  • Make this behavior configurable via an environment flag (e.g., FAIL_ON_MISSING=true/false)
  • Ensure the error message is prominent enough to be noticed in build logs
  • Document the rationale for the current behavior if it should be preserved

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions