[Bug 731556] New: bash: ~user paths completion does not work
https://bugzilla.novell.com/show_bug.cgi?id=731556 https://bugzilla.novell.com/show_bug.cgi?id=731556#c0 Summary: bash: ~user paths completion does not work Classification: openSUSE Product: openSUSE 12.1 Version: Final Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: P5 - None Component: Basesystem AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: jslaby@suse.com QAContact: qa@suse.de CC: werner@suse.com Found By: --- Blocker: --- ls ~xslaby<TAB> does nothing. Strace shows that bash reads /etc/passwd and then calls futex(..., FUTEX_WAIT); and that's everything. open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=3126, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fa285006000 read(3, "root:x:0:0:root:/root:/bin/bash\n"..., 4096) = 3126 close(3) = 0 munmap(0x7fa285006000, 4096) = 0 futex(0x7fa28a22af30, FUTEX_WAIT, 2, NULL -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=731556 https://bugzilla.novell.com/show_bug.cgi?id=731556#c1 Dr. Werner Fink <werner@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aj@suse.com --- Comment #1 from Dr. Werner Fink <werner@suse.com> 2011-11-21 09:33:42 UTC --- Let's add glibc maintainer to carbon copy list as bash uses in bash-4.2/lib/tilde/tilde.c in tilde_expand_word() the getpwnam(3) library function call To avoid open memory mappings on e.g. /etc/passwd I've added in current factory the patches bash-4.2-endpw.dif and readline-6.2-endpw.dif to avoid the memory mapped /etc/passwd and also add a patch for boot shells to be sure that such a mapping will be removed for the shell running /etc/init.d/rc -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=731556 https://bugzilla.novell.com/show_bug.cgi?id=731556#c2 --- Comment #2 from Andreas Jaeger <aj@suse.com> 2011-11-21 10:50:07 UTC --- Jiri, what is your environment? * nscd running? * users handled via NIS etc? It works fine on my system: $ ls ~aj ~aj/ ~ajerome/ ~ajohansson/ ~ajorgensen Btw. does the following work for you: getent passwd xslaby -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=731556 https://bugzilla.novell.com/show_bug.cgi?id=731556#c3 --- Comment #3 from Jiri Slaby <jslaby@suse.com> 2011-11-21 11:03:26 UTC --- No, nscd is not installed. nsswitch says: passwd: compat So I have local-only passwords. I tried "passwd: files", it's the same. getent works as expected (instant reply): $ getent passwd xslaby xslaby:x:500:500:Jiri Slaby:/home/xslaby:/bin/bash -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=731556 https://bugzilla.novell.com/show_bug.cgi?id=731556#c4 --- Comment #4 from Jiri Slaby <jslaby@suse.com> 2011-11-21 11:03:58 UTC --- (In reply to comment #3)
So I have local-only passwords.
s/passwords/accounts/ -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=731556 https://bugzilla.novell.com/show_bug.cgi?id=731556#c5 --- Comment #5 from Andreas Jaeger <aj@suse.com> 2011-11-21 11:48:37 UTC --- Werner, then I have no idea what could be the case. How can this be reproduced with a small program? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=731556 https://bugzilla.novell.com/show_bug.cgi?id=731556#c6 --- Comment #6 from Jiri Slaby <jslaby@suse.com> 2011-11-21 11:57:47 UTC --- It's this: libreadline6 6.2-1.8.1 -> 6.2-41.1 Try installing that readline library from factory on the top of 12.1 and restart bash... Note that this is a factory machine. There is no way how to tell in bugzilla :/. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=731556 https://bugzilla.novell.com/show_bug.cgi?id=731556#c7 Andreas Jaeger <aj@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|bnc-team-screening@forge.pr |werner@suse.com |ovo.novell.com | --- Comment #7 from Andreas Jaeger <aj@suse.com> 2011-11-21 13:05:35 UTC --- OK, so for Werner to check. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=731556 https://bugzilla.novell.com/show_bug.cgi?id=731556#c8 --- Comment #8 from Jiri Slaby <jslaby@suse.com> 2011-11-21 13:17:11 UTC --- Removing the second hunk from readline-6.2-endpw.dif fixes the problem. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=731556 https://bugzilla.novell.com/show_bug.cgi?id=731556#c9 Dr. Werner Fink <werner@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |NEEDINFO InfoProvider| |jslaby@suse.com --- Comment #9 from Dr. Werner Fink <werner@suse.com> 2011-11-21 13:35:30 UTC --- Please give latest checkin a try as I've moved the endpw() function below the malloc() call which IMHO should solve the problem. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=731556 https://bugzilla.novell.com/show_bug.cgi?id=731556#c10 Jiri Slaby <jslaby@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |NEW InfoProvider|jslaby@suse.com | --- Comment #10 from Jiri Slaby <jslaby@suse.com> 2011-11-21 13:58:58 UTC --- (In reply to comment #9)
Please give latest checkin a try as I've moved the endpw() function below the malloc() call which IMHO should solve the problem.
It has no effect. Note that it's stuck in futex syscall. Which means it's probably __libc_lock_lock in endpwent. But why? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=731556 https://bugzilla.novell.com/show_bug.cgi?id=731556#c11 --- Comment #11 from Andreas Jaeger <aj@suse.com> 2011-11-21 14:05:31 UTC --- Werner, do you have a standalone test program? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=731556 https://bugzilla.novell.com/show_bug.cgi?id=731556#c12 --- Comment #12 from Jiri Slaby <jslaby@suse.com> 2011-11-21 14:06:33 UTC --- Backtrace btw. #0 __lll_lock_wait_private () at ./nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:93 #1 0x00007f98dbf84b70 in _L_lock_9 () from /lib64/libc-2.14.1.so #2 0x00007f98dbf84951 in setpwent () at ../nss/getXXent_r.c:126 #3 0x00007f98dc6b7872 in rl_username_completion_function (text=0x1c95f30 "~", state=<optimized out>) at ../complete.c:2042 #4 0x00007f98dc6b6723 in rl_completion_matches (text=0x1c95f30 "~", -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=731556 https://bugzilla.novell.com/show_bug.cgi?id=731556#c13 --- Comment #13 from Dr. Werner Fink <werner@suse.com> 2011-11-21 15:23:51 UTC --- (In reply to comment #11) Something like this #if !defined (savestring) #define savestring(x) strcpy ((char *)xmalloc (1 + strlen (x)), (x)) #endif /* !savestring */ int rl_filename_completion_desired = 0; char * rl_username_completion_function (const char *text, int state) { static char *username = (char *)NULL; static struct passwd *entry; static int namelen, first_char, first_char_loc; char *value; if (state == 0) { if (username) { free (username); username = (char *)NULL; } first_char = *text; first_char_loc = first_char == '~'; username = savestring (&text[first_char_loc]); namelen = strlen (username); setpwent (); } while ((entry = getpwent ())) { if (strncmp (username, entry->pw_name, namelen) == 0) break; } if (entry == 0) { endpwent (); return ((char *)NULL); } else { value = (char *)xmalloc (2 + strlen (entry->pw_name)); *value = *text; strcpy (value + first_char_loc, entry->pw_name); if (first_char == '~') rl_filename_completion_desired = 1; endpwent (); return (value); } } -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=731556 https://bugzilla.novell.com/show_bug.cgi?id=731556#c14 --- Comment #14 from Dr. Werner Fink <werner@suse.com> 2011-11-21 15:30:58 UTC --- Created an attachment (id=463195) --> (http://bugzilla.novell.com/attachment.cgi?id=463195) simple C progy -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=731556 https://bugzilla.novell.com/show_bug.cgi?id=731556#c15 Dr. Werner Fink <werner@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #15 from Dr. Werner Fink <werner@suse.com> 2011-11-21 15:53:47 UTC --- Just disabled this one endpwent() as it seems that out functions also call (x)malloc(). If this does not help then please reopen. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=731556 https://bugzilla.novell.com/show_bug.cgi?id=731556#c16 --- Comment #16 from Bernhard Wiedemann <bwiedemann@suse.com> 2011-11-21 17:00:18 CET --- This is an autogenerated message for OBS integration: This bug (731556) was mentioned in https://build.opensuse.org/request/show/92891 Factory / bash -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com