Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Unix: Native globbing cannot be bypassed when using splatting #24178

Copy link
Copy link
@mklement0

Description

@mklement0
Issue body actions

Prerequisites

Steps to reproduce

Note: This has been reported before, but not as a dedicated issue:

On Unix, barewords passed as arguments to external (native) programs are subject to globbing (filename expansion), if they contain * or ?, for compatibility with native Unix shells.

  • In direct invocation, the way to avoid this is to quote the bareword, e.g. '*'

  • However - and this constitutes the bug - when splatting, the globbing cannot be prevented:

# On Unix-like platforms.
/bin/echo @( '*' )

Note that using embedded quoting (e.g., @('"*"')) is not an option, because it becomes part of the argument.

Expected behavior

* should print verbatim.

Note:

  • The above assumes that '*' should not be treated like a bareword in the context of splatting, which in turn implies that you fundamentally cannot specify barewords that way, and would have to use something like @((Get-Item * -Name)) to manually perform the desired globbing.

  • This strikes me as an acceptable trade-off and much preferable to the alternative: defaulting to interpretation as barewords, with a yet-to-be-devised opt-out method.

Actual behavior

The names of the files and subdirectories in the current directory print, because native globbing was applied.

Error details

No response

Environment data

PowerShell 7.5.0-preview.3 on Unix-like platforms.

Visuals

No response

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    KeepOpenThe bot will ignore these and not auto-closeThe bot will ignore these and not auto-closeNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.WG-Interactive-Consolethe console experiencethe console experienceWG-NeedsReviewNeeds a review by the labeled Working GroupNeeds a review by the labeled Working Group

    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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.