[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Confuse-devel] silently absorbing duplicate sections with the same titl
From: |
Brian Fallik |
Subject: |
[Confuse-devel] silently absorbing duplicate sections with the same title |
Date: |
Thu, 16 Jun 2005 14:10:15 -0400 |
We've recently found a behavior in confuse which is impairing our
ability to trap certain error conditions for our application. We'd like
to be able to catch the case where a user repeats a section/title
combination. This is most likely due to a copy+paste error, and has
already occurred at least once for us.
I've tracked the issue into confuse.c, and found the following lines to
be involved:
574 mhe 1.21 if(is_set(CFGF_NOCASE, cfg->flags))
575 {
576 mhe 1.20 if(strcasecmp(value, sec->title)
== 0)
577 val = opt->values[i];
578 mhe 1.21 }
579 else
580 {
581 mhe 1.20 if(strcmp(value, sec->title) ==
0)
582 val = opt->values[i];
583 }
(from confuse.c:1.27 at http://savannah.nongnu.org/cgi-bin/viewcvs/...
This tracks back to version 1.2 of the file, which has the log message
"imported version 2.0 sources".
With these lines, libconfuse silently overwrites the old section/title
combination with information from the new matching section/title. Is
this the intended behavior? If so, is there a strategy an application
can use to trap this and handle it itself?
I've written a patch to confuse.c which calls cfg_error() and returns
when the titles match in the lines above. However, would it make sense
to provide a CFGF_NOTITLEDUPES setting which only applies to sections
and, if set, calls cfg_error?
Thanks,
brian
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Confuse-devel] silently absorbing duplicate sections with the same title,
Brian Fallik <=