Skip to content

POSIX xargs Apostrophe Failure Silently Erases Feature Detection #14

Description

@Madhumasa84

Summary

_detect_features_fast feeds a newline-separated file list into xargs grep without -d '\n' or -0. If any file in the target repository has an apostrophe or single quote in its path (e.g. src/don't_crash.js), xargs fails with unmatched single quote and outputs nothing. The recon step silently detects 0 features.

Root Cause

In openhack/deterministic_recon.py:182-190:

cmd = ["xargs", "grep", "-Fl", "--max-count=1", "--binary-files=without-match"]
proc = subprocess.run(cmd, input=file_list, capture_output=True, text=True, timeout=15)

POSIX xargs treats single quotes as quoting characters by default.

Reproduction

touch "don't_break.js"
# xargs grep fails with returncode=1, stderr="xargs: unmatched single quote", stdout=""

Impact

A single apostrophe anywhere in the target repository's filenames completely blacks out deterministic feature detection for all categories.

Proposed Fix

Pass -d '\n' to xargs:

cmd = ["xargs", "-d", "\n", "grep", "-Fl", "--max-count=1", "--binary-files=without-match"]

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