From d6a0b3c9206201e865c6f2b3c5b304fb266df104 Mon Sep 17 00:00:00 2001 From: Zachary Dremann Date: Sun, 30 Jan 2022 17:15:29 -0500 Subject: [PATCH 1/2] Allow echo with escapes to work with \0 Testing with gecho on macos outputs a nul character for a \0 --- src/uu/echo/src/echo.rs | 5 +---- tests/by-util/test_echo.rs | 12 ++++++++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/uu/echo/src/echo.rs b/src/uu/echo/src/echo.rs index 35606be71..1cb63fe93 100644 --- a/src/uu/echo/src/echo.rs +++ b/src/uu/echo/src/echo.rs @@ -88,10 +88,7 @@ fn print_escaped(input: &str, mut output: impl Write) -> io::Result { start = 0; next }), - '0' => parse_code(&mut iter, 8, 3, 3).unwrap_or_else(|| { - start = 0; - next - }), + '0' => parse_code(&mut iter, 8, 3, 3).unwrap_or('\0'), _ => { start = 0; next diff --git a/tests/by-util/test_echo.rs b/tests/by-util/test_echo.rs index 09ed9658f..401e16706 100644 --- a/tests/by-util/test_echo.rs +++ b/tests/by-util/test_echo.rs @@ -138,11 +138,19 @@ fn test_escape_short_octal() { } #[test] -fn test_escape_no_octal() { +fn test_escape_nul() { new_ucmd!() .args(&["-e", "foo\\0 bar"]) .succeeds() - .stdout_only("foo\\0 bar\n"); + .stdout_only("foo\0 bar\n"); +} + +#[test] +fn test_escape_octal_invalid_digit() { + new_ucmd!() + .args(&["-e", "foo\\08 bar"]) + .succeeds() + .stdout_only("foo\u{0}8 bar\n"); } #[test] From 864b09c9b8ea419a47b39e42aea1a4c07639a865 Mon Sep 17 00:00:00 2001 From: Tillmann Rendel Date: Tue, 1 Feb 2022 19:47:49 +0100 Subject: [PATCH 2/2] vscode: only recommend rust-analyzer (#3020) Previously, both RLS and Rust-Analyzer were recommended, now we just recommend RA. --- .vscode/extensions.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 46b105d37..30b38bfa9 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,10 +1,8 @@ +// spell-checker:ignore (misc) matklad +// see for the documentation about the extensions.json format { - // spell-checker:ignore (misc) matklad - // see for the documentation about the extensions.json format "recommendations": [ // Rust language support. - "rust-lang.rust", - // Provides support for rust-analyzer: novel LSP server for the Rust programming language. "matklad.rust-analyzer", // `cspell` spell-checker support "streetsidesoftware.code-spell-checker"