linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Parsing comments
@ 2006-09-10 20:48 Rocco Stanzione
  2006-09-10 22:22 ` Kay Sievers
  0 siblings, 1 reply; 2+ messages in thread
From: Rocco Stanzione @ 2006-09-10 20:48 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 598 bytes --]

I made this patch in reponse to a bug report on ubuntu, where a very long 
comment in a rules file produced an error message about a too-long rule.  
They broke the rule into multiple lines to avoid it, and I made a patch to 
check for comments before (rather than after) complaining about long lines, 
which ubuntu was hesitant to apply so late in the release process.  I thought 
I'd submit it upstream and let it come back down on its own time, if you 
think it's a good patch.

ubuntu bug report: 
https://launchpad.net/distros/ubuntu/+source/sane-backends/+bug/56317

Thanks,

Rocco Stanzione

[-- Attachment #2: udev_long_comments.diff --]
[-- Type: text/x-diff, Size: 1636 bytes --]

diff -u udev-093/debian/changelog udev-093/debian/changelog
--- udev-093/debian/changelog
+++ udev-093/debian/changelog
@@ -1,3 +1,9 @@
+udev (093-0ubuntu15) edgy; urgency=low
+
+  * Check for comments before parsing rules.  Closes lp #56317
+
+ -- Rocco Stanzione <grasshopper@linuxkungfu.org>  Sun, 10 Sep 2006 15:22:00 -0500
+
 udev (093-0ubuntu14) edgy; urgency=low
 
   * Be gone foul devfs-emulation fiends from hell!
only in patch2:
unchanged:
--- udev-093.orig/udev_rules.c
+++ udev-093/udev_rules.c
@@ -164,6 +164,10 @@
 		cur += count+1;
 		lineno++;
 
+		/* see if this is a comment */
+		if (bufline[0] == COMMENT_CHARACTER)
+			continue;
+
 		if (count >= sizeof(line)) {
 			err("line too long, conf line skipped %s, line %d", udev_config_filename, lineno);
 			continue;
@@ -177,10 +181,6 @@
 		if (count == 0)
 			continue;
 
-		/* see if this is a comment */
-		if (bufline[0] == COMMENT_CHARACTER)
-			continue;
-
 		memcpy(line, bufline, count);
 		line[count] = '\0';
 
only in patch2:
unchanged:
--- udev-093.orig/udev_rules_parse.c
+++ udev-093/udev_rules_parse.c
@@ -609,6 +609,10 @@
 		cur += count+1;
 		lineno++;
 
+		/* see if this is a comment */
+		if (bufline[0] == COMMENT_CHARACTER)
+			continue;
+
 		if (count >= sizeof(line)) {
 			err("line too long, rule skipped '%s:%u'", filename, lineno);
 			continue;
@@ -622,10 +626,6 @@
 		if (count == 0)
 			continue;
 
-		/* see if this is a comment */
-		if (bufline[0] == COMMENT_CHARACTER)
-			continue;
-
 		/* skip backslash and newline from multi line rules */
 		for (i = j = 0; i < count; i++) {
 			if (bufline[i] == '\\' && bufline[i+1] == '\n')

[-- Attachment #3: Type: text/plain, Size: 373 bytes --]

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

[-- Attachment #4: Type: text/plain, Size: 226 bytes --]

_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Parsing comments
  2006-09-10 20:48 Parsing comments Rocco Stanzione
@ 2006-09-10 22:22 ` Kay Sievers
  0 siblings, 0 replies; 2+ messages in thread
From: Kay Sievers @ 2006-09-10 22:22 UTC (permalink / raw)
  To: linux-hotplug

On Sun, 2006-09-10 at 15:48 -0500, Rocco Stanzione wrote:
> I made this patch in reponse to a bug report on ubuntu, where a very long 
> comment in a rules file produced an error message about a too-long rule.

That was already fixed with 097. Btw, seems your patch wouldn't work
with whitespace before the comment character.

Thanks,
Kay


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x120709&bid&3057&dat\x121642
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-09-10 22:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-10 20:48 Parsing comments Rocco Stanzione
2006-09-10 22:22 ` Kay Sievers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).