slint-ui/slint · error

LICENSE symlink " " renames the license.

Error message

LICENSE symlink "{}" renames the license.

What it means

License symlinks must not rename the license: the symlink's file stem and extension must exactly match those of its target. This bail fires (non-fix mode) when e.g. Apache-2.0.txt points to MIT.txt or a differently-named file. In fix mode the renamed link is replaced with a correctly-named one.

Solutions

  1. Rename the symlink so stem and extension match its target exactly (symlink MIT.txt → ../../../LICENSES/MIT.txt)
  2. Remove the renamed alias and run with --fix-symlinks to generate the canonical set of symlinks

Example fix

// before
package/LICENSES/LICENSE-MIT.txt -> ../../../LICENSES/MIT.txt
// after
package/LICENSES/MIT.txt -> ../../../LICENSES/MIT.txt
Defensive patterns

Strategy: validation

Validate before calling

for link in license_symlinks {
    let t = std::fs::read_link(link)?;
    if t.file_stem() != link.file_stem() || t.extension() != link.extension() {
        eprintln!("renaming symlink: {} -> {}", link.display(), t.display());
    }
}

Type guard

fn symlink_keeps_name(link: &std::path::Path) -> bool {
    std::fs::read_link(link).map(|t| t.file_stem() == link.file_stem() && t.extension() == link.extension()).unwrap_or(false)
}

Try / catch

if let Err(e) = run_check() {
    if e.to_string().contains("renames the license") { /* rename the symlink to match its target exactly */ }
    else { return Err(e); }
}

Prevention

When it happens

Trigger: validate_license_directory compares link_target_file_stem/extension against the child's stem/ext; any mismatch (e.g. symlink LICENSE-MIT.txt → MIT.txt, or Foo.txt → MIT.txt) triggers the error when running without --fix-symlinks.

Common situations: Manually creating aliases like `LICENSE.txt` or `COPYING.txt` pointing at a license file; renaming a symlink on one side only; adding convenience links in LICENSES/ dirs.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of slint-ui/slint@bb937076de (2026-09-16). Data as JSON: /api/errors/62d6c1eb978dbfe6. Report an issue: GitHub.

Appendix: source

Thrown at xtask/src/reuse_compliance_check.rs:204

        let link_target_file_stem = link_target.file_stem().unwrap_or_default().to_string_lossy();
        let link_target_extension = link_target.extension().unwrap_or_default();

        let validated_link_target = lic_dir.join(&link_target).canonicalize().unwrap_or_default();
        if validated_link_target.as_os_str().is_empty() {
            if !fix_it {
                anyhow::bail!(
                    "License symlink \"{}\" does not point to any existing location",
                    child.to_string_lossy()
                );
            }
            // Path validation failed
            to_remove.push(child.clone());
            to_add.push(file_stem.clone());
            continue;
        }
        if link_target_extension != ext || link_target_file_stem != file_stem {
            if !fix_it {
                anyhow::bail!(
                    "LICENSE symlink \"{}\" renames the license.",
                    child.to_string_lossy()
                );
            } else {
                to_remove.push(child.clone());
                to_add.push(file_stem.clone());
                continue;
            }
        }

        if !validated_link_target.is_absolute() || !validated_link_target.starts_with(&top_dir) {
            if !fix_it {
                let c = child.to_string_lossy();
                anyhow::bail!("LICENSE symlink \"{}\" points outside the repository", c);
            } else {
                to_remove.push(child.clone());
                to_add.push(file_stem.clone());
                continue;

View on GitHub (pinned to bb937076de)