Subject: Re: core dump filename format
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
From: Andrew Brown <atatat@atatdot.net>
List: tech-userlevel
Date: 09/07/1999 14:46:56
>> I'd probably prefer something vaguely related to printf() format's,
>> i.e. %s for the name of process, %d for pid. Or avoid those funny
>> %foo altogether and use plain strings 'progname', 'pid',
>> 'username'/'uid'. Consider how much more readable is
>> 'progname-pid.core' than '%n-%p.core'.
>
>Hum this can lead to confusions. Imagine you want to name a directory
>'pid'. I prefer %x formats, its more obvious that this will be remplaced.
>
>Ok for %s and %d instead of %n and %p.

that's actually less intuitive to me.  it's not a printf() string
(since there are no arguments passed to it), but rather a format
string that gets filled in with specific values.  look at it this way:

 %s means "a string"
 %d means "a number" (decimal, in fact)

whereas

 %n means "name"
 %p means "pid"
 %u means "user" (or presumably uid, if curproc->p_session->s_login is
    not around)

makes more visual sense.  it might be fun to extend the %[npu] fields
with things like d (for a number, always, as in %u), o or x for the
pid (making it %xp), etc.  maybe even add %t for current time_t.  then
i could have a coredump string of

 /home/%u/.cores/%n.%08xt.%05p

so that none of my coredumps get smashed.  or we could really go
overboard and allow a "core search path" that looks for the first
place it can actually put a core file.

 /home/%u/.cores/%n.%08xt.%05p:/var/cores/%du/%n.%t:%n.core:/dev/null

heh heh.  but the first point (about readbility and formats) still
stands, even if i did get a little carried away.

-- 
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org             * "ah!  i see you have the internet
twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
andrew@crossbar.com       * "information is power -- share the wealth."