-
Notifications
You must be signed in to change notification settings - Fork 2.1k
first and take do the wrong thing for list<binary> input #7121
Copy link
Copy link
Closed
Labels
category:inconsistent-behaviorBehavior between different commands or types inconsistent/unexpectedBehavior between different commands or types inconsistent/unexpected
Milestone
Description
Describe the bug
take n currently works like this:
- Peek at the first value in the input (important: this can either be the first value in a list or a scalar value passed as input)
- If that first value is a
binary, return the first n bytes in thatbinary
This means that take cannot be used to get the first n binaries in a list<binary>. first is affected in much the same way.
How to reproduce
This returns the first byte of a binary:
〉0x[01 23] | take 1
Length: 1 (0x1) bytes | printable whitespace ascii_other non_ascii
00000000: 01
If we wrap the binary in a list, we get the exact same result:
〉[0x[01 23]] | take 1
Length: 1 (0x1) bytes | printable whitespace ascii_other non_ascii
00000000: 01
Expected behavior
[0x[01 23]] | take 1 should return 0x[01 23].
take and first should get the first binaries from a list<binary>, not the first bytes in the first element of the list.
Screenshots
No response
Configuration
| key | value |
|---|---|
| version | 0.71.1 |
| branch | main |
| commit_hash | 817eacc |
| build_os | linux-x86_64 |
| build_target | x86_64-unknown-linux-gnu |
| rust_version | rustc 1.63.0 (4b91a6ea7 2022-08-08) |
| rust_channel | 1.63.0-x86_64-unknown-linux-gnu |
| cargo_version | cargo 1.63.0 (fd9c4297c 2022-07-01) |
| pkg_version | 0.71.1 |
| build_time | 2022-11-11 22:41:27 -08:00 |
| build_rust_channel | debug |
| features | default, trash, which, zip |
| installed_plugins |
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
category:inconsistent-behaviorBehavior between different commands or types inconsistent/unexpectedBehavior between different commands or types inconsistent/unexpected