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

include_sql_query broken for CSV database driver #1434

Closed
salaun-urennes1 opened this issue Jul 1, 2022 · 5 comments · Fixed by #1435
Closed

include_sql_query broken for CSV database driver #1434

salaun-urennes1 opened this issue Jul 1, 2022 · 5 comments · Fixed by #1435
Labels
bug ready A PR is waiting to be merged. Close to be solved
Milestone

Comments

@salaun-urennes1
Copy link
Collaborator

Sympa provides the ability to include list members from a CSV file using include_sql_query parameter.
This feature used to work back in 1999, see [https://listes.renater.fr/sympa/arc/sympa-fr/1999-04/msg00011.html](https://listes.renater.fr/sympa/arc/sympa-fr/1999-04/msg00011.html. With Sympa 6.2.48 I was unable to make it work.

Version

Sympa 6.2.48

Installation method

Installed from sources

Expected behavior

Sympa GUI should let me add an include_sql_query for a CSV file.
Once defined this parameter, Sympa should be able to load list members from this data source

Actual behavior

Two problems :

  1. Sympa won't let you define an include_sql_query without db_name, db_host and db_user;
  2. if you define dummy values for these parameters it fails while trying to connect to the DB (at least in my environment).

Steps to reproduce

  1. create an email.csv file in test list directory:
  1. from Sympa GUI, add a datasource for test list:
    gui-define-csv-source
  2. click "Apply modifications" and check logs
  3. Sympa log says : Jul 1 08:43:00 XXX wwsympa[26692]: info main::do_edit_list() [robot XXX] [session 98363298541990] [client 129.20.126.25] [user XXX] [list test-osalaun01] No parameter was edited by user
  4. second try, adding db_name, db_host and db_user parameters (though you are not useful to include a CSV file)
  5. logs says:
Jul  1 08:45:47 XXX wwsympa[7566]: info main::do_edit_list() [robot XXX] [session 98363298541990] [client 129.20.126.25] [user XXX] [list test-osalaun01]
Jul  1 08:45:48 XXX wwsympa[7566]: notice Sympa::List::on_the_fly_sync_include() Synchronizing list members...
Jul  1 08:45:48 XXX wwsympa[7566]: notice Sympa::Spindle::ProcessRequest::_twist() Processing Sympa::Request <action=include;[email protected];role=member>
Jul  1 08:45:48XXX wwsympa[7566]: err main::#1544 > main::do_edit_list#10623 > Sympa::List::on_the_fly_sync_include#4859 > Sympa::List::sync_include#4828 > Sympa::Spindle::spin#95 > Sympa::Request::Handler::include::_twist#181 > Sympa::Request::Handler::include::_update_users#289 > Sympa::DataSource::open#134 > Sympa::DataSource::SQL::_open#47 > Sympa::Database::connect#123 > (eval)#2 > (eval)#15 > (eval)#44 > (eval)#44 > DBD::File::TableSource::FileSystem::BEGIN#333 > (eval)#44 > (eval)#44 > IO::Dir::BEGIN#18 > (eval)#44 > (eval)#44 > File::stat::BEGIN#42 > (eval)#41 DIED: S_IFFIFO is not a valid Fcntl macro at /usr/share/perl5/File/stat.pm line 41

And also get an exception on the GUI:
gui-exception

But this time the list's config file has been updated as follows:

include_sql_query
db_name none
db_user none
db_type CSV
db_host none
name email.csv
f_dir /data/sympa/list_data/XXX/test-osalaun01
sql_query SELECT email FROM email.csv

Additional information

I'm using perl-DBD-CSV-0.38-3.el7.noarch package on CentOS 7.9

@ikedas ikedas added bug labels Jul 1, 2022
@ikedas
Copy link
Member

ikedas commented Jul 1, 2022

On the second thing in this issue:

DIED: S_IFFIFO is not a valid Fcntl macro at /usr/share/perl5/File/stat.pm line 41

The cause is that customizing $SIG{__DIE__} handler by Sympa::Crash breaks processing in File::stat. cf. Q&A on stack overflow.
On Sympa, similar problem (related to syntax checking of regexps) has been reported and fixed on #860 .

AFAICS this problem looks existing in Sympa since pre-6.0 (5.3 or before). 6.2alpha.

@salaun-urennes1
Copy link
Collaborator Author

Maybe it's obvious, but I should mention that Sympa processes died while trying to synchronize members

@salaun-urennes1
Copy link
Collaborator Author

Do you want me to try the same scenario on Sympa 6.2.56 or higher?

@ikedas
Copy link
Member

ikedas commented Jul 1, 2022

@salaun-urennes1 , could you please try the fix in the PR above?

@ikedas
Copy link
Member

ikedas commented Jul 6, 2022

I'd like to submit the first thing as a separate issue.

@ikedas ikedas added the ready A PR is waiting to be merged. Close to be solved label Jul 14, 2022
@ikedas ikedas added this to the 6.2.72 milestone Sep 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ready A PR is waiting to be merged. Close to be solved
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants