slint-ui/slint · error

LICENSE symlink " " points to a random place in the…

Error message

LICENSE symlink "{}" points to a random place in the repository

What it means

Even if the target stays inside the repository, it must live under the top-level LICENSES/ directory. This bail fires when a symlink resolves to some other location in the repo (e.g. another package's LICENSES dir or a source file). This enforces the single-source-of-truth rule that all mirrored licenses come from the root LICENSES folder.

Solutions

  1. Point the symlink at the top-level LICENSES/<License>.txt file (adjust the number of ../ to the directory depth)
  2. Copy the license into the root LICENSES/ directory if it is not there yet, then link to it
  3. Run with --fix-symlinks to remove wrong links and create correct ones from the license map

Example fix

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

Strategy: validation

Validate before calling

let canon = std::fs::canonicalize(link.parent().unwrap().join(std::fs::read_link(link)?))?;
if !canon.starts_with(top.join("LICENSES")) { eprintln!("target not in top-level LICENSES/: {}", canon.display()); }

Type guard

fn target_in_root_licenses(link: &std::path::Path, top: &std::path::Path) -> bool {
    link.parent().and_then(|p| std::fs::read_link(link).ok().map(|t| p.join(t))).and_then(|p| std::fs::canonicalize(p).ok()).map(|c| c.starts_with(top.join("LICENSES"))).unwrap_or(false)
}

Try / catch

if let Err(e) = run_check() {
    if e.to_string().contains("random place in the repository") { /* re-link to the root LICENSES/ directory */ }
    else { return Err(e); }
}

Prevention

When it happens

Trigger: validate_license_directory (no --fix-symlinks) finds a symlink whose canonical target is in the repo but not under <repo>/LICENSES — e.g. pointing to a sibling package's LICENSES/ dir or to docs/.

Common situations: Linking package LICENSES/ entries to another package's LICENSES/ dir instead of the root one; linking to a LICENSE file sitting next to the sources; restructures moved the top LICENSES dir without updating links.

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/31963b014ddeda40. Report an issue: GitHub.

Appendix: source

Thrown at xtask/src/reuse_compliance_check.rs:229

                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;
            }
        }

        if !validated_link_target.starts_with(top_dir.join("LICENSES")) {
            if !fix_it {
                let c = child.to_string_lossy();
                anyhow::bail!(
                    "LICENSE symlink \"{}\" points to a random place in the repository",
                    c
                );
            } else {
                to_remove.push(child.clone());
                to_add.push(file_stem.clone());
                continue;
            }
        }

        if !validated_link_target.is_file() {
            if !fix_it {
                let c = child.to_string_lossy();
                anyhow::bail!("LICENSE symlink \"{}\" does not point to a file", c);
            } else {
                to_remove.push(child.clone());
                to_add.push(file_stem.clone());
                continue;

View on GitHub (pinned to bb937076de)