Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Wed, 23 Oct 2019 14:48:21 +0900
From: Mathias Lang <>
Subject: [BUG] fseek behavior differs on whence parameter

Hi everyone,
As part of my recent effort to get the D Programming Language ( to work on Alpine Linux, I've hit what I believe is a
bug in Musl.
Dlang relies heavily on libc, and obviously is historically glibc-based on

When porting to Alpine/Musl, one of the unittests that failed is calling
`fseek` with the value '3' for whence. The call is expected to fail, and it
does on Glibc, but succeed on Musl.
The reason for this difference is that Musl just forwards its whence
argument to the lseek syscall, which accepts '3' (aka SEEK_DATA) as a

However, glibc explicitly checks for if the value is one of SEEK_SET,
and POSIX defines the function as setting errno to EINVAL if the "whence
argument is invalid" ( The
only man page I could find that mentions 'SEEK_{DATA,HOLE}' is `lseek`'s.

In light of this, it looks to me like Musl behavior is the one that should
be changed.

For reference, original discussions:

P.S: I am not subscribed to the ML, please CC me.

Content of type "text/html" skipped

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.