{"record":{"id":"31963b014ddeda40","repo":"slint-ui/slint","slug":"license-symlink-points-to-a-random-place-in-the-repository","errorCode":null,"errorMessage":"LICENSE symlink \"{}\" points to a random place in the repository","messagePattern":"LICENSE symlink \"(.+?)\" points to a random place in the repository","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xtask/src/reuse_compliance_check.rs","lineNumber":229,"sourceCode":"                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;\n            }\n        }\n\n        if !validated_link_target.starts_with(top_dir.join(\"LICENSES\")) {\n            if !fix_it {\n                let c = child.to_string_lossy();\n                anyhow::bail!(\n                    \"LICENSE symlink \\\"{}\\\" points to a random place in the repository\",\n                    c\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_file() {\n            if !fix_it {\n                let c = child.to_string_lossy();\n                anyhow::bail!(\"LICENSE symlink \\\"{}\\\" does not point to a file\", c);\n            } else {\n                to_remove.push(child.clone());\n                to_add.push(file_stem.clone());\n                continue;","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/xtask/src/reuse_compliance_check.rs#L211-L247","documentation":"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.","triggerScenarios":"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/.","commonSituations":"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.","solutions":["Point the symlink at the top-level LICENSES/<License>.txt file (adjust the number of ../ to the directory depth)","Copy the license into the root LICENSES/ directory if it is not there yet, then link to it","Run with --fix-symlinks to remove wrong links and create correct ones from the license map"],"exampleFix":"// before\npackage/LICENSES/MIT.txt -> ../other-package/LICENSES/MIT.txt\n// after\npackage/LICENSES/MIT.txt -> ../../LICENSES/MIT.txt","handlingStrategy":"validation","validationCode":"let canon = std::fs::canonicalize(link.parent().unwrap().join(std::fs::read_link(link)?))?;\nif !canon.starts_with(top.join(\"LICENSES\")) { eprintln!(\"target not in top-level LICENSES/: {}\", canon.display()); }","typeGuard":"fn target_in_root_licenses(link: &std::path::Path, top: &std::path::Path) -> bool {\n    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)\n}","tryCatchPattern":"if let Err(e) = run_check() {\n    if e.to_string().contains(\"random place in the repository\") { /* re-link to the root LICENSES/ directory */ }\n    else { return Err(e); }\n}","preventionTips":["Always link sub-LICENSES entries to the repository root LICENSES/, never to sibling packages","If a license text lives elsewhere in the repo, first copy it into the root LICENSES/ dir","Document the symlink convention in CONTRIBUTING docs"],"tags":["reuse","symlink","licensing","repository-layout"],"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"}