{"record":{"id":"a8d54506ccef627d","repo":"uutils/coreutils","slug":"modifying-root-path","errorCode":null,"errorMessage":"Modifying root path","messagePattern":"Modifying root path","errorType":"exception","errorClass":"uucore::error::Error","httpStatus":null,"severity":"error","filePath":"src/uu/chcon/src/chcon.rs","lineNumber":557,"sourceCode":"            ));\n        };\n\n        let mut result = Ok(());\n\n        match entry.flags() {\n            fts_sys::FTS_D if options.recursive_mode.is_recursive() => {\n                if root_dev_ino_check(root_dev_ino, file_dev_ino) {\n                    // This happens e.g., with \"chcon -R --preserve-root ... /\"\n                    // and with \"chcon -RH --preserve-root ... symlink-to-root\".\n                    root_dev_ino_warn(&file_full_name);\n\n                    // Tell fts not to traverse into this hierarchy.\n                    let _ignored = fts.set(fts_sys::FTS_SKIP);\n\n                    // Ensure that we do not process \"/\" on the second visit.\n                    let _ignored = fts.read_next_entry();\n\n                    return Err(err(\n                        translate!(\"chcon-op-modifying-root-path\"),\n                        io::ErrorKind::PermissionDenied,\n                    ));\n                }\n\n                return Ok(());\n            }\n\n            fts_sys::FTS_DP if !options.recursive_mode.is_recursive() => {\n                return Ok(());\n            }\n\n            fts_sys::FTS_NS => {\n                // For a top-level file or directory, this FTS_NS (stat failed) indicator is determined\n                // at the time of the initial fts_open call. With programs like chmod, chown, and chgrp,\n                // that modify permissions, it is possible that the file in question is accessible when\n                // control reaches this point. So, if this is the first time we've seen the FTS_NS for\n                // this file, tell fts_read to stat it \"again\".","sourceCodeStart":539,"sourceCodeEnd":575,"githubUrl":"https://github.com/uutils/coreutils/blob/0b77ced48502a5f80c51dfa827af7e69f3687053/src/uu/chcon/src/chcon.rs#L539-L575","documentation":"Error \"Modifying root path\" thrown in uutils/coreutils.","triggerScenarios":"Occurs when chcon fails to modify the security context of the root path of a recursive operation.","commonSituations":"Insufficient privileges or SELinux policy denying the context change on the top-level path.","solutions":["Run chcon with sufficient privileges (root or appropriate SELinux permissions) when modifying the root path.","Avoid changing contexts on / unless explicitly intended; target the correct path."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0b77ced48502a5f80c51dfa827af7e69f3687053","analyzedAt":"2026-08-19T21:43:27.871Z","contentChangedAt":"2026-08-19T21:43:27.871Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}