Posts

Showing posts from October, 2012

%.*s - Weird printk or Format of the format string

See this patch: https://lkml.org/lkml/2012/8/21/46

The author suggests:

-p9_debug(P9_DEBUG_VFS, "%s -> %s (%s)\n",
- dentry->d_name.name, st->extension, buffer);
+p9_debug(P9_DEBUG_VFS, "%s -> %s (%.*s)\n",
+ dentry->d_name.name, st->extension, buflen, buffer);

But what the heck does %.*s? And why buflen variable was added as parameter to p9_debug? What would be the output of the C program above:

#include <stdio.h> void main () { int i; char *ab ="abcdefghi"; for (i = 0; i < 10; i++) printf ("%.*s\n", i, ab); }
[peter@ace tmp]$ gcc test.c;./a.out

a
ab
abc
abcd
abcde
abcdef
abcdefg
abcdefgh
abcdefghi

Cool huh?

Almost in the top ten

Thanks to my internship, on the raking of the number of patches accepted, only 10 people had sent more patches than me for the Kernel 3.7:

The ranking: http://www.remword.com/kps_result/3.7_petop.html

\o/

Not bad for a newbie.

More than 100 (2) \o/

[peter@ace linux-next]$ git log |grep Author |grep peter.senna@gmail.com |wc -l
106

More than 100 patches accepted in the Linux Kernel. I'm happy with it but...

Those are really simple patches and I need to work on finding more complex things to do. But I think I'm on the way...

It is not enough to fix a bug and describe it correctly...

I'm sending a lot of patches. Many are just being accepted. But there is one very interesting rejection. I have not received nack, and the patch was not directed to /dev/null. The maintainers are happy with the code, but they "really" want me to do a very specific commit message.
See the full thread: http://www.kernelhub.org/?p=2&msg=139304

How to write commit messages?

From: Linus Torvalds <torvalds@linux-foundation.org>
Newsgroups: fa.linux.kernel
Subject: Re: [PATCH] Bugfix to commit
Date: Tue, 23 Oct 2007 15:53:41 UTC
Message-ID: <fa.kLlZ0+PrvWCrpZjNV34+zBLE2ro@ifi.uio.no>

On Tue, 23 Oct 2007, Olaf Hering wrote:
>
> On Mon, Oct 22, Grant Likely wrote:
>
> > Olaf, do I have the correct solution here?
>
> Sure.

Side note: I already applied that patch, but take a look at the commit
message.

That's right: I had to edit the message provided to make it readable. So
I'll just take this opportunity to ask people that when they send
bug-fixes, please try to make the subject line and message make sense for
a *reader*, not for yourself (or even to me, although if it's readable to
some generic person, it's hopefully readable to me too!).

So a subject line of "Bugfix to commit <commit-sha-goes-here>" is
obviously not a very nice one, if you're looking at the kernel commit
history in gitk or…