Skip to content

CI Script Bug: JSON validation fails with bash parsing error #1887

@calliostro

Description

@calliostro

Bug Description

The CI script for JSON validation has a bash parsing error that causes it to fail with:

usage: python -m json.tool [-h] [--sort-keys] [--no-ensure-ascii] [--json-lines] [--indent INDENT | --tab | --no-indent | --compact] [infile] [outfile] 
python -m json.tool: error: argument infile: can't open '/home/runner/work/recipes-contrib/recipes-contrib/bash': [Errno 2] No such file or directory: '/home/runner/work/recipes-contrib/recipes-contrib/bash'

Root Cause

In the CI workflow, this line has incorrect quote escaping:

ERRORS=$(find * -name '*.json' | xargs -n1 -P0 bash -c 'ERR=$(cd / && python -mjson.tool '$(pwd)'/"$0" 2>&1 1> /dev/null) || echo \\n::error file="$0",line=`echo "${ERR#*: line }" | cut -d" " -f 1`::${ERR%%: line *}')

The '$(pwd)' part is incorrectly parsed, causing bash to be interpreted as a filename instead of a command.

Reproduction

This affects PR #1886 and potentially other PRs. All JSON files are valid when tested manually with python -m json.tool.

Expected Behavior

JSON validation should work correctly without parsing bash as a filename.

Suggested Fix

The quote escaping in the bash command needs to be corrected.

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