POSIX

From Adélie Linux

POSIX® is a standard that specifies how Unix®-like operating systems act. Adélie Linux is attempting to comply with the POSIX® standard.

Contents

VSX: musl / C library conformance issues

sys/stat.h

  1. Argument 1 of S_TYPEISTMO is not evaluated
  2. Argument 1 of S_TYPEISMQ is not evaluated
  3. Argument 1 of S_TYPEISSEM is not evaluated
  4. Argument 1 of S_TYPEISSHM is not evaluated


complex.h

(c)acosh(3)

  1. For real part of return value... Random arguments were tested from the interval [-100, 100]. The result was too large 1481 times, equal 10 times, too small 509 times. The maximum relative error of 2 occurred for values 1.18666, -1.12843: this gave a maximum loss of 54 significant digits of base 2 (maximum acceptable loss is 20).
  2. For imaginary part of return value... Random arguments were tested from the interval [-100, 100]. The result was too large 494 times, equal 43 times, too small 1463 times. The maximum relative error of 2 occurred for values 69.9153, -1.31828: this gave a maximum loss of 54 significant digits of base 2 (maximum acceptable loss is 10).

(c)acoshf(3)

  1. For real part of return value... Random arguments were tested from the interval [-100, 100]. The result was too large 1488 times, equal 13 times, too small 499 times. The maximum relative error of 2 occurred for values 13.0683, -1.12843: this gave a maximum loss of 25 significant digits of base 2 (maximum acceptable loss is 20).
  2. For imaginary part of return value... Random arguments were tested from the interval [-100, 100]. The result was too large 478 times, equal 41 times, too small 1481 times. The maximum relative error of 2 occurred for values 40.5175, -1.51833: this gave a maximum loss of 25 significant digits of base 2 (maximum acceptable loss is 20).

(c)acoshl(3)

  1. For real part of return value... Random arguments were tested from the interval [-100, 100]. The result was too large 1481 times, equal 10 times, too small 509 times. The maximum relative error of 2 occurred for values 1.18666, -1.12843: this gave a maximum loss of 54 significant digits of base 2 (maximum acceptable loss is 20).
  2. For imaginary part of return value... Random arguments were tested from the interval [-100, 100]. The result was too large 494 times, equal 43 times, too small 1463 times. The maximum relative error of 2 occurred for values 69.9153, -1.31828: this gave a maximum loss of 54 significant digits of base 2 (maximum acceptable loss is 10).

cproj(3) family

  1. cproj{,f,l}(inf + I*-inf) expected "inf + I*-0.0", actual "inf + I*0x0p+0"


dirent.h

fdopendir(3)

  1. fdopendir() using an fd opened with O_SEARCH succeeds


fcntl.h

  1. Missing #define: O_TTY_INIT


float.h

  1. Illegal definitions in strict mode (_POSIX_C_SOURCE=200809, no other FTMs):
    1. FLT_TRUE_MIN
    2. FLT_HAS_SUBNORM
    3. FLT_DECIMAL_DIG
    4. DBL_TRUE_MIN
    5. DBL_HAS_SUBNORM
    6. DBL_DECIMAL_DIG
    7. LDBL_HAS_SUBNORM
    8. LDBL_DECIMAL_DIG
    9. LDBL_TRUE_MIN


fnmatch.h

