Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Net-ISC-DHCPd CPAN distribution.

Report information
The Basics
Id: 81382
Status: resolved
Priority: 0/
Queue: Net-ISC-DHCPd

People
Owner: RDRAKE [...] cpan.org
Requestors: qoole.dhcp [...] lillimoth.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.14
Fixed in: 0.16



Subject: Parse error when open/close braces are on the same line.
Hi, Very basic perl script that loads and then generates a config file: #!/usr/bin/perl use Net::ISC::DHCPd::Config; use Data::Dumper; my $config = Net::ISC::DHCPd::Config->new(file => '/root/dhcpd.conf'); printf "Parsed %s lines\n\n", $config->parse; print $config->generate(); If I load the following file: group { next-server 192.168.0.2; host box1 { option host-name "box1"; hardware ethernet 11:22:33:44:55:66; fixed-address 192.168.0.1; } host box2 { option host-name "box2"; hardware ethernet 66:55:44:33:22:11; fixed-address 192.168.0.2; } } group { next-server 192.168.0.2; host box1 {option host-name "box1"; hardware ethernet 11:22:33:44:55:66; fixed-address 192.168.0.1;} host box2 {option host-name "box2"; hardware ethernet 66:55:44:33:22:11; fixed-address 192.168.0.2;} } Which contains to functionally identical groups I get the following output: Parsed 16 lines, and got these objects: group { next-server 192.168.0.2; host box1 { option host-name "box1"; hardware ethernet 11:22:33:44:55:66; fixed-address 192.168.0.1; } host box2 { option host-name "box2"; hardware ethernet 66:55:44:33:22:11; fixed-address 192.168.0.2; } } group { next-server 192.168.0.2; host box1 { host box2 {option host-name "box2"; hardware ethernet 66:55:44:33:22:11; fixed-address 192.168.0.2; } } As you can see, in the second group the box1 host is missing all its options and wants to encompass the box2 host. This is with the latest version and Perl version v5.16.1 on a Gentoo machine. Thanks, Alex
This may be particularly hard to fix without a rewrite. This is due to the fact that you could put as many items as you wanted on the same line. group { host box1 { option host-name "box1"; } host box2 { option host-name "box2"; } } The parser currently looks at elements as being on their own lines. I'm going to write a test case for this and I'll see what I can do to get it working. On Fri Nov 23 11:49:23 2012, http://qoole.myopenid.com/ wrote: Show quoted text
> Hi, > > Very basic perl script that loads and then generates a config file: > > #!/usr/bin/perl > > use Net::ISC::DHCPd::Config; > use Data::Dumper; > > my $config = Net::ISC::DHCPd::Config->new(file => '/root/dhcpd.conf'); > > printf "Parsed %s lines\n\n", $config->parse; > print $config->generate(); > > If I load the following file: > > group { > next-server 192.168.0.2; > host box1 { > option host-name "box1"; hardware > ethernet 11:22:33:44:55:66; fixed-address 192.168.0.1; > } > > host box2 { > option host-name "box2"; hardware > ethernet 66:55:44:33:22:11; fixed-address 192.168.0.2; > } > } > > group { > next-server 192.168.0.2; > host box1 {option host-name "box1"; hardware ethernet > 11:22:33:44:55:66; fixed-address 192.168.0.1;} > host box2 {option host-name "box2"; hardware ethernet > 66:55:44:33:22:11; fixed-address 192.168.0.2;} > } > > Which contains to functionally identical groups I get the following > output: > > Parsed 16 lines, and got these objects: > > group { > next-server 192.168.0.2; > host box1 { > option host-name "box1"; hardware ethernet > 11:22:33:44:55:66; fixed-address 192.168.0.1; > } > host box2 { > option host-name "box2"; hardware ethernet 66:55:44:33:22:11; > fixed-address 192.168.0.2; > } > } > group { > next-server 192.168.0.2; > host box1 { > host box2 {option host-name "box2"; hardware ethernet > 66:55:44:33:22:11; fixed-address 192.168.0.2; > } > } > > > As you can see, in the second group the box1 host is missing all its > options and wants to encompass the box2 host. > > This is with the latest version and Perl version v5.16.1 on a Gentoo > machine. > > Thanks, > > Alex
This has been fixed in 0.16.