Skip to content

An unquoted path with a space, or any stray argument, is silently dropped: -o my icons writes to ./my and exits 0 #167

Open

Description

@matt-edmondson

What's wrong

Arguments (IconHelper/Arguments.cs) declares only [Option] properties and no [Value] property. CommandLineParser 2.9.1, called through Parser.Default.ParseArguments<Arguments>(args) in IconHelper/IconHelper.cs:36, silently discards any token that no option or value binds. It raises no parse error for it. An extra token therefore never reaches Validate.

Repro (executed, dotnet 10, main @ f640ca4)

Command Actual Expected
iconhelper -i w -o my icons -c red Done. 1 file(s) written., exit 0, output in ./my; icons is dropped exit 1, error naming the unexpected argument icons
iconhelper -i w -o x -s 64 32 exit 0 at size 64; 32 is dropped exit 1
iconhelper -i w -o x extra exit 0 exit 1

Why it matters

Forgetting to quote a path that contains a space is the most common shell mistake. Here it sends the icons to a different folder, which may already exist and hold other files, and reports success. A script then picks up nothing from the folder it expected. The tool already treats silent misconfiguration as a failure with exit 1 (#125, #148), and this case slips past all of that.

Suggested fix

Bind the leftovers and reject them in Validate:

[Value(0, Hidden = true)]
public IEnumerable<string> Unbound { get; set; } = [];

When Unbound isn't empty, fail with exit 1 and a message such as Unexpected argument(s): icons. Quote paths that contain spaces.

Acceptance criteria

  • Any positional or leftover token makes the run exit 1, before any output folder is created.
  • The error message names the stray token or tokens and points at quoting.
  • ArgumentsTests has a case for -o my icons and one for a repeated value (-s 64 32).

Activity

  1. matt-edmondson commented on Nov 6, 2026

    @matt-edmondson
    ContributorAuthor

    Triage


    Generated by Claude Code

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

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions