Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross-robot include_sympa_list tries to include the wrong list, possibly failing with an imagined "inclusion loop" #1797

Open
dpoon opened this issue Feb 15, 2024 · 0 comments · May be fixed by #1798

Comments

@dpoon
Copy link

dpoon commented Feb 15, 2024

If a mailing list target-list@target-robot.example.edu is configured with

include_sympa_list
name blah
listname source-list@source-robot.example.edu

… then when Sympa performs the sync, it tries to include source-list@target-robot.example.edu instead.

Version

6.2.66, but I believe the problematic code is the same in 6.2.72 and main.

Installation method

Universe repo for Ubuntu 22.04: https://mirror.it.ubc.ca/ubuntu/pool/universe/s/sympa/sympa_6.2.66~dfsg-2_amd64.deb

Steps to reproduce

Configure mailing list data sources as described in the summary above (Admin → Edit List Config → Data Sources Setup → List inclusion). Trigger a sync (sympa.pl --sync_include=target-list@target-robot.example.edu).

Actual behavior

Sympa tries to load source-list@target-robot.example.edu instead of source-list@source-robot.example.edu.

Furthermore, if source-list and target-list share the same listname in different robots, then Sympa ends up trying to include target-list@target-robot.example.edu, causing the inclusion request to fail with

err main::#851 > Sympa::Spindle::spin#95 > Sympa::Request::Handler::include::_twist#202 > Sympa::Request::Handler::include::_update_users#370 > Sympa::DataSource::open#139 > Sympa::DataSource::List::_open#71 Loop detection in list inclusion: could not include again Sympa::DataSource::List <context=listname@target-robot.example.edu;id=4e750bd4;role=member;name=include_list listname@source-robot.example.edu> in list Sympa::List <listname@target-robot.example.edu>

… even though no such loop exists.

Expected behavior

This used to work: Sympa would load source-list@source-robot.example.edu.

Additional information

I believe, from reading the code, that it broke in Sympa 6.2.45b.1. Commit c1b7e32, part of pull request #516, is suspect.

Compare this code in 6.2.44, in which the source list's robot is inferred to be the target list's robot only if the source list's name does not specify a robot:

sympa/src/lib/Sympa/List.pm

Lines 7095 to 7096 in 313a004

$source_id = sprintf '%s@%s', $source_id, $self->{'domain'}
unless 0 < index($source_id, '@');

… with this code in 6.2.45b1, in which the source list's robot is forcibly set to be the inclusion context's domain (i.e. the target list's robot):

my $list = $self->{context};
if (ref $list eq 'Sympa::List') {
my $inlist = Sympa::List->new($self->{listname}, $list->{'domain'},
{just_try => 1});
$self->{listname} = $inlist->get_id if $inlist;
}

Keep in mind that

$robot ||= $parts[1];
makes it so that specifying the optional $robot parameter when calling the Sympa::List->new($name, $robot) constructor causes the $robot parameter override any @domain that may appear in the $name.

@dpoon dpoon added the bug label Feb 15, 2024
dpoon added a commit to dpoon/sympa that referenced this issue Feb 15, 2024
If the Sympa::List->new($name, $robot, $options) constructor is called with an optional $robot parameter specified, then that $robot overrides any domain that may be present in $name.  When constructing a DataSource for inclusion, the robot of the DataSource should be inferred only if no domain is present in the list name.
@ikedas ikedas added enhancement and removed bug labels Feb 17, 2024
@ikedas ikedas linked a pull request Feb 17, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants