Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

`readlink` of `/proc/self/fd/N` is `ENOENT` for a pipe, a socket or an eventfd

オープン
#431 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
50/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
c, macos

調査の方向性

Start at intercept_readlink_dispatch in src/runtime/procemu.c, which answers /proc/self/fd/N from fcntl(F_GETPATH), and check why that call fails for pipes, sockets and eventfds. Build the reproducer from the issue and compare its output with the Linux 6.12 column. Done when all three descriptors return a kind name in the pipe:[N], socket:[N] or anon_inode:[eventfd] form instead of ENOENT.

索引モデルが issue の本文から書いたものです。

説明

bug

intercept_readlink_dispatch (src/runtime/procemu.c) answers /proc/self/fd/N with the host path of the host fd, from fcntl(F_GETPATH). A descriptor with no path fails that call (EBADF on macOS 27.0.1 for a pipe), and the guest gets ENOENT. Linux names such a descriptor by its kind.

Reproducer:

#include <errno.h>
#include <stdio.h>
#include <sys/eventfd.h>
#include <sys/socket.h>
#include <unistd.h>

static void show(const char *what, int fd)
{
    char link[64], target[64];
    snprintf(link, sizeof(link), "/proc/self/fd/%d", fd);
    errno = 0;
    long n = readlink(link, target, sizeof(target) - 1);
    target[n < 0 ? 0 : n] = '\0';
    printf("%-8s %ld errno=%d %s\n", what, n, errno, target);
}

int main(void)
{
    int p[2], sv[2];
    pipe(p);
    socketpair(AF_UNIX, SOCK_STREAM, 0, sv);
    show("pipe", p[0]);
    show("socket", sv[0]);
    show("eventfd", eventfd(0, 0));
    return 0;
}
pipe socket eventfd
elfuse b57f367 -1, ENOENT -1, ENOENT -1, ENOENT
Linux 6.12 under qemu pipe:[181] socket:[182] anon_inode:[eventfd]
主要言語
C
スター
271
フォーク
28
平均マージ
2日 16時間
マージ済み PR(30日)
15

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

sysprog21/elfuse のほかの issue

sysprog21/elfuse の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。