[RTEMS Project] #3870: libc_reent set up is broken

RTEMS trac trac at rtems.org
Wed Feb 12 05:05:08 UTC 2020


#3870: libc_reent set up is broken
-------------------------+---------------------
 Reporter:  Chris Johns  |       Owner:  (none)
     Type:  defect       |      Status:  new
 Priority:  high         |   Milestone:  5.1
Component:  score        |     Version:  5
 Severity:  normal       |  Resolution:
 Keywords:               |  Blocked By:
 Blocking:  3859         |
-------------------------+---------------------

Comment (by Chris Johns):

 Replying to [comment:6 Sebastian Huber]:
 > It would be good to have a test case that shows the problem. Maybe for
 libtests/newlib01.

 Here is the patch (it is what happens in my shell patch)...

 {{{
 diff --git a/testsuites/libtests/newlib01/init.c
 b/testsuites/libtests/newlib01/init.c
 index 74e648799e..c7eb5c4e81 100644
 --- a/testsuites/libtests/newlib01/init.c
 +++ b/testsuites/libtests/newlib01/init.c
 @@ -69,6 +69,8 @@ static void worker_task(rtems_task_argument arg)
    stdout = fopen(&file_path[0], "r+");
    rtems_test_assert(stdout != NULL);

 +  setvbuf(stdout,NULL,_IONBF,0);
 +
    n = fwrite(&buf[0], sizeof(buf), 1, stdout);
    rtems_test_assert(n == 1);

 }}}

 It gives what I expected ...

 {{{
 *** BEGIN OF TEST NEWLIB 1 ***
 *** TEST VERSION: 5.0.0.adf7e7538f3815db5ee5944daee82bb7053baf90-modified
 *** TEST STATE: EXPECTED_PASS
 *** TEST BUILD: RTEMS_NETWORKING RTEMS_POSIX_API
 *** TEST TOOLS: 7.5.0 20191114 (RTEMS 5, RSB 5 (69dcab76853c modified),
 Newlib d14714c69)
 /opt/work/chris/rtems/kernel/rtems.git/c/src/../../testsuites/libtests/newlib01/init.c:
 77 ctx->current == OPEN

 }}}
 > To me it looks that you need reference counted FILE objects?

 It is not to do with reference counts, it is about initialisation of the
 `struct __reent` in our TCB. I cannot see a suitable interface in newlib
 to do this. I will play and see if I can get the test to pass.

--
Ticket URL: <http://devel.rtems.org/ticket/3870#comment:7>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list