Skip to content

Commit

Permalink
Merge pull request uutils#5419 from cakebaker/fuzzing_expr_lc_collate
Browse files Browse the repository at this point in the history
fuzz: set LC_COLLATE=C for expr
  • Loading branch information
sylvestre committed Oct 18, 2023
2 parents 7a60819 + 12765a4 commit 1cfd119
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion fuzz/fuzz_targets/fuzz_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use uu_expr::uumain;

use rand::seq::SliceRandom;
use rand::Rng;
use std::ffi::OsString;
use std::{env, ffi::OsString};

mod fuzz_common;
use crate::fuzz_common::{generate_and_run_uumain, run_gnu_cmd};
Expand Down Expand Up @@ -86,6 +86,11 @@ fuzz_target!(|_data: &[u8]| {

let (rust_output, uumain_exit_code) = generate_and_run_uumain(&args, uumain);

// Use C locale to avoid false positives, like in https://github.com/uutils/coreutils/issues/5378,
// because uutils expr doesn't support localization yet
// TODO remove once uutils expr supports localization
env::set_var("LC_COLLATE", "C");

// Run GNU expr with the provided arguments and compare the output
match run_gnu_cmd(CMD_PATH, &args[1..], true) {
Ok((gnu_output, gnu_exit_code)) => {
Expand Down

0 comments on commit 1cfd119

Please sign in to comment.