Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#430 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
62/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
c, linux, macos

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
C
Estrellas
273
Forks
29
Merge medio
2 d 20 h
PR fusionados (30 d)
16

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de sysprog21/elfuse

Todos los issues de sysprog21/elfuse

Issues similares

Más issues de C

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.