[Bug 471386] New: long 'last -aF' output may lack a newline
https://bugzilla.novell.com/show_bug.cgi?id=471386 Summary: long 'last -aF' output may lack a newline Classification: openSUSE Product: openSUSE 10.3 Version: Final Platform: All OS/Version: openSUSE 10.3 Status: NEW Severity: Minor Priority: P5 - None Component: Basesystem AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: jmichaud@sgi.com QAContact: qa@suse.de Found By: --- User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 With sufficiently long login hostnames, the output lines from 'last -aF' may not have newlines. Consecutive output lines become concatenated. The cause is simple enough. Looking in sysvinit-2.86-102/sysvinit-2.86/src/last.c: .. 472 } else { 473 snprintf(final, sizeof(final), 474 fulltime ? 475 "%-8.8s %-12.12s %-24.24s %-26.26s %-12.12s %s\n" : 476 "%-8.8s %-12.12s %-16.16s %-7.7s %-12.12s %s\n", 477 p->ut_name, utline, 478 logintime, logouttime, length, domain); 479 } 480 } else .. We need to ensure the NUL character stays there when a long domain is printed out. This would probably work: .. 472 } else { 473 snprintf(final, sizeof(final), 474 fulltime ? 475 "%-8.8s %-12.12s %-24.24s %-26.26s %-12.12s %s\n" : 476 "%-8.8s %-12.12s %-16.16s %-7.7s %-12.12s %s\n", 477 p->ut_name, utline, 478 logintime, logouttime, length, domain); 479 final[127] = 0; 480 } 481 } else .. Reproducible: Always Steps to Reproduce: 1. login from a machine with a long hostname (more than 42 or so characters) 2. last -aF Actual Results: foobar pts/7 Sat Jan 31 19:22:15 2009 - Sat Jan 31 19:44:08 2009 (00:21) ddeeff-abcdefg.abcd.abcde.edu abcde pts/5 Sat Jan 31 18:55:32 2009 - Sat Jan 31 21:01:23 2009 (02:05) abcd-111-22-0-555.washdc.fios.verizon.nefoobar pts/5 Sat Jan 31 18:40:00 2009 - Sat Jan 31 18:40:41 2 009 (00:00) ddeeff-abcdefg.abcd.abcde.edu hhiij pts/3 Sat Jan 31 18:03:54 2009 - Sat Jan 31 20:04:12 2009 (02:00) ab12345678-5544.bb.online.no Expected Results: foobar pts/7 Sat Jan 31 19:22:15 2009 - Sat Jan 31 19:44:08 2009 (00:21) ddeeff-abcdefg.abcd.abcde.edu abcde pts/5 Sat Jan 31 18:55:32 2009 - Sat Jan 31 21:01:23 2009 (02:05) abcd-111-22-0-555.washdc.fios.verizon.net foobar pts/5 Sat Jan 31 18:40:00 2009 - Sat Jan 31 18:40:41 2009 (00:00) ddeeff-abcdefg.abcd.abcde.edu hhiij pts/3 Sat Jan 31 18:03:54 2009 - Sat Jan 31 20:04:12 2009 (02:00) ab12345678-5544.bb.online.no -- 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=471386 User jmichaud@sgi.com added comment https://bugzilla.novell.com/show_bug.cgi?id=471386#c1 --- Comment #1 from Joseph Michaud <jmichaud@sgi.com> 2009-02-01 20:36:26 MST --- Trying a different system, I see that I must use "last -adF" to show the problem, whereas on the original machine I only needed "last -aF". The original system (SLES 10.2) has sysvinit-2.86-21.20. The "different" system (SLES 10.1) has sysvinit-2.86-21.15. -- 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=471386 Cyril Hrubis <chrubis@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|bnc-team-screening@forge.pr |werner@novell.com |ovo.novell.com | -- 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=471386 User werner@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=471386#c2 Dr. Werner Fink <werner@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #2 from Dr. Werner Fink <werner@novell.com> 2009-02-20 08:43:26 MST --- Setting last character to ascii 0 does not help. I'm now checking for the return value of snprintf and if -1 or greater or equal than sizeof(final) print out the final newline. Fixed for next release -- 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