Skip to content

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

Closed

Description

@therealkenc

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;
}

Activity

  1. stehufntdev commented on Oct 26, 2016

    @stehufntdev

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

  2. JasonLinMS commented on Feb 5, 2017

    @JasonLinMS

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

  3. therealkenc commented on Feb 5, 2017

    @therealkenc
    Author

    You guys are on fire this week.

  4. JasonLinMS commented on Feb 6, 2017

    @JasonLinMS

    Sprinting towards Creators Update!

  5. therealkenc commented on Mar 6, 2017

    @therealkenc
    Author

    Jason Lin (@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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions