-
Notifications
You must be signed in to change notification settings - Fork 201
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
test_readWriteCrontab fails when crontab is an empty file #1181
Comments
Congrats, perfect issue report with excellent minimal reproducible example :-) I could reproduce the test failure on HEAD and Ubuntu 20.04 with Python 3.8.10 via
Would be great if a developer here raises the hand to fix this (I have no more time this week), since it is so easy to reproduce... |
Diagnoses: This code line creates a list of lines from the file content using the new line char (\n) to split the lines: https://github.com/bit-team/backintime/blob/master/common/tools.py#L1236 If the crontab file is empty it returns a list of length 1 (sic!) with an empty string instead of an empty list:
Instead an empty file should return a an empty list of length 0:
I think the fix is easy so I will prepare one and open an pull request... |
Note: The unit test also fails if the crontab contains only empty lines (one or more) since this is also stripped and split into the erroneous |
Closes #1181: test_readWriteCrontab fails when crontab is empty
Test test_readWriteCrontab fails when crontab is an empty file.
Save an empty crontab.
The text was updated successfully, but these errors were encountered: