linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Parse error in reading /etc/udev/udev.rules [udev-009]
@ 2003-12-23 12:13 Mitch
  0 siblings, 0 replies; only message in thread
From: Mitch @ 2003-12-23 12:13 UTC (permalink / raw)
  To: linux-hotplug

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

Hi,

I've been pulling my hair out why my rule in udev.rules wasn't being honoured.
I turned debugging on and didn't get any joy either. Perusing the source
i found that DEBUG_PARSER is *not* defined when i compile DEBUG=true ! This
provides very useful information. Please enable it.

Anyhow back to my problem. I found i was getting a parse error in udev.rules
with the stock default provided udev.rules and hence no additional lines
were being read and parsing terminates - note this parse is *silent* and the
user is given no feedback if the parser fails. It would be nice even with debug
turned off that we got feedback about parse errors !

Dec 23 11:49:29 core udev[13191]: namedev_init_rules: read ' '
Dec 23 11:49:29 core udev[13191]: namedev_init_rules: unknown type of method ''
Dec 23 11:49:29 core udev[13187]: namedev_init_rules: /etc/udev/udev.rules:14:1073743040:< >: field missing or parse error

So i looked at the source, and found that i need to make the change shown in
the attachment since fgets() *stores* the '\n' character in the buffer and so the
empty line test fails and parsing stops. With this fix in the file is parsed correctly
and my rules are honoured.

Please apply.
Cheers
Mitch

P.s. man fgets() shows:

        fgets()  reads in at most one less than size characters from stream and stores them into
        the buffer pointed to by s.  Reading stops after an EOF or a newline.  If a  newline  is
        read,  it  is  stored into the buffer.  A '\0' is stored after the last character in the
        buffer.

[-- Attachment #2: diff.txt --]
[-- Type: text/plain, Size: 414 bytes --]

*** namedev_parse.c.orig	Tue Dec 23 12:08:52 2003
--- namedev_parse.c	Tue Dec 23 12:09:34 2003
***************
*** 160,166 ****
  		dbg_parse("read '%s'", temp);
  
  		/* empty line? */
! 		if (*temp == 0xa)
  			continue;
  
  		/* see if this is a comment */
--- 160,166 ----
  		dbg_parse("read '%s'", temp);
  
  		/* empty line? */
! 		if (*temp == 0x00)
  			continue;
  
  		/* see if this is a comment */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-12-23 12:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-23 12:13 Parse error in reading /etc/udev/udev.rules [udev-009] Mitch

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).