Hi Jonas,<br><br><br>Thank you for reporting this issue.<br><br><br><div class="gmail_quote">On Thu, May 7, 2009 at 9:46 AM, Jonas Eriksson <span dir="ltr"><<a href="mailto:jonas.j.eriksson@ericsson.com">jonas.j.eriksson@ericsson.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello<br>
<br>
I have been having some trouble with comments when parsing<br>
modprobe.d-files. To exemplify, ordinary comments work as<br>
intended, but end-of-line-comments breaks the lens, so to speak:<br>
===== modprobe.d/blacklist:<br>
# this works fine<br>
blacklist brokenmodule # this does not work<br>
=====<br>
<br>
I propose that either the definition of eol in util.aug is<br>
changed thusly:<br>
=====<br>
diff --git a/lenses/util.aug b/lenses/util.aug<br>
index 0dced14..ee2845c 100644<br>
--- a/lenses/util.aug<br>
+++ b/lenses/util.aug<br>
@@ -51,7 +51,7 @@ Variable: del_opt_ws<br>
 Variable: eol<br>
   Delete end of line, including optional trailing whitespace<br>
 *)<br>
-  let eol = del /[ \t]*\n/ "\n"<br>
+  let eol = del /[ \t]*(#[^\n]*\n|\n)/ "\n"<br>
<br>
 (*<br>
 Variable: indent<br>
=====<br>
<br>
..or that a ceol is defined as the redefined eol, and that this<br>
is used instead of eol in modprobe.aug and shellvars.aug (it is<br>
probably fitting for more .aug-files, such as hosts, grub, cron,<br>
exports, fstab, interfaces, etc. Someone who is more certain at<br>
this will have to acknowledge):</blockquote><div><br><br>We have another way of dealing with this, which is to use '(eol|comment)' instead of 'eol' for the end of lines.<br><br>Quite a few lenses are already doing it this way.<br>
<br><br><br>Raphaël<br><br><br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
=====<br>
diff --git a/lenses/modprobe.aug b/lenses/modprobe.aug<br>
index d61b7a0..5fb3de6 100644<br>
--- a/lenses/modprobe.aug<br>
+++ b/lenses/modprobe.aug<br>
@@ -7,7 +7,7 @@ autoload xfm<br>
<br>
 let comment = Util.comment<br>
 let empty = Util.empty<br>
-let eol = Util.eol<br>
+let eol = Util.ceol<br>
<br>
 (* modprobe.conf allows continuing a line by ending it with backslash +<br>
    newline; the backslash + newline token is suppressed We handle an<br>
diff --git a/lenses/shellvars.aug b/lenses/shellvars.aug<br>
index d3e4bbe..663e581 100644<br>
--- a/lenses/shellvars.aug<br>
+++ b/lenses/shellvars.aug<br>
@@ -3,7 +3,7 @@<br>
 module Shellvars =<br>
   autoload xfm<br>
<br>
-  let eol = Util.eol<br>
+  let eol = Util.ceol<br>
<br>
   let key_re = /[A-Za-z0-9_]+(\[[0-9]+\])?/ - "unset" - "export"<br>
   let eq = Util.del_str "="<br>
diff --git a/lenses/util.aug b/lenses/util.aug<br>
index 0dced14..20f4919 100644<br>
--- a/lenses/util.aug<br>
+++ b/lenses/util.aug<br>
@@ -54,6 +54,12 @@ Variable: eol<br>
   let eol = del /[ \t]*\n/ "\n"<br>
<br>
 (*<br>
+Variable: ceol<br>
+  Delete end of line, including optional trailing whitespace and comment<br>
+*)<br>
+  let ceol = del /[ \t]*(#[^\n]*\n|\n)/ "\n"<br>
+<br>
+(*<br>
 Variable: indent<br>
   Delete indentation, including leading whitespace<br>
 *)<br>
=====<br>
<br>
Best regards,<br>
Jonas Eriksson<br>
<br>
--<br>
Jonas Eriksson<br>
Consultant at AS/EAB/FLJ/IL<br>
Phone: +46 8 58086281<br>
Combitech AB<br>
Älvsjö, Sweden<br>
<br>
_______________________________________________<br>
augeas-devel mailing list<br>
<a href="mailto:augeas-devel@redhat.com">augeas-devel@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/augeas-devel" target="_blank">https://www.redhat.com/mailman/listinfo/augeas-devel</a><br>
</blockquote></div><br>