mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
baseNM: protect names against argv[0] (#11373)
This commit is contained in:
@@ -16,5 +16,5 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
}
|
||||
|
||||
pub fn uu_app() -> Command {
|
||||
base_common::base_app(translate!("base32-about"), translate!("base32-usage"))
|
||||
base_common::base_app(translate!("base32-about"), translate!("base32-usage")).name("base32")
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ pub fn parse_base_cmd_args(args: impl uucore::Args, command: Command) -> UResult
|
||||
}
|
||||
|
||||
pub fn base_app(about: String, usage: String) -> Command {
|
||||
let cmd = Command::new(uucore::util_name())
|
||||
let cmd = Command::new("")
|
||||
.version(uucore::crate_version!())
|
||||
.about(about)
|
||||
.override_usage(format_usage(&usage))
|
||||
|
||||
@@ -16,5 +16,5 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
}
|
||||
|
||||
pub fn uu_app() -> Command {
|
||||
base_common::base_app(translate!("base64-about"), translate!("base64-usage"))
|
||||
base_common::base_app(translate!("base64-about"), translate!("base64-usage")).name("base64")
|
||||
}
|
||||
|
||||
@@ -45,7 +45,8 @@ fn get_encodings() -> Vec<(&'static str, Format, String)> {
|
||||
|
||||
pub fn uu_app() -> Command {
|
||||
let encodings = get_encodings();
|
||||
let mut command = base_common::base_app(translate!("basenc-about"), translate!("basenc-usage"));
|
||||
let mut command = base_common::base_app(translate!("basenc-about"), translate!("basenc-usage"))
|
||||
.name("basenc");
|
||||
|
||||
for encoding in &encodings {
|
||||
let raw_arg = Arg::new(encoding.0)
|
||||
|
||||
@@ -6,6 +6,15 @@
|
||||
|
||||
use uutests::new_ucmd;
|
||||
|
||||
#[test]
|
||||
fn test_version() {
|
||||
new_ucmd!()
|
||||
.arg("--version")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.stdout_is(format!("base32 {}\n", uucore::crate_version!()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_encode() {
|
||||
let input = "Hello, World!";
|
||||
|
||||
@@ -9,6 +9,15 @@
|
||||
use uutests::at_and_ucmd;
|
||||
use uutests::new_ucmd;
|
||||
|
||||
#[test]
|
||||
fn test_version() {
|
||||
new_ucmd!()
|
||||
.arg("--version")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.stdout_is(format!("base64 {}\n", uucore::crate_version!()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(target_os = "linux")]
|
||||
fn test_base64_non_utf8_paths() {
|
||||
|
||||
@@ -8,6 +8,15 @@
|
||||
|
||||
use uutests::{at_and_ucmd, new_ucmd};
|
||||
|
||||
#[test]
|
||||
fn test_version() {
|
||||
new_ucmd!()
|
||||
.arg("--version")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.stdout_is(format!("basenc {}\n", uucore::crate_version!()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_z85_not_padded_decode() {
|
||||
// The z85 crate deviates from the standard in some cases; we have to catch those
|
||||
|
||||
Reference in New Issue
Block a user