#3790 new defect

Terminal should block in default config case

Reported by: Andreas Werner Owned by:
Priority: normal Milestone:
Component: posix Version: 5
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

Terminal should block in default config case

expected behaviour

Open terminal without configure over tcsetattr.
read block until new line ICANON is in termios.c_lflag set in default case.

undesired behaviour

Open terminal without configure over tcsetattr.
read return with return value 0. After reset the default settings with tcgetattr and tcsetattr read shown expected behavior (see Example Code).

target hardware

TMS570 with bugfixes see Bug #3789

toolchain version

Modified GCC, binutils and gdb build script to build armeb compiler build with RTEMS Source Builder master(see patches for RTEMS Soucre Builder)
I need a ARM Compiler with Big Endian Support as default for TMS570 see Bug #3789

configuration options for bsp

../rtems/configure '--prefix=[bsp path]/bsp/armeb-rtems5' '--host=arm-rtems5' '--target=arm-rtems5' '--enable-posix' '--enable-rtems-debug' '--disable-tests' '--disable-networking' '--enable-rtemsbsp=tms570ls3137_hdk' 'CC_FOR_TARGET=armeb-rtems5-gcc' 'CXX_FOR_TARGET=armeb-rtem5-gcc' 'AR=armeb-rtems5-ar' 'TMS570_USE_HWINIT_STARTUP=1'

Test on master commit RTEMS (4a9a58ea8ad75248af5876c01ef654f9bc59c312) with patches for TMS570 see bug #...

Example source code

See test.tar.gz

Bug Fix

Add initialization for wait variable in tty struct in rtems_termios_open_tty function see patch

Change History (6)

comment:1 Changed on Aug 23, 2019 at 8:54:51 AM by Andreas Werner

I can't upload Atachments the patches and files can be found under: ​https://www.cs.hs-rm.de/~werner/rtems/bugreport/

comment:2 Changed on Aug 26, 2019 at 5:39:17 AM by Sebastian Huber

I am not sure if default Termios settings are specified by POSIX or Linux. Do you have a reference?

Attaching patches should work. What was the error message?

comment:3 Changed on Aug 26, 2019 at 7:49:55 AM by Andreas Werner

Yes the default terminal settings are not defined but is defined the terminal must be initialized. If your Implementation set a default settings this settings should work.
At section 11.1.1 of POSIX Spec[1] is defined:

Opening a modem or similar piece of equipment connected by a serial line. In this case, the terminal parameters (see Section 11.2, on page 205) may be initialized to default settings by the implementation in between the last close of the device by any process and the next open of the device, or they may persist from one use to the next. The terminal parameters can be set to values that ensure the terminal behaves in a conforming manner by means of the O_TTY_INIT open flag when opening a terminal device that is not already open in any process, or by executing the stty utility with the operand sane.

In the Linux kernel every read check the settings and configure the timeout[2].
The default settings in Linux kernel are defined here[3] and differiert to your settings.
There was no error message the read call return with 0. For a normal file this mean End-of-file. A return value of 0 is not specified in Canonical mode by POSIX for spezial files.

[1] IEEE Std. 1003.1 Standard for Information Technology—
Portable Operating System Interface (POSIX) - 2016 Edition
[2] https://elixir.bootlin.com/linux/v5.2.10/source/drivers/tty/n_tty.c#L2132
[3] https://elixir.bootlin.com/linux/v5.2.10/source/drivers/tty/tty_io.c#L121

Last edited on Aug 26, 2019 at 2:29:11 PM by Andreas Werner (previous) (diff)

comment:4 Changed on Aug 27, 2019 at 5:02:38 AM by Sebastian Huber

I am not sure if I understood the report correctly. The bug is that you open the device and ICANON is set, but it doesn't behave like this?

comment:5 Changed on Aug 27, 2019 at 7:42:55 AM by Andreas Werner

Yes, it behave like the device is in polling mode (~ICANON, VMIN=0, VTIME=0).
Start my small test Application after setting the default setting again read wait until newline or the buffer is full (Canonical mode).

comment:6 Changed on Aug 27, 2019 at 7:48:40 AM by Sebastian Huber

I have little time to take care of this ticket. I think the first step would be to add a generic test case to the testsuites/libtests/termios* tests or add a new test program which reproduces the problem on a simulator BSP, e.g. sparc/erc32.

Note: See TracTickets for help on using tickets.