threads / discuss / 28089

git am ~/Documents/mail-[1-9]-11.txt Patch format detection failed.

Subject: git am ~/Documents/mail-[1-9]-11.txt Patch format detection failed.

## tl;dr

4 messages between Aug 13, 2011 and Aug 14, 2011.

replies: 3people: 3as markdown or json

Jim Cromie· Aug 13, 2011, 19:49 UTC · lore
git am is giving me trouble.

Im a gmail user, and have saved a patch series by doing show-original, save w rename for each patch

git apply mail-1-11.txt works, but it disregards the commit-msg, so commit-ids are lost, (I could attempt to checkin each with cut-paste commit-msgs, but this sounds like a losing game) and patchset isnt trackable as such.

grabbing diffs from lkml.org site doesnt help, since theyre raw diffs, theyre lacking the commit-msg.

have I missed an option, or is am's format detection less than it should be ?
Ive attached mail-1-11, which applies cleanly to v3.0, but wont am.
                                                                                                                                                                                                                                                               
Delivered-To: jim.cromie@gmail.com
Received: by 10.142.178.18 with SMTP id a18cs193734wff;
        Thu, 11 Aug 2011 11:36:25 -0700 (PDT)
Received: from mr.google.com ([10.151.86.15])
        by 10.151.86.15 with SMTP id o15mr1391877ybl.13.1313087785695 (num_hops = 1);
        Thu, 11 Aug 2011 11:36:25 -0700 (PDT)
Received: by 10.151.86.15 with SMTP id o15mr1000356ybl.13.1313087784175;
        Thu, 11 Aug 2011 11:36:24 -0700 (PDT)
Return-Path: <jbaron@redhat.com>
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28])
        by mx.google.com with ESMTP id b12si2813718ybi.101.2011.08.11.11.36.23;
        Thu, 11 Aug 2011 11:36:24 -0700 (PDT)
Received-SPF: pass (google.com: domain of jbaron@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of jbaron@redhat.com designates 209.132.183.28 as permitted sender) smtp.mail=jbaron@redhat.com
Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
	by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p7BIaLoG008295
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Thu, 11 Aug 2011 14:36:21 -0400
Received: from redhat.com (dhcp-100-19-188.bos.redhat.com [10.16.19.188])
	by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p7BIaLal007962;
	Thu, 11 Aug 2011 14:36:21 -0400
Date: Thu, 11 Aug 2011 14:36:21 -0400
From: Jason Baron <jbaron@redhat.com>
To: gregkh@suse.de
Cc: joe@perches.com, jim.cromie@gmail.com, bvanassche@acm.org,
        linux-kernel@vger.kernel.org, davem@davemloft.net,
        aloisio.almeida@openbossa.org, netdev@vger.kernel.org
Message-Id: <b5c13500eac4e5dfa0ee960c6f186eeb1b4585b4.1313085588.git.jbaron@redhat.com>
In-Reply-To: <cover.1313085588.git.jbaron@redhat.com>
References: <cover.1313085588.git.jbaron@redhat.com>
Subject: [PATCH 01/11] dynamic_debug: Add __dynamic_dev_dbg
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12
From: Joe Perches <joe@perches.com>

Unlike dynamic_pr_debug, dynamic uses of dev_dbg can not currently add task_pid/KBUILD_MODNAME/__func__/__LINE__ to selected debug output.

Add a new function similar to dynamic_pr_debug to optionally emit these prefixes.

Cc: Aloisio Almeida <aloisio.almeida@openbossa.org>
Noticed-by: Aloisio Almeida <aloisio.almeida@openbossa.org>
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jason Baron <jbaron@redhat.com>
---
 drivers/base/core.c           |    5 +++--
 include/linux/device.h        |    5 +++++
 include/linux/dynamic_debug.h |   10 ++++++++--
 lib/dynamic_debug.c           |   38 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 54 insertions(+), 4 deletions(-)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index bc8729d..82c8654 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1764,8 +1764,8 @@ void device_shutdown(void)
 
 #ifdef CONFIG_PRINTK
 
-static int __dev_printk(const char *level, const struct device *dev,
-			struct va_format *vaf)
+int __dev_printk(const char *level, const struct device *dev,
+		 struct va_format *vaf)
 {
 	if (!dev)
 		return printk("%s(NULL device *): %pV", level, vaf);
@@ -1773,6 +1773,7 @@ static int __dev_printk(const char *level, const struct device *dev,
 	return printk("%s%s %s: %pV",
 		      level, dev_driver_string(dev), dev_name(dev), vaf);
 }
+EXPORT_SYMBOL(__dev_printk);
 
 int dev_printk(const char *level, const struct device *dev,
 	       const char *fmt, ...)
diff --git a/include/linux/device.h b/include/linux/device.h
index c20dfbf..4639419 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -785,6 +785,8 @@ extern const char *dev_driver_string(const struct device *dev);
 
 #ifdef CONFIG_PRINTK
 
+extern int __dev_printk(const char *level, const struct device *dev,
+			struct va_format *vaf);
 extern int dev_printk(const char *level, const struct device *dev,
 		      const char *fmt, ...)
 	__attribute__ ((format (printf, 3, 4)));
@@ -805,6 +807,9 @@ extern int _dev_info(const struct device *dev, const char *fmt, ...)
 
 #else
 
+static inline int __dev_printk(const char *level, const struct device *dev,
+			       struct va_format *vaf)
+	 { return 0; }
 static inline int dev_printk(const char *level, const struct device *dev,
 		      const char *fmt, ...)
 	__attribute__ ((format (printf, 3, 4)));
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index e747ecd..bdf1531 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -47,6 +47,13 @@ extern int ddebug_remove_module(const char *mod_name);
 extern int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
 	__attribute__ ((format (printf, 2, 3)));
 
+struct device;
+
+extern int __dynamic_dev_dbg(struct _ddebug *descriptor,
+			     const struct device *dev,
+			     const char *fmt, ...)
+	__attribute__ ((format (printf, 3, 4)));
+
 #define dynamic_pr_debug(fmt, ...) do {					\
 	static struct _ddebug descriptor				\
 	__used								\
@@ -57,7 +64,6 @@ extern int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
 		__dynamic_pr_debug(&descriptor, pr_fmt(fmt), ##__VA_ARGS__); \
 	} while (0)
 
-
 #define dynamic_dev_dbg(dev, fmt, ...) do {				\
 	static struct _ddebug descriptor				\
 	__used								\
@@ -65,7 +71,7 @@ extern int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
 	{ KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__,		\
 		_DPRINTK_FLAGS_DEFAULT };				\
 	if (unlikely(descriptor.enabled))				\
-		dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__);	\
+		__dynamic_dev_dbg(&descriptor, dev, fmt, ##__VA_ARGS__);	\
 	} while (0)
 
 #else
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 75ca78f..63b6f95 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -30,6 +30,7 @@
 #include <linux/jump_label.h>
 #include <linux/hardirq.h>
 #include <linux/sched.h>
+#include <linux/device.h>
 
 extern struct _ddebug __start___verbose[];
 extern struct _ddebug __stop___verbose[];
@@ -456,6 +457,43 @@ int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
 }
 EXPORT_SYMBOL(__dynamic_pr_debug);
 
+int __dynamic_dev_dbg(struct _ddebug *descriptor,
+		      const struct device *dev, const char *fmt, ...)
+{
+	struct va_format vaf;
+	va_list args;
+	int res;
+
+	BUG_ON(!descriptor);
+	BUG_ON(!fmt);
+
+	va_start(args, fmt);
+
+	vaf.fmt = fmt;
+	vaf.va = &args;
+
+	res = printk(KERN_DEBUG);
+	if (descriptor->flags & _DPRINTK_FLAGS_INCL_TID) {
+		if (in_interrupt())
+			res += printk(KERN_CONT "<intr> ");
+		else
+			res += printk(KERN_CONT "[%d] ", task_pid_vnr(current));
+	}
+	if (descriptor->flags & _DPRINTK_FLAGS_INCL_MODNAME)
+		res += printk(KERN_CONT "%s:", descriptor->modname);
+	if (descriptor->flags & _DPRINTK_FLAGS_INCL_FUNCNAME)
+		res += printk(KERN_CONT "%s:", descriptor->function);
+	if (descriptor->flags & _DPRINTK_FLAGS_INCL_LINENO)
+		res += printk(KERN_CONT "%d ", descriptor->lineno);
+
+	res += __dev_printk(KERN_CONT, dev, &vaf);
+
+	va_end(args);
+
+	return res;
+}
+EXPORT_SYMBOL(__dynamic_dev_dbg);
+
 static __initdata char ddebug_setup_string[1024];
 static __init int ddebug_setup_query(char *str)
 {
-- 
1.7.5.4
David Aguilar· Aug 14, 2011, 02:14 UTC · re: Jim Cromie · lore

Re: git am ~/Documents/mail-[1-9]-11.txt Patch format detection failed.

On Sat, Aug 13, 2011 at 01:49:35PM -0600, Jim Cromie wrote:
Show 5 quoted lines
> git am is giving me trouble.
> 
> Im a gmail user, and have saved a patch series by doing
> show-original, save w rename for each patch
> [snip]

My experience with gmail + patches is that you need to use an email client to download patches, not the web interface.

mutt works well for me. Any client that can talk to gmail over imaps:// should do the trick.

I couldn't find what was wrong with the patch you attached to your original message, though.

-- 
					David
Ramkumar Ramachandra· Aug 14, 2011, 03:06 UTC · re: Jim Cromie · lore

Re: git am ~/Documents/mail-[1-9]-11.txt Patch format detection failed.

Hi Jim,
[+CC: David Barr]
Jim Cromie writes:
Show 6 quoted lines
> git am is giving me trouble.
>
> Im a gmail user, and have saved a patch series by doing
> show-original, save w rename for each patch
> [...]
> Ive attached mail-1-11, which applies cleanly to v3.0, but wont am.

It works quite well for me after David's recent patch: 0e8341f2 (am: ignore leading whitespace before patch, 2011-08-08). The patch has already made it to 'next', but hasn't hit 'master' yet. Could you please try it and tell us if there are any issues?

Thanks.
-- Ram
Jim Cromie· Aug 14, 2011, 08:20 UTC · re: Ramkumar Ramachandra · lore

Re: git am ~/Documents/mail-[1-9]-11.txt Patch format detection failed.

On Sat, Aug 13, 2011 at 9:06 PM, Ramkumar Ramachandra <artagnon@gmail.com> wrote:

Show 21 quoted lines
> Hi Jim,
>
> [+CC: David Barr]
>
> Jim Cromie writes:
>> git am is giving me trouble.
>>
>> Im a gmail user, and have saved a patch series by doing
>> show-original, save w rename for each patch
>> [...]
>> Ive attached mail-1-11, which applies cleanly to v3.0, but wont am.
>
> It works quite well for me after David's recent patch: 0e8341f2 (am:
> ignore leading whitespace before patch, 2011-08-08).  The patch has
> already made it to 'next', but hasn't hit 'master' yet.  Could you
> please try it and tell us if there are any issues?
>
> Thanks.
>
> -- Ram
>
thanks Ram,
I just pulled and built next branch, it worked for me.
[jimc@groucho linux-2.6]$ ../../git/git am ~/Documents/mail-[1-9]-11.txt
Applying: dynamic_debug: Add __dynamic_dev_dbg
Applying: dynamic_debug: Consolidate prefix output to single routine
Applying: dynamic_debug: Remove uses of KERN_CONT in dynamic_emit_prefix
Applying: dynamic_debug: Convert printks to pr_<level>
Applying: dynamic_debug: remove unused control variables
...
thanks

← back to recent threads