Modify

Opened 10 years ago

Closed 8 years ago

#1537 closed Bugs (fixed)

no value given in 'mysql_password ='

Reported by: Olaf van der Spek <OlafvdSpek@…> Owned by: Vladimir Prus
Milestone: Component: program_options
Version: Boost 1.34.1 Severity: Problem
Keywords: Cc: s.ochsenknecht@…

Description

Hi,

no value given in 'mysql_password ='

When I put this line in a conf file, I get this error. I think it should just accept this as the empty string.

Attachments (1)

ticket1537.patch (2.4 KB) - added by s.ochsenknecht@… 8 years ago.
possible patch

Download all attachments as: .zip

Change History (9)

Changed 8 years ago by s.ochsenknecht@…

Attachment: ticket1537.patch added

possible patch

comment:1 Changed 8 years ago by s.ochsenknecht@…

Cc: s.ochsenknecht@… added

I attached a patch which allows these empty values in config files. I simply removed the exception and enhanced one test case.

But, I can not survey the impact and possible side effects. And do we really want this behavior? At least the tests seam to work fine.

Please comment.

  • Sascha

comment:2 Changed 8 years ago by Sascha Ochsenknecht

I applied the patch.

With one small modification. Empty values are ignored and nothing is stored. I think it makes sense since an empty string can not be converted to every possible value type, e.g. integer options.

Cheers

  • Sascha

comment:3 Changed 8 years ago by Sascha Ochsenknecht

Resolution: fixed
Status: newclosed

(In [57819]) allow empty values in config file, Fixes #1537

comment:4 Changed 8 years ago by olafvdspek@…

Resolution: fixed
Status: closedreopened

I don't think that's a good idea. There's a difference between an empty value and no value.

comment:5 Changed 8 years ago by Vladimir Prus

I'd agree. Ignoring bits of config file seems a potentially confusing behaviour.

comment:6 Changed 8 years ago by Sascha Ochsenknecht

Ok, another proposal would be to store an empty value for string type values (also for collection of strings) and throwing a validation error for e.g. integer types: "invalid option value "

This is probably better than storing a default constructed value, which could be undefined. Or in other words, what is an empty integer? undefined or invalid (I would prefer invalid -> exception)?

Please comment.

comment:7 Changed 8 years ago by olafvdspek@…

Invalid

comment:8 Changed 8 years ago by Sascha Ochsenknecht

Resolution: fixed
Status: reopenedclosed

(In [57829]) store empty values from config file, Fixes #1537

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Vladimir Prus.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.