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

Sync'ing from a file is failing in 6.2.46: "Skip badly formed line" #766

Closed
pkissman opened this issue Sep 26, 2019 · 8 comments · Fixed by #764
Closed

Sync'ing from a file is failing in 6.2.46: "Skip badly formed line" #766

pkissman opened this issue Sep 26, 2019 · 8 comments · Fixed by #764
Labels

Comments

@pkissman
Copy link

I just upgraded from 6.2.44 to 6.2.46 from source on a Debian host.
I have two flat files of email addresses that are included into some lists.
Sync'ing those files now completely fails with "Skip badly formed line" until the process aborts.

I am now seeing this in my sympa log file:

Sep 26 08:58:46 mblc-web01 wwsympa[31083]: err main::#1544 > main::do_sync_include#16517 > Sympa::List::sync_include#4825 > Sympa::Spindle::spin#95 > Sympa::Request::Handler::include::_twist#181 > Sympa::Request::Handler::include::_update_users#292 > Sympa::DataSource::next#149 > Sympa::DataSource::File::_next#75 Skip badly formed line: "[email protected]#15"

Eventually I see the error:
Sympa::Request::Handler::include::_twist#181 > Sympa::Request::Handler::include::_update_users#292 > Sympa::DataSource::next#149 > Sympa::DataSource::File::_next#65 Too much errors in file /etc/sympa/pubdir-announce. Source file probably corrupted. Cancelling

There have been no changes other than the upgrade. The included source file is exactly the same.

[email protected]
[email protected]

with unix linefeeds.

Any help would be appreciated.

Version

Installation method

Expected behavior

Actual behavior

Additional information

@ikedas
Copy link
Member

ikedas commented Sep 26, 2019

Hi @pkissman,

I guess the error message tells that the file contains lines with Microsoft newlines (CR+LF).

@racke
Copy link
Contributor

racke commented Sep 26, 2019

@ikedas we should deal with that instead of throwing an error.

@pkissman
Copy link
Author

pkissman commented Sep 26, 2019 via email

@pkissman
Copy link
Author

@ikedas and @racke ,

I reinstalled 6.2.46 and regenerated the included file I was having trouble with, but with Unix line breaks, and it did indeed solve the problem. Thank you.

I was also suffering from issues #763 every time I added and removed data sources. #764 solved that problem.

However, I don't remember that email addresses which have been included from a file remained subscribed once the data source is removed. I thought you still had the ability to sync the subscribers so that the included emails were automatically removed. Is this new behavior, or am I misremembering?

@ikedas
Copy link
Member

ikedas commented Sep 26, 2019

Current code looks supporting both LF and CR+LF:

chomp $line;
if (++$lines > 49 and not $found) {
$log->syslog(
'err',
'Too much errors in file %s. Source file probably corrupted. Cancelling',
$self->{path}
);
return undef;
}
# Empty lines are skipped
next if $line =~ /^\s*$/;
next if $line =~ /^\s*\#/;
# Skip badly formed emails.
unless ($line =~ /\A\s*($email_re)(?:\s+(\S.*))?\z/) {
$log->syslog('err', 'Skip badly formed line: "%s"', $line);
next;
}
my ($email, $gecos) = ($1, $2);
$gecos =~ s/\s+\z// if defined $gecos;

It’s curious... By any chance you have been using CR+CR+LF? It was allowed by previous versions.

Anyways it’s incompatible change. I’ll submit fixes later.

@ikedas
Copy link
Member

ikedas commented Sep 27, 2019

Hi @pkissman,

Could you please apply this patch and check if the problem will be solved?

@ikedas
Copy link
Member

ikedas commented Sep 27, 2019

Related to #693.

@pkissman
Copy link
Author

pkissman commented Sep 27, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants