Created attachment 1242291 [details] C translation of Rust's env-funky-keys.rs Description of problem: Rust builds are hanging in %check on test rust-pass/env-funky-keys. https://github.com/rust-lang/rust/blob/master/src/test/run-pass/env-funky-keys.rs I can also hang with a similar program written in C, attached, so let's focus on that. The same binary copied to F25 runs fine. Version-Release number of selected component (if applicable): glibc-2.24.90-28.fc26 How reproducible: 100% Steps to Reproduce: 1. gcc env-funky-keys.c 2. ./a.out Actual results: The program execs and then never terminates -- never even reaches main. Expected results: The program should exec and then main should return 0. Additional info: Stepping 'next' in gdb just bounces between dl-tunables.c:86 and :90. (gdb) bt #0 get_next_env (val=<synthetic pointer>, namelen=<synthetic pointer>, name=<synthetic pointer>, envp=0x7fffffffee40) at dl-tunables.c:86 #1 __tunables_init (envp=0x7fffffffee40) at dl-tunables.c:317 #2 0x00007ffff7df0d53 in _dl_sysdep_start ( start_argptr=start_argptr@entry=0x7fffffffee20, dl_main=dl_main@entry=0x7ffff7dd8b10 <dl_main>) at ../elf/dl-sysdep.c:224 #3 0x00007ffff7ddc0b8 in _dl_start_final (arg=0x7fffffffee20) at rtld.c:303 #4 _dl_start (arg=0x7fffffffee20) at rtld.c:409 #5 0x00007ffff7dd7e58 in _start () from /lib64/ld-linux-x86-64.so.2 #6 0x0000000000000002 in ?? () #7 0x00007fffffffefa0 in ?? () #8 0x00007fffffffefbb in ?? () #9 0x0000000000000000 in ?? () (gdb) list 81,98 81 while (envp != NULL && *envp != NULL) 82 { 83 char *envline = *envp; 84 int len = 0; 85 86 while (envline[len] != '\0' && envline[len] != '=') 87 len++; 88 89 /* Just the name and no value, go to the next one. */ 90 if (envline[len] == '\0') 91 continue; 92 93 *name = envline; 94 *namelen = len; 95 *val = &envline[len + 1]; 96 97 return ++envp; 98 } It looks to me like the continue is missing ++envp.
Looking at this right now. Thanks for the bug Josh.
Oh sorry I forgot to actually update the bug. I've got tests running with a candidate patch that I'll post upstream shortly.
(In reply to Siddhesh Poyarekar from comment #2) > Oh sorry I forgot to actually update the bug. I've got tests running with a > candidate patch that I'll post upstream shortly. Awesome. Assigned to you then :-) Thanks Siddhesh!
(In reply to Carlos O'Donell from comment #3) > (In reply to Siddhesh Poyarekar from comment #2) > > Oh sorry I forgot to actually update the bug. I've got tests running with a > > candidate patch that I'll post upstream shortly. > > Awesome. Assigned to you then :-) > > Thanks Siddhesh! Note: - We don't need an upstream bug because this was an regression introduced during development. - Would be nice to have a test case just to keep testing empty env var processing.
Posted patch upstream: https://sourceware.org/ml/libc-alpha/2017-01/msg00390.html
Patch pushed, so the next rawhide rebase should have this fix.
Confirmed in glibc-2.24.90-29.fc26, thanks!