Menu ▾ ▴

#747 tests/streams: Failing test on pipe stdout file descriptor

build problems
open
5
2022-02-09
2021-06-23
No

Working on the debian package clisp version: 1:2.49.20180218+really2.49.92-3+b4
there's an issue related to the streams tests failing on a pipe stdout file descriptor.

Building clisp package in an OBS instance FTBFS because of the following
test failure:

https://salsa.debian.org/common-lisp-team/clisp/-/blob/0a8137b7caa777e1c08e06fa7161784f947fa5af/tests/streams.tst#L1290

(let ((reopen-open-file nil)) ; stdout can be a file, it will be detected!
(with-open-file (copy s :direction :output) (streamp copy))) T

Build error log shows the following output for that test:

$ cat usr/src/packages/BUILD/debian/build/tests/.erg
Form: (LET ((
REOPEN-OPEN-FILE* NIL)) (WITH-OPEN-FILE (COPY S
:DIRECTION :OUTPUT) (STREAMP COPY)))
CORRECT: T
CLISP : ERROR
OS-FILE-ERROR(13): Permission denied
OUT:
"[OS-FILE-ERROR]: OS-FILE-ERROR(13): Permission denied
"

That Lisp form tries to open the stdout file descriptor, but in this
case it's failing with EACCES (Permission denied).

AFAICS, running strace on the test shows that on the OBS instance,
stdout is piped, causing the access issue:

[ 148s] lstat("/proc/2867342/fd/2", {st_mode=S_IFLNK|0300,
st_size=64, ...}) = 0
[ 148s] readlink("/proc/2867342/fd/2", "pipe:[4065697]", 64) = 14
[ 148s] stat("/proc/2867342/fd/2", {st_mode=S_IFIFO|0600, st_size=0,
...}) = 0
[ 148s] openat(AT_FDCWD, "/proc/2867342/fd/2",
O_WRONLY|O_CREAT|O_TRUNC, 0644) = -1 EACCES (Permission denied)

However, on a "local" build, stdout going directly to the pseudo
terminal doesn't raise any issue:

lstat("/proc/2901662/fd/2", {st_mode=S_IFLNK|0700, st_size=64, ...}) = 0
readlink("/proc/2901662/fd/2", "/dev/pts/1", 64) = 10
readlink("/dev", 0x7fff7e9fbd30, 4095) = -1 EINVAL (Invalid argument)
readlink("/dev/pts", 0x7fff7e9fbd30, 4095) = -1 EINVAL (Invalid argument)
lstat("/dev/pts/1", {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0x1),
...}) = 0
stat("/dev/pts/1", {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0x1),
...}) = 0
openat(AT_FDCWD, "/dev/pts/1", O_WRONLY|O_CREAT|O_TRUNC, 0644) = 10

This seems to be related to how output fds are handled. AFAICS there's a
difference between these two cases, see:

https://salsa.debian.org/common-lisp-team/clisp/-/blob/0a8137b7caa777e1c08e06fa7161784f947fa5af/src/pathname.d#L5426

Is this an issue and should be checked? What's the expected behaviour on
these cases?

Related submitted debian issue for reference: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=990244

Discussion

  • Sam Steingold

    Sam Steingold - 2022-02-09

    I agree with the analysis in the debian bug by Dennis Filder:

    In a test suite you usually can since it is probably not supposed to
    be run by a privileged user in such a way that it fails. Build
    servers and CI pipelines, which are almost always involved in exposing
    such bugs, really ought to put in more effort to make their
    environment more similar to the one the developer develops and tests
    the code in instead of silently expecting everyone else to put in the
    additional effort to placate them.

    I suggest that you either disable the test locally or run in a more permissive environment.

     

    Last edit: Sam Steingold 2022-02-09

Log in to post a comment.