fnmatch(3)

  1. fnmatch with FNM_NOESCAPE flag cleared returns 0 when pattern ends in unescaped backslash character; shall fail (example is fnmatch("abc\", "abc", 0))


glob.h

glob(3)

  1. glob("unreadable_but_searchable_dir/a", GLOB_ERR, errfunc, pglob) returns GLOB_NOMATCH and calls errfunc (it should do neither of these things) [Kernel?]


math.h

fma(3)

  1. fma(maxdble, 2.0, 0.0) did not set FE_OVERFLOW
  2. fmaf(FLT_MAX, 2.0, 0.0) did not set FE_OVERFLOW
  3. fmal(LDBL_MAX, 2.0, 0.0) did not set FE_OVERFLOW

nexttowardf(3)

  1. nexttowardf(FLT_MAX, HUGE_VALL) gave 3.40282e+38 instead of Inf

tan(3)

  1. tan +Inf / -Inf doesn't cause FE_INVALID


pthreads

pthread_attr_setinheritsched

  1. pthread_attr_setinheritsched(attr, <invalid>) returned EINVAL instead of ENOTSUP patched in -r13

pthread_attr_setscope

  1. pthread_attr_setscope(attr, <invalid>) returned EINVAL instead of ENOTSUP patched in -r13

pthread_attr_setstack

  1. pthread_attr_setstack returned 0 when stacksize was above the implementation-defined limit invalid test configuration; fixed on powerposix, pull cfg for other nodes

pthread_barrierattr_setpshared

  1. pthread_barrierattr_setpshared did not return EINVAL when passed an "invalid value"
the logic for this test is: process_shared = PTHREAD_PROCESS_SHARED + 1;
if (process_shared == PTHREAD_PROCESS_PRIVATE) process_shared++;
result = pthread_barrierattr_setpshared(&attr, process_shared);
this is likely flawed because it will fail if there is ever a third option. however, musl should be returning EINVAL right now anyway.

pthread_cancel

  1. "When a cancellation request is acted upon, the thread sets it cancelability state to PTHREAD_CANCEL_DISABLE and its cancelability type to PTHREAD_CANCEL_DEFERRED before it calls the routines in the thread's list of cancellation cleanup handlers." Deadlocked; did not return after 25 minutes fixed upstream and in -r12

pthread_cond_signal

  1. "If _POSIX_THREAD_PRIORITY_SCHEDULING is supported, when more than one thread is blocked on the condition variable specified by cond, then the scheduling policy determines the order in which threads are unblocked as a result of a call to pthread_cond_signal()."
Thread 0 unblocked before a higher priority thread
Thread 1 unblocked before a higher priority thread
Thread 2 unblocked before a higher priority thread
Thread 4 unblocked before a higher priority thread
Thread 5 unblocked before a higher priority thread
Thread 6 unblocked before a higher priority thread

pthread_cond_timedwait

  1. "A thread that has been unblocked because it has been canceled while blocked in a call to pthread_cond_timedwait() shall not consume any condition signal that may be directed concurrently at the condition variable if there are other threads blocked on the condition variable."
Test information
Thread was not canceled
pthread_cond_timedwait expected 0, got 110
  1. "When the mutex object referenced by mutex is a robust mutex and is locked by another thread, then a call to pthread_cond_timedwait(cond, mutex, abstime) returns EPERM."
*** TCM API Message: system 0: Abandoning testset: caught unexpected signal 4 (SIGILL) ***

pthread_cond_wait

  1. "When the mutex object referenced by mutex is a robust mutex, a thread is unblocked because it has been canceled while blocked in a call to pthread_cond_wait(cond, mutex), and there are other threads blocked on cond, then the call does not consume any condition signal that is directed concurrently at cond." Deadlocked; did not return after 16 minutes fixed in -r13

pthread_condattr_init

  1. "A call to pthread_condattr_init() shall not return EINTR when interrupted."
*** TCM API Message: system 0: Abandoning testset: caught unexpected signal 11 (SIGSEGV) ***

pthread_getspecific

  1. "If no thread specific data is associated with key, a call to pthread_getspecific(key) returns NULL."
Expected 0, got 747709576

pthread_mutex_lock

  1. "When the mutex object referenced by mutex is a process-shared robust mutex which was locked by a thread whose containing process terminated while it held the lock, then a call to pthread_mutex_lock(mutex) locks the mutex and returns EOWNERDEAD." Deadlocked; did not return after 47 minutes kernel patch lkml thread

pthread_mutex_timedlock

  1. "When the mutex object referenced by mutex is a process-shared robust mutex which was locked by a thread whose containing process terminated while it held the lock, then a call to pthread_mutex_timedlock(mutex, abstime) locks the mutex and returns EOWNERDEAD." Deadlocked; did not return after 6 minutes kernel patch lkml thread

pthread_mutex_trylock

  1. "When the mutex object referenced by mutex is a process-shared robust mutex which was locked by a thread whose containing process terminated while it held the lock, then a call to pthread_mutex_trylock(mutex) locks the mutex and returns EOWNERDEAD." Expected EOWNERDEAD, actual EBUSY kernel patch lkml thread

pthread_rwlock_rdlock

  1. If _POSIX_READER_WRITER_LOCKS and _POSIX_THREAD_PRIORITY_SCHEDULING are supported:
When a writer is blocked on the reader/writer lock referenced by `lock`, all threads involved in the lock are executing with the scheduling policies of SCHED_FIFO, SCHED_RR or SCHED_SPORADIC, and the writer has the same priority as the calling thread, then pthread_rwlock_rdlock(lock) blocks until the writer releases the lock.
Failure details:
The writer has not released the lock in policy 1.
Thread exited with error
child process was terminated by signal 11 (SIGSEGV)

pthread_rwlock_timedrdlock

  1. Writer did not release the lock after the timeout period

pthread_setcancelstate

  1. returned 0 when state was neither PTHREAD_CANCEL_ENABLE nor PTHREAD_CANCEL_DISABLE (expected EINVAL)


regexp.h

regcomp(3)

  1. regcomp(preg, "xyab\\{3,\\}jk\\{", 0) (unbalanced \{\}) returns REG_BADBR instead of REG_EBRACE or REG_BADPAT
  2. regcomp(preg, "^?xyz", REG_EXTENDED) (? not proceeded by valid regex) succeeds instead of returning REG_BADRPT or REG_BADPAT
  3. regcomp(preg, "[][.-.]-0]", <any>) returns REG_ECOLLATE instead of succeeding (] represents itself in a bracket expression when it appears as the first character)


signal.h

  1. Missing #define: NSIG

psiginfo(3)

  1. changes wide-oriented stderr to byte-oriented fixed upstream

sigismember(3)

  1. Invalid signals return 0 instead of -1 / EINVAL


stdio.h

  1. Missing gets() declaration initial build used /usr/bin/cc instead of /usr/bin/c99

fclose(3)

  1. fclose() is not automatically performnd when abort() is called

fileno(3)

  1. Calling fileno on a stream opened by open_memstream returns 0 instead of -1 and setting errno to EBADF
  2. Calling fileno on a stream opened by open_wmemstream returns 0 instead of -1 and setting errno to EBADF
  3. Calling fileno on a stream opened by fmemopen returns 0 instead of -1 and setting errno to EBADF

fmemopen(3)

  1. fmemopen with mode set to w+ does not truncate the buffer

fopen(3)

  1. fopen("not-directory/", "w") returns EISDIR, not ENOENT or ENOTDIR

freopen(3)

  1. freopen reuses previous stream's fd number
  2. freopen does not reuse numbers of fds that are closed
  3. freopen has same bug as fopen #1

fwide(3)

  1. fwide(fp, 0) where fp is opened by open_memstream returns 0 instead of <0 (memstreams are always byte oriented) fixed upstream
  2. fwide(fp, 0) where fp is opened by open_wmemstream returns 0 instead of >0 (wide oriented) fixed upstream

getdelim(3)

  1. Some really freaky thing where calling it twice changes *n; investigate further --awilfox@

perror(3)

  1. perror(72) fails due to strerror #1

printf(3) family

  1. On non-x86 machines: printf("%.a\n", 22.345) has a radix character, when . followed by no digit shall be treated as zero patch available from Rich, integrated in to -r12

rename(3)

  1. Illegally accepts "." and ".." as the final path component of either argument.

strerror / perror

  1. strerror(72(EMULTIHOP)) returns "No error information" fixed in -r12


stdlib.h

system(3)

  1. Returns -1 on !cmd always, when it should test existance of /bin/sh first. fixed in -r12
  2. alarm(5); system("sleep 10"); returns 32512 (0x7f00) instead of -1 / ECHILD fixed upstream


string.h

strtof(3)

  1. strtof("0.5877471754111437539843682686111228389093e-38") does not fail with ERANGE (wow, that's specific)

strtold(3)

  1. a similarly specific value does not fail with ERANGE


termios.h

  1. On PowerPC systems (32 and 64): NL2 and NL3 are defined when they are not part of the POSIX standard, illegally polluting the namespace.
  2. Setting speed is highly broken. ispeed is incorrectly always set to ospeed, and it is stored in c_flag instead of ispeed/ospeed. However, the only POSIX failure is cfsetispeed does not work when passed B0, which is actually specifically ignored by musl.


time.h

timer_getoverrun

  1. "If the number of such extra expirations is greater than or equal to {DELAYTIMER_MAX}, then the overrun count shall be set to {DELAYTIMER_MAX}." Return value 35 is > sysconf(_SC_DELAYTIMER_MAX) = 32


unistd.h

  1. Missing #define: _POSIX2_C_VERSION
  2. Illegal definitions in strict mode (_POSIX_C_SOURCE=200809, no other FTMs):
    1. POSIX_CLOSE_RESTART
    2. pipe2
    3. posix_close
    4. dup3

exec(3) family

  1. Does not delete per-process timers before replacing the current process image with the new process image. (Required for _POSIX_TIMERS conformance) [execl,execle,execlp,execv,execve,execvp]

getcwd(3)

  1. Fails with ENAMETOOLONG when a path exceeds PATH_MAX despite being passed a buffer which is the proper length, which is prohibited

getopt(3)

  1. Diagnostic output is wrong ("unrecognized option: " vs "illegal option -- ") [FIP]
  2. Many conformance issues; poke awilfox@ for info patch available from dalias, applied to -r12

isatty(3) isahack

  1. Returns 0 on a fd associated with /dev/null.
  2. Does not raise an error when given a closed fd.

sysconf(3)

  1. sysconf(_SC_EXPR_NEST_MAX) errors, when it should return a value larger or equal to EXPR_NEST_MAX
  2. same for _SC_LINK_MAX vs LINK_MAX
  3. sysconf(_SC_V7_ILP32_OFFBIG) returned 0 instead of -1, despite _POSIX_V7_ILP32_OFFBIG being undefined fixed upstream
  4. sysconf(_SC_DELAYTIMER_MAX) is 32, while DELAYTIMER_MAX is 2147483647 (sysconf must be >= DELAYTIMER_MAX) fixed upstream
  5. sysconf(_SC_REALTIME_SIGNALS) returns 1, it should return 200809 fixed upstream


wchar.h

vfwprintf(3)

  1. Field width for 'c' character specification is ignored patch available, applied to -r12


wordexp.h

wordexp(3)

  1. When WRDE_SHOWERR flag is not set, output is still written to stderr
  2. '|', '&', ';', '<', '>', '{ }', and '( )' are accepted in wordexp input instead of returning WRDE_BADCHAR [CVE?]
  3. WRDE_UNDEF is ignored [CVE?]
  4. wordexp("`for i in \ndone`", ...) succeeded instead of returning WRDE_SYNTAX


VSX: Kernel issues

kill(2)

  1. kill(-1, <signal>) does not deliver the signal to the process that called kill.

link(3)

  1. Calling link with a non-existent directory in the second argument with a slash at the end (i.e. link("file-that-exists", "dir-that-doesnt/")) shall return ENOTDIR, not ENOENT.

open(2)

  1. creat("test", S_IRUSR | S_IWUSR); open("test", O_EXEC); should fail with -1 / EACCES (no +x set)
  2. open("directory", O_SEARCH); should fail with -1 / EACCES when no +x permission is granted
  3. Same path bug (EISDIR) as fopen(3) #1

waitpid(2)

  1. Blocking SIGCHLD and calling wait() should not make SIGCHLD pending when wait() returns due to a child process status being available.


VSX: Environment issues

CS_PATH

The following commands were not found in CS_PATH when adelie-base-posix was installed:

  1. alias
  2. command
  3. crontab
  4. fc
  5. gencat
  6. getopts
  7. locale
  8. lp
  9. read
  10. tabs
  11. talk
  12. time
  13. tput
  14. unalias
  15. write

Some of these are UP / XSI. We may need to modify musl's responses to _POSIX2_PBS etc.


VSX: test deficiencies

strftime(3)

  1. NULL dereference in test 10

tar.h

  1. TSVTX is marked as XSI option in POSIX standard text; tested for with _POSIX_C_SOURCE=200809