Re: [cdebconf] empty value != no value
On Fri, Nov 22, 2002 at 07:02:29PM +0100, Martin Sjögren wrote:
> fre 2002-11-22 klockan 17.02 skrev Denis Barbier:
> > Hi,
> > debconf makes a difference between no value and an empty value.
> > In order for cdebconf to have the same behaviour, question_get_field
> > must return NULL if the requested field does not exist, which breaks
> > many things because it is supposed to return a pointer to a string.
> > May I perform all the necessary changes, and potentiolly cause some
> > sigsegv if a return address is kept untested?
> I for one would be very happy to see the distinction no value != empty
> value. In fact, I've been pondering how to detect the "no value" case :)
> I'd say go ahead, the errors are probably easy to find and fix.
Ok, but I'm afraid it won't help you with anna.
Take a template with Default: foo and let's see what is returned by
'GET template'; there are 6 cases:
Default: foo no Default
no value 'foo' (1) '' (4)
Value: '' (2) '' (5)
Value: bar 'bar' (3) 'bar' (6)
With the proposed change, cdebconf will be able to handle all these
cases, but you still cannot determine in which case you are from
the result string. To know whether a value has been set, I think
you have to check the 'seen' flag.