GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — diff - `--ignore-file-name-case` folds non-ASCII letters in the C locale · Issue #356 · uutils/diffutils

diff - --ignore-file-name-case folds non-ASCII letters in the C locale #356

New issue
Copy link
New issue
Copy link
Open
#381
Open
diff - --ignore-file-name-case folds non-ASCII letters in the C locale#356
#381
Copy link
Labels
bugSomething isn't workingSomething isn't workinggnu-compatBehaviour differs from GNUBehaviour differs from GNUgood first issueGood for newcomersGood for newcomersoss-scannerFound by Anthropic's OSS ScannerFound by Anthropic's OSS Scanner

Description

@sylvestre
sylvestre
opened on Nov 9, 2026
Issue body actions

In the C/POSIX locale GNU diff only folds ASCII letters when --ignore-file-name-case
is given, so É and é are different names. uutils always uses Unicode lowercasing, so
it pairs them regardless of the locale. In a UTF-8 locale (C.UTF-8, fr_FR.UTF-8)
both implementations pair them, so only the C/POSIX case is wrong.

Reproduction

mkdir i1 i2; echo a > i1/É; echo a > i2/é

Rust (incorrect)

$ LC_ALL=C ./target/release/diffutils diff --ignore-file-name-case i1/É i2
# Output: (none)
# Exit code: 0
$ LC_ALL=C ./target/release/diffutils diff -r --ignore-file-name-case i1 i2
# Output: (none)
# Exit code: 0

GNU (correct)

$ LC_ALL=C diff --ignore-file-name-case i1/É i2
diff: 'i2/'$'\303\211': No such file or directory
# Exit code: 2
$ LC_ALL=C diff -r --ignore-file-name-case i1 i2
# two "Only in" lines, one per directory
# Exit code: 1

Root cause

fold_file_name_case in src/utils.rs:167-172:

pub fn fold_file_name_case(name: &OsStr) -> Vec<u8> {
    match name.to_str() {
        Some(name) => name.to_lowercase().into_bytes(),
        None => name.as_encoded_bytes().to_ascii_lowercase(),
    }
}

Test

Add to tests/by-util/test_diff.rs:

#[test]
#[cfg(unix)]
fn ignore_file_name_case_is_ascii_only_in_c_locale() -> Result<(), Box<dyn std::error::Error>> {
    let tmp_dir = tempdir()?;
    let (d1, d2) = (tmp_dir.path().join("i1"), tmp_dir.path().join("i2"));
    std::fs::create_dir(&d1)?;
    std::fs::create_dir(&d2)?;
    std::fs::write(d1.join("É"), "a\n")?;
    std::fs::write(d2.join("é"), "a\n")?;
    let mut cmd = cargo_bin_cmd!("diffutils");
    cmd.env("LC_ALL", "C")
        .arg("diff")
        .arg("-r")
        .arg("--ignore-file-name-case")
        .arg(&d1)
        .arg(&d2);
    cmd.assert().code(predicate::eq(1));
    Ok(())
}

Reported by Anthropic's OSS Scanner (ANT-2026-1ZSWTAHH).

Activity

  1. sylvestre
    added
    bugSomething isn't workingSomething isn't working
    good first issueGood for newcomersGood for newcomers
    oss-scannerFound by Anthropic's OSS ScannerFound by Anthropic's OSS Scanner
    gnu-compatBehaviour differs from GNUBehaviour differs from GNU
    on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingSomething isn't workinggnu-compatBehaviour differs from GNUBehaviour differs from GNUgood first issueGood for newcomersGood for newcomersoss-scannerFound by Anthropic's OSS ScannerFound by Anthropic's OSS Scanner

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.