{"record":{"id":"978f0297a8a9d31c","repo":"slint-ui/slint","slug":"license-symlink-does-not-point-to-a-file","errorCode":null,"errorMessage":"LICENSE symlink \"{}\" does not point to a file","messagePattern":"LICENSE symlink \"(.+?)\" does not point to a file","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xtask/src/reuse_compliance_check.rs","lineNumber":243,"sourceCode":"\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;\n            }\n        }\n    }\n\n    if !fix_it {\n        return Ok(());\n    }\n\n    // Remove old symlinks\n    for rm in to_remove {\n        println!(\"Removing symlink \\\"{}\\\"...\", rm.to_string_lossy());\n        std::fs::remove_file(&rm).with_context(|| {\n            format!(\"Failed to remove LICENSE symlink \\\"{}\\\"\", rm.to_string_lossy())\n        })?;","sourceCodeStart":225,"sourceCodeEnd":261,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/xtask/src/reuse_compliance_check.rs#L225-L261","documentation":"The final canonicalized target must be a regular file. This bail fires when the symlink resolves to a directory or something that is not a file under the top-level LICENSES/ path — for instance the LICENSES directory itself. In fix mode the offending link is removed and recreated.","triggerScenarios":"A sub-LICENSES symlink whose canonicalized target is a directory (e.g. points to ../LICENSES/ without a filename) or a non-regular file, checked without --fix-symlinks.","commonSituations":"Symlink accidentally created without the filename component; target name case-mismatching a directory; symlink to a fifo/device in unusual setups.","solutions":["Recreate the symlink including the exact license filename, e.g. `ln -sf ../../LICENSES/MIT.txt package/LICENSES/MIT.txt`","Run `cargo xtask reuse-compliance-check --fix-symlinks` to replace the bad link automatically"],"exampleFix":"// before\npackage/LICENSES/MIT.txt -> ../../LICENSES/\n// after\npackage/LICENSES/MIT.txt -> ../../LICENSES/MIT.txt","handlingStrategy":"validation","validationCode":"for link in license_symlinks {\n    let target = link.parent().unwrap().join(std::fs::read_link(link)?);\n    let canon = std::fs::canonicalize(&target)?;\n    if !canon.is_file() { eprintln!(\"target not a file: {}\", canon.display()); }\n}","typeGuard":"fn symlink_targets_file(link: &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.is_file()).unwrap_or(false)\n}","tryCatchPattern":"if let Err(e) = run_check() {\n    if e.to_string().contains(\"does not point to a file\") { /* include the license filename in the symlink target */ }\n    else { return Err(e); }\n}","preventionTips":["Always include the exact license filename in the target path, not just the LICENSES/ directory","Recreate symlinks with --fix-symlinks after manual edits","Verify with `readlink -f <link>` that the result is a file"],"tags":["reuse","symlink","licensing","filesystem"],"backgroundTag":"file-not-found","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"}