Skip to content

Unusual parsing of equal signs followed by a char as part of strings in a dictionary without spaces #9879

Closed

Description

Describe the bug

The ast parsing somehow often thinks that a = followed by a char in a string of a dictionary, which dosnt contain spaces, makes the entire dictionary a command.

How to reproduce

These examples produce Error: nu::parser::unknown_command:

  • {"":"=a"}
  • {"=a":""}
  • {"foo":"=foo"}
  • {"":"=a","":""}

These similar examples parse correctly:

  • {"":""}
  • {"":"="}
  • {"": "="}
  • {"foo":"foo"}
  • {"":" ="}
  • {"":"=a", "":""}
  • {"":"=a","": ""}
  • {"":"=a","":" "}
  • {"":"foobar="}

Expected behavior

all of those should be dictionaries

Screenshots

No response

Configuration

key value
version 0.83.0
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.70.0 (90c541806 2023-05-31) (built from a source tarball)
cargo_version cargo 1.70.0
build_time 1980-01-01 00:00:00 +00:00
build_rust_channel release
allocator standard
features default, sqlite, trash, which, zip
installed_plugins

(from nupkgs)
(nu0.82.0 is also affected)

Additional context

No response

Activity

  1. ghost added
    status:needs-triage
    on Jul 31, 2023
  2. added
    category:bug
    A:parser
    on Jul 31, 2023
  3. removed
    status:needs-triage
    on Aug 1, 2023
  4. sophiajt commented on Aug 9, 2023

    @sophiajt
    Contributor

    Looking more closely, the ones that reuse the field name would continue to be errors.

    I'm not able to reproduce errors for some of these.

    For example:

    > '{"":" ="}' | from nuon
    ╭──┬────╮
    │  │  = │
    ╰──┴────╯
    

    and

    '{"":""}' | from nuon
    ╭──┬──╮
    │  │  │
    ╰──┴──╯
    

    Can you try your examples again against the latest version of nushell from main and see how many still reproduce errors?

  5. sophiajt commented on Aug 9, 2023

    @sophiajt
    Contributor

    Updated the description.

  6. hugosenari commented on Jun 21, 2024

    @hugosenari

    Tested with 0.94.1
    Still failing

    And ["=a"] fails but ["= a"] and "=a" don't

    Maybe this is a duplacation of #5806 #6401 and related to #4890 #6853

  7. added this to the v0.99.0 milestone on Oct 11, 2024
  8. added a commit that references this issue on Oct 11, 2024
    df0a174
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

    A:parsercategory:bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions