Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

will not parse my.cnf if any !include directives are present #113

Open
ss8913 opened this issue Apr 11, 2014 · 9 comments · May be fixed by #245
Open

will not parse my.cnf if any !include directives are present #113

ss8913 opened this issue Apr 11, 2014 · 9 comments · May be fixed by #245

Comments

@ss8913
Copy link

ss8913 commented Apr 11, 2014

In 0.9.0, my my.cnf parses fine. With 1.0.0 or newer, it does not. If I take out the !include /sub/path.d/ directive, it works, but obviously I need that in there. I saw in the changelog that something changed regarding !include directives, but it appears to have broken this functionality and is locking me into 0.9.0.

@raphink
Copy link
Member

raphink commented Apr 15, 2014

Can you paste the exact line that fails, and the error returned by running augtool print /augeas//error please?

@ss8913
Copy link
Author

ss8913 commented May 23, 2014

update - ANY key that starts with a ! will cause the file to be unparseable. If I add a line from the 0.9.0 lens, it does seem to fix it, but I'm not sure what other ramifications it has. ie this diff:

--- /root/mysql.aug.dist        2014-05-22 17:07:30.000000000 -0700
+++ /root/mysql.aug.fixed       2014-05-22 17:38:45.000000000 -0700
@@ -20,6 +20,7 @@
   in [ Util.indent . key IniFile.entry_re . sep . Sep.opt_space . bare . (comment|IniFile.eol) ]
    | [ Util.indent . key IniFile.entry_re . sep . Sep.opt_space . quoted . (comment|IniFile.eol) ]
    | [ Util.indent . key IniFile.entry_re . store // .  (comment|IniFile.eol) ]
+   | [ key /\![A-Za-z][A-Za-z0-9\._-]+/ . del / / " " . store /\/[A-Za-z0-9\.\/_-]+/ . (comment|IniFile.eol) ]
    | comment

 (************************************************************************

the above patch to mysql.aug will fix it. In answer to your previous questions, "augtool print /augeas//error" returns this:

/augeas/files/etc/my.cnf/error = "parse_failed"                                 
/augeas/files/etc/my.cnf/error/pos = "210"                                      
/augeas/files/etc/my.cnf/error/line = "9"                                       
/augeas/files/etc/my.cnf/error/char = "0"                                       
/augeas/files/etc/my.cnf/error/lens = "/usr/share/augeas/lenses/dist/mysql.aug:39.13-.60:"                                                                      
/augeas/files/etc/my.cnf/error/message = "Get did not match entire input

Here's the top part of the config that fails to parse, including the affected line (it's the !includedir line).

# $Id: my.cnf-96GB,v 1.1 2012/06/25 19:45:33 author.name Exp $                      

[client]                                                                        
port                                    = 3306                                  
socket                                  = /tmp/mysql.sock                       

[mysqld]                                                                        
!includedir /etc/mysql.d/                                                       
port                                    = 3306                                  
socket                                  = /tmp/mysql.sock                       
key_buffer_size                         = 128M                                  
max_allowed_packet                      = 32M                                   
table_open_cache                        = 3000                                  
table_definition_cache                  = 3000                                  
tmp_table_size                          = 64M                                   
max_heap_table_size                     = 64M                                   
sort_buffer                             = 256k                                  
myisam_sort_buffer_size                 = 256k                                  
max_connections                         = 2400                                  
open-files-limit                        = 8192                                  
net_write_timeout                       = 900                                   
net_read_timeout                        = 900                                   
bind-address                            = 0.0.0.0

@ss8913
Copy link
Author

ss8913 commented May 23, 2014

ugh. this message board does NOT like unified diff posted into it. I think you can still see what I'm getting at with that, but let me know if you want the actual diff mailed somewhere.

@raphink
Copy link
Member

raphink commented May 23, 2014

It does, if you use the proper syntax to paste code. See https://help.github.com/articles/github-flavored-markdown

@raphink
Copy link
Member

raphink commented May 23, 2014

Are you sure you are using the official lens from 1.0.0? It should have a line to parse include statements: https://github.com/hercules-team/augeas/blob/release-1.0.0/lenses/mysql.aug#L33

@lutter
Copy link
Member

lutter commented Apr 3, 2015

Is this still an issue ?

@ss8913
Copy link
Author

ss8913 commented Apr 4, 2015

Yes, I actually tested it yesterday with the latest augeas on one of my
Centos 6.6 hosts. Still returns nothing when you do:

augtool print /files/etc/my.cnf

As long as the !include is present in the file. Without !include, it works
fine. Versions of augeas before 1.0.0 work fine either way.

On Fri, Apr 3, 2015 at 1:40 PM, David Lutterkort notifications@github.com
wrote:

Is this still an issue ?


Reply to this email directly or view it on GitHub
#113 (comment)
.

@lutter
Copy link
Member

lutter commented Apr 9, 2015

The issue is actually not the include directive itself, but that Augeas parses that in a way that ends whatever section it appears in. The error happens on the line starting with port right after the !includedir line.

Not sure how to fix that though .. we'd probably have to accept that line as part of the mysqld section

@ss8913
Copy link
Author

ss8913 commented Apr 9, 2015

However it works in 0.9.0, it was OK then :) Let me know if you want me to
test this for you, I have thousands of boxes that I can reproduce it on,
and I can send you one of the my.cnf files as well if I haven't already.

On Thu, Apr 9, 2015 at 9:50 AM, David Lutterkort notifications@github.com
wrote:

The issue is actually not the include directive itself, but that Augeas
parses that in a way that ends whatever section it appears in. The error
happens on the line starting with port right after the !includedir line.

Not sure how to fix that though .. we'd probably have to accept that line
as part of the mysqld section


Reply to this email directly or view it on GitHub
#113 (comment)
.

lutter added a commit to lutter/augeas that referenced this issue May 22, 2015
… of sections

CentOS 6.6 (at least) ships with a mysql.conf that has a !include directive
in the middle of a section. To accomodate that, we pull !include directives
into the sections in which they appear rather than having htem end the
section. That's the incompatible change: these directives now appear
underneath /target/!include rather than at /!include

Fixes hercules-team#113
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants