question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`ls` is not self-consistent

See original GitHub issue

Prerequisites

Steps to reproduce

I have a file .\o\abc [defg].pdf, then I try all commands below to ls it. The first char y/x represents that the corresponding command works or not, i.e. prints the file or nothing without any error.

y ls 'abc `[defg`].pdf' -Recurse
y ls 'abc `[defg`].pdf' -Recurse -File | ls
x ls (ls 'abc `[defg`].pdf' -Recurse).FullName
x ls "$((ls 'abc `[defg`].pdf' -Recurse).FullName)"
x ls (ls 'abc `[defg`].pdf' -Recurse -File).ToString()

Expected behavior

All commands above should works exactly the same way.

Actual behavior

Just as the first char y/x in each command line shows. Output of `ls` can't be recognized by `ls` itself when the output is not passed via pipeline. 

Error details

No response

Environment data

Name                           Value
----                           -----
PSVersion                      7.2.6
PSEdition                      Core
GitCommitId                    7.2.6
OS                             Microsoft Windows 10.0.19043
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0


### Visuals

_No response_

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jhoneillcommented, Sep 7, 2022

@mklement0 yes 18038 is only another example of escaped wildcards not being processed correctly, there seems to be independent code in multiple places making similar errors, so a fix for 18038 wouldn’t fix 17992 and vice versa.

As another example, on Windows dir | out-file -path 'files [Sept].txt' gives a “file does not exist”, but dir | out-file -path 'files `[Sept`].txt' will create a file with ` in the name, I think this is another distinct bit of code.

0reactions
jhoneillcommented, Sep 8, 2022

@mklement0 I brought this up at the cmdlet working group yesterday. Things are being looked at again, although we may get the same conclusion as before. The point you make in 9475 that Set-Content and Out-File work differently suggests “cmdlet thing which is relatively easy to fix”, rather than “provider minefield”

You’ve got the best list of related issues for this that I’ve see so far here https://github.com/PowerShell/PowerShell/issues/17106#issuecomment-1088755835

I want to make sure this points to that one 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

'ls' is not recognized as an internal or external command ...
I get this error when I try to glance at the files of my folder. cmd opened regularly(not as an admin).
Read more >
`ls` is not self-consistent · PowerShell/PowerShell@918bb8c
PowerShell · Code · Issues · Pull requests · Discussions · Actions · Projects · Security · Insights.
Read more >
`ls` is not self-consistent · PowerShell/PowerShell@97ab6bd
Usage · Workflow file.
Read more >
Linear Scaling Self Consistent Field Methods
In CP2K, Linear scaling ( LS ) methods are relatively new. Whereas LS is generally efficient with methods that require a minimal basis,...
Read more >
'ls' is not recognized as an internal or external ... - YouTube
In this video, we're going to show you how to fix ' ls ' not being recognized as an internal or external command,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found