#836675 sinntp: Unable to download news because of error

#836675#5
Date:
2016-09-04 15:49:56 UTC
From:
To:
Dear Maintainer,


I have a small bash script that runs sinntp to download NNTP news in batch.

It failed to download several of my newsgroups with the following errors

Traceback (most recent call last):
  File "/usr/bin/sinntp", line 351, in <module>
    command(connection)
  File "/usr/bin/sinntp", line 192, in __call__
    start = config[group] if not self.options.reget else 0
  File "/usr/bin/sinntp", line 86, in __getitem__
    return int(file.read())
ValueError: invalid literal for int() with base 10: ''

nntp-pull of comp.lang.prolog
Traceback (most recent call last):
  File "/usr/bin/sinntp", line 351, in <module>
    command(connection)
  File "/usr/bin/sinntp", line 192, in __call__
    start = config[group] if not self.options.reget else 0
  File "/usr/bin/sinntp", line 86, in __getitem__
    return int(file.read())
ValueError: invalid literal for int() with base 10: ''

nntp-pull of comp.lang.javascript
Traceback (most recent call last):
  File "/usr/bin/sinntp", line 351, in <module>
    command(connection)
  File "/usr/bin/sinntp", line 192, in __call__
    start = config[group] if not self.options.reget else 0
  File "/usr/bin/sinntp", line 86, in __getitem__
    return int(file.read())
ValueError: invalid literal for int() with base 10: ''

To get around this, I changed the line 86 to :-
	return int("0" + file.read())

This is because on EOF, I think python returns '', which doesn't convert to an int.

Is there another way of getting around this. Seems to work correctly with this change in.


Regards,
David

#836675#8
Date:
2017-09-26 19:16:45 UTC
From:
To:
Hi David!

Upstream speaking here. Thanks for the bug report, and sorry for the
late reply.

* David Creelman <creelman.david@gmail.com>, 2016-09-05, 01:49:
...

That's weird. We only write integers to the state file, so they should
never be empty. :\

Now, sinntp before 1.5.2 didn't write the state files atomically, so if
you killed the sinntp process in a bad moment, or if the filesystem
wasn't unmounted cleanly, then you could indeed end up with empty state
files. Maybe that's what happened?

I'd rather not apply this change, since it's curing only symptoms, not
the cause.