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

stat nr_link incorrect for /proc/self/task #1267

Closed
therealkenc opened this issue Oct 24, 2016 · 5 comments
Closed

stat nr_link incorrect for /proc/self/task #1267

therealkenc opened this issue Oct 24, 2016 · 5 comments

Comments

@therealkenc
Copy link
Collaborator

Filing this just so there's a well formed test case on the books and something to point to as duplicates are reported. Here's hoping there's a five min fix. Exists in the wild here. It's (academically) the current fatal on the body of software in question because #546 was squashed.

Nothing to see in an strace b/c the syscalls all succeed.

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>

int main(int argc, const char *argv[]) {
  int proc_fd = open("/proc", O_RDONLY|O_DIRECTORY);
  struct stat task_stat;
  fstatat(proc_fd, "self/task/", &task_stat, 0);

  if (task_stat.st_nlink < 3) {
    // should never get here -- all /proc/self/task directories
    // should have at least ourselves plus . and ..
    fprintf(stderr, "unexpected task_stat.st_nlink < 3\n");
  }

  return 0;
}
@stehufntdev
Copy link
Collaborator

Thanks for reporting the issue and providing the sample code. Adding the bug tag.

@JasonLinMS
Copy link

We'll have correct link counts for directories in /proc and /sys. Thanks!

@therealkenc
Copy link
Collaborator Author

You guys are on fire this week.

@JasonLinMS
Copy link

Sprinting towards Creators Update!

@therealkenc
Copy link
Collaborator Author

@JasonLinMS this is fixed in 15042 -15048 as well. This one is part of what lit up out-of-the-box chrome so thanks.

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

4 participants