From 8591d99c1b85852080519fec454c368314e48832 Mon Sep 17 00:00:00 2001 From: Emil Suleymanov Date: Wed, 9 Nov 2022 14:43:27 +0100 Subject: [PATCH] cp: make `--preserve` use the defaults when empty --- src/uu/cp/src/cp.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 9fbc727dd..39823ea45 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -745,7 +745,12 @@ impl Options { attributes.push(Attribute::from_str(attribute_str)?); } } - attributes + // `--preserve` case, use the defaults + if attributes.is_empty() { + DEFAULT_ATTRIBUTES.to_vec() + } else { + attributes + } } } } else if matches.get_flag(options::ARCHIVE) {