Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Sunday, November 8, 2026
About Us
Magazine
Open Source
CVS
Services
Index  »  Projects  »  libcfg+  »  Bug list  »  Bug #199

Viewing Bug Advanced Details [ Jump to Bugnotes ] [ Bug History ] [ Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000199 library core major sometimes 2004-03-08 10:37 2004-03-26 14:41
 
Reporter admin View Status public  
Assigned To nepto
Priority normal Resolution fixed Platform
Status resolved Duplicate ID OS
Projection none Version
ETA none Product Version 0.6.2 (stable)
  Product Build
  Votes 1
 
Summary last line in config file is not parsed
Description thanks for the ecellent library, by far the best features and best usabilty for option and command line parsing I have seen so far.

There is a little bug in config file parsing, apparently a missing newline on last line screws up:

{NULL, 0, "threading", CFG_ULONG, (void *) &threading, 0},

...
...

con = cfg_get_context(acct_options);
cfg_set_cfgfile_context(con, 0, -1, cfg_file);

ret = cfg_parse(con);
if (ret != CFG_OK) {
printf("error parsing config file %s: ",acct);
cfg_fprint_error(con, stdout);
putchar('\n');
exit(1);
}

Now when "threading=1" is the last line in config file (without newline) it doesn't set "threading" and it doesnt complain either. After adding a newline in the config file it works as expected.
Steps To Reproduce
Additional Information / Solution This bug was reported via e-mail by
Richard Zidlicky <rz AT linux-m68k.org>
Attached Files threading.tgz (1,643 bytes) 2004-03-15 11:35
libcfgbug.tar.bz2 (845 bytes) 2004-03-17 14:51
big-199-patch.diff (919 bytes) 2004-03-26 12:10

Bug Notes
nepto
2004-03-15 11:33

The problem is, that bug cannot be reproduced. I created tiny testing program, "threading" variable is still successfully parsed, even if there is no newline at the end of file.

1. Download threading.tgz file.
2. Unpack it in the libcfg+ root directory.
3. It will create threading/ subdirectory for you.
4. Go in and type "make".
5. Than run ./threading binary.
 
nepto
2004-03-17 14:53

Richard's reply:

On Mon, Mar 15, 2004 at 11:40:15AM +0100, Ondrej Jombik wrote:

Hi,

thanks for looking at it.

> Probably you are using some special libcfg+ context flags or some older
> version?

nothing fancy, I use version 0.6.2.

Tested your testprogram and it says "threading = 1". However a closer
look at "threading.cfg" revealed that it *has* a newline at the end of
file.. perhaps some helpfull editor added it.

# od -c threading.cfg
0000000 # \n # B u g # 0 0 0 0 1 9 9
0000020 : l a s t l i n e i n c
0000040 o n f i g f i l e i s n o
0000060 t p a r s e d \n # h t t p :
0000100 / / p l a t o n . s k / p r o j
0000120 e c t s / b u g _ v i e w _ a d
0000140 v a n c e d _ p a g e . p h p ?
0000160 f _ b u g _ i d = 1 9 9 \n # \n \n
0000200 # n o t e n o n e w l i n
0000220 e a t t h e e n d o f
0000240 t h i s f i l e \n \n t h r e a
0000260 d i n g = 1 \n
^^^^^
After deleting that newline I get
# ./threading threading.cfg
configuration file was successfully parsed
threading = 0

Attaching my testcase which is almost identical to yours anyway, wants
libcfg+ installed in standard location and "make" will do everything
including running the tests.

Richard
 
nepto
2004-03-26 12:11

A patch fixing this issue was uploaded.
 
nepto
2004-03-26 14:41

Commited into CVS.
 

Bug History
Date Modified Username Field Change
2004-03-08 10:37 admin New Bug
2004-03-15 11:33 nepto status new => feedback
2004-03-15 11:33 nepto Bugnote Added: 0000788
2004-03-15 11:35 nepto File Added: threading.tgz
2004-03-17 14:51 nepto File Added: libcfgbug.tar.bz2
2004-03-17 14:53 nepto Bugnote Added: 0000798
2004-03-26 12:10 nepto File Added: big-199-patch.diff
2004-03-26 12:11 nepto Bugnote Added: 0000811
2004-03-26 14:41 nepto Bugnote Added: 0000812
2004-03-26 14:41 nepto handler_id => nepto
2004-03-26 14:41 nepto resolution open => fixed
2004-03-26 14:41 nepto status feedback => resolved

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Application form
Report bug on PLATON.SK website · Terms of use · Privacy policy