Bug 388367 - config.dvb contains garbage values for higherVoltage after setting in "Configure Television" window
Summary: config.dvb contains garbage values for higherVoltage after setting in "Config...
Status: RESOLVED FIXED
Alias: None
Product: kaffeine
Classification: Applications
Component: general (show other bugs)
Version: 2.0.13
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Mauro Carvalho Chehab
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-30 20:19 UTC by Randall Fisher
Modified: 2018-02-20 18:59 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Randall Fisher 2017-12-30 20:19:12 UTC
I have a four tuner WinTV-quadHD card.  The tuners show up as "Device" tabs in the "Configure Television" window.  In each of these tabs, I set a "Source" and "Name" for the corresponding tuner.

After saving this information and quitting kaffeine, the values for higherVoltage in the config.dvb file were very large values (probably random, uninitialized junk).  The value for the first tuner is a positive number, the values for the remaining tuners are negative.

If I then restart kaffeine, it complains that "kaffeine.dvb: Cannot read /home/rfisher/.local/share/kaffeine/config.dvb".

However, it is able to read the "Source" and "Name" for the first tuner, but not the remaining tuners.  If you quit at this point, it will rewrite config.dvb with this information removed for the second through fourth tuners, but leaving the stored information for the first tuner.

If you edit config.dvb and replace the negative values for higherVoltage with the same large, positive value used for the first tuner, it reads the entire file, does not complain about that it can't, and gets the correct "Name" and "Source" information for all four tuners.

So, this is what I think is happening:
    1. kaffeine is storing uninitialized data for higherVoltage into the config.dvb file.  higherVoltage appears to be of type Qt::CheckState which should only have the values 0, 1, or 2.  It should not have large positive or negative values.

    2. The error message implies that the file permissions are incorrect - they are not.  kaffeine is able to read and write to the file.  I think it is trying to indicate that the file is malformed due to the negative values for higherVoltage.  If so, the error message should say so clearly.
Comment 1 Mauro Carvalho Chehab 2018-02-20 18:13:57 UTC
(In reply to Randall Fisher from comment #0)
> I have a four tuner WinTV-quadHD card.  The tuners show up as "Device" tabs
> in the "Configure Television" window.  In each of these tabs, I set a
> "Source" and "Name" for the corresponding tuner.
> 
> After saving this information and quitting kaffeine, the values for
> higherVoltage in the config.dvb file were very large values (probably
> random, uninitialized junk).  The value for the first tuner is a positive
> number, the values for the remaining tuners are negative.
> 
> If I then restart kaffeine, it complains that "kaffeine.dvb: Cannot read
> /home/rfisher/.local/share/kaffeine/config.dvb".
> 
> However, it is able to read the "Source" and "Name" for the first tuner, but
> not the remaining tuners.  If you quit at this point, it will rewrite
> config.dvb with this information removed for the second through fourth
> tuners, but leaving the stored information for the first tuner.
> 
> If you edit config.dvb and replace the negative values for higherVoltage
> with the same large, positive value used for the first tuner, it reads the
> entire file, does not complain about that it can't, and gets the correct
> "Name" and "Source" information for all four tuners.
> 
> So, this is what I think is happening:
>     1. kaffeine is storing uninitialized data for higherVoltage into the
> config.dvb file.  higherVoltage appears to be of type Qt::CheckState which
> should only have the values 0, 1, or 2.  It should not have large positive
> or negative values.

Hmm... did you change Kaffeine to a newer version? If so, then maybe it is
just the backward-compatible code for config.dvb generated with older versions
that is broken.

>     2. The error message implies that the file permissions are incorrect -
> they are not.  kaffeine is able to read and write to the file.  I think it
> is trying to indicate that the file is malformed due to the negative values
> for higherVoltage.  If so, the error message should say so clearly.

Yeah, the message there is not nice:

	if (!reader.isValid())
		qCWarning(logDvb, "Cannot read %s", qPrintable(file.fileName()));

I'll fix it.
Comment 2 Mauro Carvalho Chehab 2018-02-20 18:59:07 UTC
Added two patches:

dvbmanager: higherVoltage exists only for DVB-S:

   https://commits.kde.org/kaffeine/26d6ce62732baaa87f9eea432513db3e5e78cb47

dvbmanager: Improve config.dvb parsing error message:

 https://commits.kde.org/kaffeine/daa7865398d0897cc2fef7d218b3a8fbce6ea664


> 
> When the config.dvb file reader fails, it produces a very
> obscure message. Improve it.
Comment 3 Mauro Carvalho Chehab 2018-02-20 18:59:53 UTC
(In reply to Mauro Carvalho Chehab from comment #2)
> Added two patches:
> 
> dvbmanager: higherVoltage exists only for DVB-S:
> 
>    https://commits.kde.org/kaffeine/26d6ce62732baaa87f9eea432513db3e5e78cb47
> 
> dvbmanager: Improve config.dvb parsing error message:
> 
>  https://commits.kde.org/kaffeine/daa7865398d0897cc2fef7d218b3a8fbce6ea664

Sorry, hit enter before finishing...

Those two patches should address both issues.