From e8fc7b90f0a87302b12c73009950c7f9af473e92 Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Mon, 29 Jun 2026 22:50:52 +0900 Subject: [PATCH] ls: fix QUOTING_STYLE=invalid ls 2>/dev/full SIGABRT --- src/uu/ls/src/config.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/uu/ls/src/config.rs b/src/uu/ls/src/config.rs index fc788e85425..5db65fed7ff 100644 --- a/src/uu/ls/src/config.rs +++ b/src/uu/ls/src/config.rs @@ -9,7 +9,7 @@ use std::{ borrow::Cow, ffi::{OsStr, OsString}, - io::{IsTerminal, stdout}, + io::{self, IsTerminal, Write as _, stdout}, num::IntErrorKind, }; @@ -574,12 +574,14 @@ fn extract_quoting_style( } else { // If set, the QUOTING_STYLE environment variable specifies a default style. if let Ok(style) = std::env::var("QUOTING_STYLE") { - match match_quoting_style_name(style.as_str(), show_control) { - Some(pair) => return pair, - None => eprintln!( + if let Some(pair) = match_quoting_style_name(style.as_str(), show_control) { + return pair; + } else { + let _ = writeln!( + io::stderr(), "{}", translate!("ls-invalid-quoting-style", "program" => std::env::args().next().unwrap_or_else(|| "ls".to_string()), "style" => style.clone()) - ), + ); } }