03:21:33 [illumos-gate] 16708 SMBIOS 3.8 Support -- Robert Mustacchi 03:21:33 [illumos-gate] 16709 smbios tests should also be built 64-bit -- Robert Mustacchi 09:07:43 [illumos-gate] 16705 Want lifetime extensions for TCP_MD5SIG SAs -- Andy Fiddaman 17:31:50 um... is there any known reason why mdb_printf("%*s", 8, str); should ignore width 8? 17:33:22 I don't see it listed as an accepted item in the book. 17:33:51 Not a great link, but §10.4.22 in https://illumos.org/books/mdb/api-5.html#api-5 17:34:11 git grep gound few, like: modules/genunix/leaky.c: mdb_printf("%*s => %lld\n", 30, str, stat); 17:34:50 Hmm, I guess it is in iob_doprnt. 17:34:53 also in genunix etc... 17:35:21 yes, and I did check iob_doprnt. it should work.... 17:35:37 Well, then I'm afraid you'll have to debug. 17:36:22 I'm getting output : BPB Volume Label: "NONAME FAT32 and some printable garbage till closing " 17:36:57 the printf itself is: mdb_printf("\"%*s\"", 11, bpb_VolLab32(bpb)); 17:37:34 I guess its a bit buggy:) 17:40:25 could it be the string itself? e.g. fixed-length and non-NUL terminated? 17:40:53 the string is not NUL terminated, no 17:40:54 that it's maybe treating as if it was 17:41:16 um. 17:41:32 I can never remember offhand but I thought one of those was just 'pad up to X size if needed' 17:41:38 while the other would truncate 17:41:56 (for printf(3C), not sure about mdb) 17:41:57 yea, i started to wonder if I was mixing things up 17:42:20 '%*s' vs '%.*s' 17:43:09 The * is the minimum field width. 17:43:15 it's one of those things i have to re-read and re-parse the man page 17:43:29 because i never use it frequently enough to remember it before I need it again :) 17:43:35 If you pass %s I don't think there's a get out of termination free card. 17:44:00 The . is the maximum, but again, that's not a promise it won't call strlen. 17:46:50 BPB Volume Label: ".*s" :) 17:46:50 OK, reading POSIX it says something not as clear as you'd like, but "If the precision is not specified or is greater than the size of the array, the application shall ensure that the array contains a null byte.". 17:47:10 Which to me suggests that it means you can get away with what you're doing with no NUL. 17:48:18 # printf "%.*s\n" 5 "qwertyuiop" 17:48:18 qwert 17:48:50 but apparently mdb_printf does not grok %.*s 17:52:06 then probably just need to copy it to a local buffer so you can terminate it... 17:53:24 though in the context of mdb, given that fixed length strings like that aren't _that_ uncommon, it might be worth figuring out something appropriate to help deal with them better (though not sure offhand what that would look like specifically) 17:54:32 '.' can be added to iob_doprnt() - it should not be that hard:) 17:55:23 but yes, quick answer is to use local buffer. 17:57:16 the format parser is huge switch and the annoying part is to walk over all the cases where precision might appear, as its not just about %s 17:57:38 Whether it's a huge switch or not, the precision does impact everything. ;) 17:57:49 yep:) 17:58:49 yea, and while there, it would be nice to have %zu and %zd and friends:) 17:59:44 That's a bit easier. 18:01:00 ok, I better see what is still broken in mkfs_pcfs ... 18:01:42 and it's probably a bit less messy than _doprnt() since it doesn't have to deal with wide characters or %n$ 18:07:20 I feel like we have several _doprnt that would be better being as similar as possible 18:07:25 (I doubt they can really be the same) 18:07:31 (and i don't think mdb is utilizing stupid pet^Wva_arg() tricks) 18:07:40 if I remember, we sort of had one of those somewhere 18:08:08 well there was the optimized assembler version in vi 18:08:18 that i think is finally gone 18:09:04 (libc's _doprint() basically relies on being able to iterate to an arbitrary argument number via repeated calls to va_arg(ap, void *)) 18:09:23 which I suppose is technically ok, but certainly feels a bit sketchy 18:09:33 I thought it was going to hose me, and it didn't. 18:09:36 if that makes you feel better. 18:09:45 (arm va_list is not a pointer) 18:15:17 i originally was interested in seeing what it'd take to implement something similar in spirit (but definitely _not_ implementation) of ast's ability to extend a format string (IIRC, you could pass something like %! with a corresponding struct and then conversion specifications after it in that call could make use of the extension) 18:16:02 but it acts like a barrier, which makes it hard to work with %n$ style formatting