1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-16 19:56:17 +00:00

Merge pull request #3155 from jtracey/gecos-off-by-one

pinky: fix off-by-one in GECOS parsing
This commit is contained in:
Sylvestre Ledru 2022-03-17 13:35:05 +01:00 committed by GitHub
commit a5948ce11b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 60 additions and 27 deletions

View file

@ -44,7 +44,14 @@ fn test_long_format() {
#[cfg(unix)]
#[test]
fn test_long_format_multiple_users() {
let args = ["-l", "root", "root", "root"];
// multiple instances of one account we know exists,
// the account of the test runner,
// and an account that (probably) doesn't exist
let runner = match std::env::var("USER") {
Ok(user) => user,
Err(_) => "".to_string(),
};
let args = ["-l", "root", "root", "root", &runner, "no_such_user"];
let ts = TestScenario::new(util_name!());
let expect = unwrap_or_return!(expected_result(&ts, &args));

View file

@ -7,6 +7,7 @@ fn test_users_no_arg() {
#[test]
#[cfg(any(target_vendor = "apple", target_os = "linux"))]
#[ignore = "issue #3219"]
fn test_users_check_name() {
#[cfg(target_os = "linux")]
let util_name = util_name!();

View file

@ -9,6 +9,7 @@ use crate::common::util::*;
#[cfg(unix)]
#[test]
#[ignore = "issue #3219"]
fn test_count() {
let ts = TestScenario::new(util_name!());
for opt in &["-q", "--count", "--c"] {
@ -29,6 +30,7 @@ fn test_boot() {
#[cfg(unix)]
#[test]
#[ignore = "issue #3219"]
fn test_heading() {
let ts = TestScenario::new(util_name!());
for opt in &["-H", "--heading", "--head"] {
@ -47,6 +49,7 @@ fn test_heading() {
#[cfg(unix)]
#[test]
#[ignore = "issue #3219"]
fn test_short() {
let ts = TestScenario::new(util_name!());
for opt in &["-s", "--short", "--s"] {
@ -108,6 +111,7 @@ fn test_time() {
#[cfg(unix)]
#[test]
#[ignore = "issue #3219"]
fn test_mesg() {
// -T, -w, --mesg
// add user's message status as +, - or ?
@ -150,6 +154,7 @@ fn test_too_many_args() {
#[cfg(unix)]
#[test]
#[ignore = "issue #3219"]
fn test_users() {
let ts = TestScenario::new(util_name!());
for opt in &["-u", "--users", "--us"] {
@ -175,6 +180,7 @@ fn test_users() {
#[cfg(unix)]
#[test]
#[ignore = "issue #3219"]
fn test_lookup() {
let opt = "--lookup";
let ts = TestScenario::new(util_name!());
@ -194,6 +200,7 @@ fn test_dead() {
#[cfg(unix)]
#[test]
#[ignore = "issue #3219"]
fn test_all_separately() {
if cfg!(target_os = "macos") {
// TODO: fix `-u`, see: test_users
@ -211,6 +218,7 @@ fn test_all_separately() {
#[cfg(unix)]
#[test]
#[ignore = "issue #3219"]
fn test_all() {
if cfg!(target_os = "macos") {
// TODO: fix `-u`, see: test_users