bug-recutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Not all combinations checked when more than one multiple-value field pre


From: Marcin Szewczyk
Subject: Not all combinations checked when more than one multiple-value field present
Date: Thu, 30 Jul 2020 17:14:15 +0200
User-agent: Mutt/1.10.1 (2018-07-13)

Hi,

I have checked how recsel works with a file like the following one:
#v+
# test with: 'X = "x2" && Y = "y2"'
X: x1
X: x2
Y: y1
Y: y2
Y: y3
#v-

The results are:
$ utils/recsel ~/test.rec -e 'X = "x2" && Y = "y2"' | wc -l
0
$ utils/recsel ~/test.rec -e 'X = "x1" && Y = "y2"' | wc -l
5
$ utils/recsel ~/test.rec -e 'X = "x2" && Y = "y1"' | wc -l
5

I would expect 5 lines for the first expression as well.

I think it works like this:
In the `rec_sex_eval` function the loop goes through just one field's
values at a time, so every multiple-value field and its every value is
tested only with first values of other multiple-value fields (default
index = 0 for `rec_record_get_field_by_name` in `rec_sex_eval_node`).

It is hard to say if it is a bug but it is not an intuitive behavior to
me. The documentation[1] also states that:
> The previous expression will be evaluated for every possible
> permutation of the fields “Email”, “Age” and “Fixed” present in the
> record, until one of the combinations succeeds.

So either the code or the documentation seems to require fixing.


[1]: 
https://www.gnu.org/software/recutils/manual/SEX-Evaluation.html#SEX-Evaluation

-- 
Marcin Szewczyk
http://wodny.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]