Hello,

Etienne Brateau, le dim. 01 mars 2026 16:43:40 +0100, a ecrit:
> void *func(void * a)  {
>         // printf("start\n");
>         // fflush(stdout);
>         for (int i = 0; i < 9; i++) {
>                 printf("out: %i\n", i);
>                 //printf("out\n");
>                 fflush(stdout);
>         }
> }
> 
> int main() {
> 
>         pthread_t a[9];
> 
>         for (int i = 0; i < 9; i++) {
>                 pthread_create(&a[i], NULL, func, NULL);
>         }
> 
>         for (int i = 0; i < 9; i++) {
>                 pthread_join(a[i], NULL);
>         }
> 
>         return 0;
> }
> ===
> 
> Basically this program should output 81 lines (9 threads printing 9 lines), 
> but
> it actually print less. (I usually do `./a.out | wc -l`)

Oh, god...

We have been missing libio-safety since glibc 2.26 because somebody
optimized it away for single-threaded programs without taking care that
htl would also need the _IO_enable_locks call...

I have pushed a fix to upstream and debian.

I'll upload fixed glibcs, since it's so grave a bug.

Thanks for the simple testcase!
Samuel

Reply via email to