ttyname_r returns ENODEV error in strict confinement
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
snapd |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
I stumbled upon this issue when printing to the terminal in a Crystal app without a newline at the end. The text would not be flushed out immediately.
Digging through the Crystal sourcecode i found that https:/
The following test code reveals the issue:
require "c/fcntl"
puts "--> tty?: #{STDOUT.tty?} / sync?: #{STDOUT.sync?} / close_on_exec?: #{STDOUT.
path = uninitialized UInt8[256]
ret = LibC.ttyname_
puts "LibC.ttyname_r: #{ret}"
puts "Errno.value: #{Errno.value}"
clone_fd = LibC.open(path, LibC::O_RDWR)
puts "LibC.open: #{clone_fd}"
Running the code outside of snap or in a "classic" confinement works as expected:
--> tty?: true / sync?: true / close_on_exec?: false
LibC.ttyname_r: 0
Errno.value: NONE
LibC.open: 7
In a "strict" confinement:
--> tty?: true / sync?: false / close_on_exec?: false
LibC.ttyname_r: 19
Errno.value: ENODEV
LibC.open: -1
The error code `ENODEV` is defined as follows (from https:/
Macro: int ENODEV
“No such device.” The wrong type of device was given to a function that expects a particular sort of device.
Is this a bug in the behaviour of the snap sandbox?
description: | updated |
description: | updated |
Changed in snapd: | |
status: | New → Confirmed |
Moved to the snapd queue as this is confinement related.