Skip to content

ioctl: Forward standard termios calls to real pty#279

Open
martinpitt wants to merge 1 commit intomainfrom
termio-ioctl
Open

ioctl: Forward standard termios calls to real pty#279
martinpitt wants to merge 1 commit intomainfrom
termio-ioctl

Conversation

@martinpitt
Copy link
Owner

Handle ioctls TCGETS{,2} and friends on emulated TTY devices by forwarding them to the underlying PTY. Our ioctl handler previously always returned ENOTTY for these, unless there was an explicit handler.

This fixes tests with uutils (Rust coreutils)' stty implementation, the current Ubuntu development series just switched to that [1].

GNU coreutils avoids that problem:

  1. Opens (emulated) /dev/ttyUSB1 as fd 3
  2. dup2(3,0) = 0
  3. close(3)
  4. ioctl(0, TCGETS2, ...) = 0

i.e. it bypasses the emulation and does the ioctl on the real underlying PTY.

Rust coreutils does not do the dup() step, but calls TCGETS2 on the /dev/ttyUSB1 directly, so it previously got ENOTTY and failed.

[1] https://launchpad.net/ubuntu/+source/rust-coreutils/0.6.0-0ubuntu1


Fixes the ubuntu/devel failure which started a few days ago.

Handle ioctls TCGETS{,2} and friends on emulated TTY devices by
forwarding them to the underlying PTY. Our ioctl handler previously
always returned `ENOTTY` for these, unless there was an explicit
handler.

This fixes tests with uutils (Rust coreutils)' `stty` implementation,
the current Ubuntu development series just switched to that [1].

GNU coreutils avoids that problem:
 1. Opens (emulated) /dev/ttyUSB1 as fd 3
 2. dup2(3,0) = 0
 3. close(3)
 4. ioctl(0, TCGETS2, ...) = 0

i.e. it bypasses the emulation and does the ioctl on the real underlying
PTY.

Rust coreutils does *not* do the dup() step, but calls TCGETS2 on the
/dev/ttyUSB1 directly, so it previously got ENOTTY and failed.

[1] https://launchpad.net/ubuntu/+source/rust-coreutils/0.6.0-0ubuntu1
@martinpitt
Copy link
Owner Author

ppc64le trouble:

not ok /umockdev-testbed-vala/usbfs_ioctl_static - ERROR:../tests/test-umockdev-vala.vala:296:t_usbfs_ioctl_static: assertion failed (ioctl (fd, 0x5413, &tio_data) == 0): (-1 == 0)

will look later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant