uutils/coreutils · error · io::Error

InvalidInput

InvalidInput

Error message

Too many levels of symbolic links

What it means

Error "Too many levels of symbolic links" thrown in uutils/coreutils.

Source

Thrown at src/uucore/src/lib/features/fs.rs:429

        if res_mode == ResolveMode::None {
            continue;
        }
        match resolve_symlink(&result) {
            Ok(Some(link_path)) => {
                for link_part in link_path.components().rev() {
                    parts.push_front(link_part.into());
                }
                if followed_symlinks < SYMLINKS_TO_LOOK_FOR_LOOPS {
                    followed_symlinks += 1;
                } else {
                    let file_info =
                        FileInformation::from_path(result.parent().unwrap(), false).unwrap();
                    let mut path_to_follow = PathBuf::new();
                    for part in &parts {
                        path_to_follow.push(part.as_os_str());
                    }
                    if !visited_files.insert((file_info, path_to_follow)) {
                        return Err(Error::new(
                            ErrorKind::InvalidInput,
                            "Too many levels of symbolic links",
                        )); // TODO use ErrorKind::FilesystemLoop when stable
                    }
                }
                result.pop();
            }
            Err(e)
                if (miss_mode == MissingHandling::Existing
                    || (miss_mode == MissingHandling::Normal && !parts.is_empty())) =>
            {
                return Err(e);
            }
            _ => {}
        }
    }
    // raise Not a directory if required
    match miss_mode {

View on GitHub (pinned to 85295bbf78)

Solutions

  1. Break the symbolic link cycle in the path; inspect with readlink -f.
  2. Avoid dereferencing links in a loop-prone tree, or use O_NOFOLLOW-style traversal.

When it happens

Trigger: Occurs when path canonicalization in uucore fs hits too many nested symbolic links (ELOOP).

Common situations: Resolving paths through circular symlink chains or symlink loops created accidentally.


AI-assisted analysis of uutils/coreutils@85295bbf78 (2026-08-19). Data as JSON: /api/errors/db750fa11ad2b508. Report an issue: GitHub.