Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to parse stat #656

Closed
gabiganam opened this issue Nov 21, 2024 · 2 comments
Closed

unable to parse stat #656

gabiganam opened this issue Nov 21, 2024 · 2 comments

Comments

@gabiganam
Copy link

System details

Linux, Rust 1.82, Notify 7.0.0.

Get many of these warnings:

54 (notify-rs inoti) S 0 43 43 0 -1 4194624 4 0 0 0 0 0 0 0 20 0 14 0 28040418 950386688 5071 18446744073709551615 94137313394688 94137338558248 140725429025904 0 0 0 0 4096 1090 0 0 0 -1 1 0 0 0 0 0 94137751752704 94137751761368 94138430885888 140725429030519 140725429030736 140725429030736 140725429030880 0

Asked my AI buddy, and he's blaming notify/src/inotify.rs:

It seems that the parsing is failing because the function is expecting the process name to be enclosed in parentheses, which it isn't in your case.
You could modify this function to be more lenient in its parsing. For example:

fn parse_stat(stat: &str) -> Result<(pid_t, String)> {
    let mut s = stat.split_whitespace();
    let pid = s
        .next()
        .ok_or_else(|| Error::generic("unable to parse stat"))?
        .parse()
        .map_err(|_| Error::generic("unable to parse stat"))?;
    let name = s
        .next()
        .ok_or_else(|| Error::generic("unable to parse stat"))?
        .to_string();
    Ok((pid, name))
}
@dfaust
Copy link
Member

dfaust commented Nov 24, 2024

Hi @gabiganam. What function are you referring to? parse_stat is not a function of notify.

@gabiganam
Copy link
Author

Sorry, seems like an AI hallucination :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants