The filters file is read by Configuration class (apt-pkg), whose
format is defined in apt.conf(5).  Besides being syntactically
incorrect [1] there are other issues that prohibit reliable parsing of
the data.

For example, this pattern from one of the standard filters combines
several sub-patterns:
>   pattern {
>     andMode 0;
>     patterns {
>       Component; "main"; true;
>       Component; "restricted"; true;
>       Origin; "Ubuntu"; false;
>     };
>   };

The sub-patterns are 3-tuples, yet are concatenated in to a single
list.  The reader blindly expects this structure.  When there is a
parsing error (such as due to newlines in the second value), the
reader becomes confused and will crash as “top->Next” will become null
too soon.

Several changes are needed to make the reader robust.  This will take
some amount of work to properly resolve.  I suggest leaving it for now
as the user has fixed the immediate issue by removing the malformed
value from their filters file, and this does not appear to affect
anyone else.

I strongly suggest not to not implement any work-around or extra
precautions in either the GUI or current reader code until the design
issues with the filter file can be looked at.

Regards

[1] Missing the required double-quotes around many values, for example.

* Details of required fix

The filter writer must generate the correct syntax as per apt.conf(5).
 It is not enough to rely on the fact that the currently generated
files work, because it is not conforming to the documented format.

The sub-patterns must be self-contained, and ideally use a key–value
structure to increase reliability and flexibility:
>  patterns {
>    pattern_0 {
>      field "Component";
>      value "main";
>      excl "true";
>    };
>    pattern_1 {
>      field "Component";
>      value "restricted";
>      …

It is preferable if the list of filters was not in the root of the
configuration namespace, but someplace under the Synaptic tree:
> Syntapic::filters {
>   filter_1 {
>     name "Filter 1";
>     pattern {
>     …

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/873860

Title:
  synaptic won't run in sudo mode and produces a segfault in the syslog

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/synaptic/+bug/873860/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to