On Thursday 26 March 2009 11:46:44 Arno Lehmann wrote: > Hi, > > I noticed that date displays are broken here: > > *sta dir > demo-dir Version: 2.5.42-b2 (16 March 2009) i686-pc-linux-gnu suse 11.1 > Daemon started 24-Mär009 09:56, 788 Jobs run since started. > ^^^ > Heap: heap=3,129,344 smbytes=2,108,145 max_bytes=2,173,372 > bufs=2,595 max_bufs=7,061 > > Now, in the source, I see that the date is converted into a buffer of > length MAX_TIME_LENGTH, wich is set to 50 in baconfig.h. > > As you see above, the locale I'm running the daemon in is german; the > terminal I use is set to use UTF-8. > > I'm wondering why the "-2" from 'Mär-22009' is left out... I assume it > might have to do with the A-Umlaut encoding in UTF-8. > > This is a hexdump of the output: > > 00000080 69 72 0a 64 65 6d 6f 2d 64 69 72 20 56 65 72 73 |ir.demo-dir > > Vers| 00000090 69 6f 6e 3a 20 32 2e 35 2e 34 32 2d 62 32 20 28 |ion: > > 2.5.42-b2 (| 000000a0 31 36 20 4d 61 72 63 68 20 32 30 30 39 29 20 69 > > |16 March 2009) i| 000000b0 36 38 36 2d 70 63 2d 6c 69 6e 75 78 2d 67 > > 6e 75 |686-pc-linux-gnu| 000000c0 20 73 75 73 65 20 31 31 2e 31 0a 44 > > 61 65 6d 6f | suse 11.1.Daemo| 000000d0 6e 20 73 74 61 72 74 65 64 20 > > 32 34 2d 4d c3 a4 |n started 24-M..| 000000e0 72 30 30 39 20 30 39 3a > > 35 36 2c 20 37 39 32 20 |r009 09:56, 792 | > > In the next-to-last line, you see the two UTF-8 bytes; the whole date > / time string is definitely not exceeding the 50 bytes maximum buffer > size. > > So, somewhere the '-2' missing in between are eaten. This probably > happens in Bacula, as a minimal program of 'setlocale(LC_ALL, ""); > strftime(...) with a buffer size of 50 chars returns a correct result. > I suspect localtime_r might have to do with this, but I don't > understand what that does... > > Now, this is neither critical nor hard to prevent (just run without > locale set), but I think it's something that should be thought > about... after all, we're having nice GUIs, translation is possible > for them, and I believe the output from the DIR should be as readable > as possible. >
As you indicate the problem is the umlaut and due to the fact that Bacula printfs are not UTF-8 aware. Someday, we will probably need to make them so ... ------------------------------------------------------------------------------ _______________________________________________ Bacula-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/bacula-devel
