{"record":{"id":"62d6c1eb978dbfe6","repo":"slint-ui/slint","slug":"license-symlink-renames-the-license","errorCode":null,"errorMessage":"LICENSE symlink \"{}\" renames the license.","messagePattern":"LICENSE symlink \"(.+?)\" renames the license\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xtask/src/reuse_compliance_check.rs","lineNumber":204,"sourceCode":"        let link_target_file_stem = link_target.file_stem().unwrap_or_default().to_string_lossy();\n        let link_target_extension = link_target.extension().unwrap_or_default();\n\n        let validated_link_target = lic_dir.join(&link_target).canonicalize().unwrap_or_default();\n        if validated_link_target.as_os_str().is_empty() {\n            if !fix_it {\n                anyhow::bail!(\n                    \"License symlink \\\"{}\\\" does not point to any existing location\",\n                    child.to_string_lossy()\n                );\n            }\n            // Path validation failed\n            to_remove.push(child.clone());\n            to_add.push(file_stem.clone());\n            continue;\n        }\n        if link_target_extension != ext || link_target_file_stem != file_stem {\n            if !fix_it {\n                anyhow::bail!(\n                    \"LICENSE symlink \\\"{}\\\" renames the license.\",\n                    child.to_string_lossy()\n                );\n            } else {\n                to_remove.push(child.clone());\n                to_add.push(file_stem.clone());\n                continue;\n            }\n        }\n\n        if !validated_link_target.is_absolute() || !validated_link_target.starts_with(&top_dir) {\n            if !fix_it {\n                let c = child.to_string_lossy();\n                anyhow::bail!(\"LICENSE symlink \\\"{}\\\" points outside the repository\", c);\n            } else {\n                to_remove.push(child.clone());\n                to_add.push(file_stem.clone());\n                continue;","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/xtask/src/reuse_compliance_check.rs#L186-L222","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Rename the symlink so stem and extension match its target exactly (symlink MIT.txt → ../../../LICENSES/MIT.txt)","Remove the renamed alias and run with --fix-symlinks to generate the canonical set of symlinks"],"exampleFix":"// before\npackage/LICENSES/LICENSE-MIT.txt -> ../../../LICENSES/MIT.txt\n// after\npackage/LICENSES/MIT.txt -> ../../../LICENSES/MIT.txt","handlingStrategy":"validation","validationCode":"for link in license_symlinks {\n    let t = std::fs::read_link(link)?;\n    if t.file_stem() != link.file_stem() || t.extension() != link.extension() {\n        eprintln!(\"renaming symlink: {} -> {}\", link.display(), t.display());\n    }\n}","typeGuard":"fn symlink_keeps_name(link: &std::path::Path) -> bool {\n    std::fs::read_link(link).map(|t| t.file_stem() == link.file_stem() && t.extension() == link.extension()).unwrap_or(false)\n}","tryCatchPattern":"if let Err(e) = run_check() {\n    if e.to_string().contains(\"renames the license\") { /* rename the symlink to match its target exactly */ }\n    else { return Err(e); }\n}","preventionTips":["Never create alias names (LICENSE.txt, COPYING) for license symlinks","Copy the symlink name verbatim from the target filename","Enforce with a pre-commit hook comparing link and target names"],"tags":["reuse","symlink","licensing","naming"],"backgroundTag":"invalid-argument-value","analyzedSha":"bb937076de3f7919766c1f25e2e969367cf77e9a","analyzedAt":"2026-09-16T01:37:20.251Z","contentChangedAt":"2026-09-16T01:37:20.251Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}