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

`open` with `O_DIRECT` succeeds on a FIFO, where Linux returns `EINVAL`

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

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

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

評価

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

調査の方向性

Start with the reproducer in the issue and find where elfuse handles open flags, especially O_DIRECT and the FIFO and /proc/self/fd/N paths. Compare against the Linux rule in do_dentry_open (fs/open.c), which returns EINVAL when the file lacks FMODE_CAN_ODIRECT. Done when both FIFO and pipe-through-procfs opens with O_DIRECT return -1 with EINVAL, matching Linux 6.12.

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

説明

bug

Linux refuses O_DIRECT at open for a file that cannot do direct I/O: do_dentry_open (fs/open.c) returns EINVAL when the flag is set and the file lacks FMODE_CAN_ODIRECT, which a FIFO lacks. A pipe takes the flag through pipe2 and F_SETFL only. Under elfuse the open succeeds, both for a FIFO opened by name and for a pipe reopened through /proc/self/fd/N.

Reproducer:

#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/stat.h>
#include <unistd.h>

int main(void)
{
    const char *fifo = "/tmp/o-direct-fifo";
    char link[64];
    int p[2];

    unlink(fifo);
    mkfifo(fifo, 0600);
    int rd = open(fifo, O_RDONLY | O_NONBLOCK);
    errno = 0;
    int wr = open(fifo, O_WRONLY | O_DIRECT);
    printf("open(fifo, O_WRONLY|O_DIRECT): %s errno=%d\n",
           wr >= 0 ? "an fd" : "-1", errno);

    pipe(p);
    snprintf(link, sizeof(link), "/proc/self/fd/%d", p[1]);
    errno = 0;
    int again = open(link, O_WRONLY | O_DIRECT);
    printf("open(/proc/self/fd/N, O_WRONLY|O_DIRECT) on a pipe: %s errno=%d\n",
           again >= 0 ? "an fd" : "-1", errno);
    (void) rd;
    unlink(fifo);
    return 0;
}
FIFO by name pipe through /proc/self/fd/N
elfuse b57f367 an fd an fd
Linux 6.12 under qemu -1, EINVAL -1, EINVAL
主要言語
C
スター
273
フォーク
29
平均マージ
2日 10時間
マージ済み PR(30日)
17

環境構築

はじめの一歩

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

sysprog21/elfuse のほかの issue

sysprog21/elfuse の issue をすべて見る

似ている issue

C の issue をもっと見る

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

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