linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mitch <mitch@0bits.com>
To: linux-hotplug@vger.kernel.org
Subject: Fwd: Parse error in reading /etc/udev/udev.rules [udev-009]
Date: Tue, 23 Dec 2003 12:17:22 +0000	[thread overview]
Message-ID: <marc-linux-hotplug-107218195814089@msgid-missing> (raw)

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

Oops, did that patch in reverse. There is more than one occorunce of this
bug, so here is the updated patch.

Mitch

-------- Original Message --------
Subject: Parse error in reading /etc/udev/udev.rules [udev-009]
Date: Tue, 23 Dec 2003 12:13:31 +0000
From: Mitch <mitch@0bits.com>
To: linux-hotplug-devel@lists.sourceforge.net

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: 691 bytes --]

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

             reply	other threads:[~2003-12-23 12:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-23 12:17 Mitch [this message]
2003-12-23 15:12 ` Fwd: Parse error in reading /etc/udev/udev.rules [udev-009] Mitch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-linux-hotplug-107218195814089@msgid-missing \
    --to=mitch@0bits.com \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).