[PR #1654] [CLOSED] [WIP] Fix Modoboa crashes when Postfix maps become modified #2280

Closed
opened 2026-02-27 12:10:15 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/modoboa/modoboa/pull/1654
Author: @ntninja
Created: 1/13/2019
Status: Closed

Base: masterHead: fixes


📝 Commits (3)

  • b6139d2 Postfix map generator generate invalid map file if file integrity check fails
  • 90056e9 Ignore incorrect Postfix checksum file lines
  • 810b737 Do not crash if Postfix checksum does not exist in Postfix generator file

📊 Changes

1 file changed (+10 additions, -6 deletions)

View changed files

📝 modoboa/core/management/commands/generate_postfix_maps.py (+10 -6)

📄 Description

Description of the issue/feature this PR addresses:

Modoboa's Postfix map file generator will generate a broken modoboa-postfix-maps.chk file if it fails to validate the existing map files due to user changes. On next start (ie: the second start after a user map file change!) modoboa will then crash inexplicably.

Explanation of each commit:

  1. Don't create invalid map files when detecting unexpected changes in a map file
  2. Don't crash on startup when encountering invalid lines in the checksum file
  3. Don't crash on startup when missing checksum file entries for only some (but not all) files

As can be seen from the commit dates these commits are rather old – it's been a while since I encountered this issue last.

Current behavior before PR:

modoboa    | Traceback (most recent call last):
modoboa    |   File "manage.py", line 22, in <module>
modoboa    |     execute_from_command_line(sys.argv)
modoboa    |   File "/usr/lib/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
modoboa    |     utility.execute()
modoboa    |   File "/usr/lib/python3.6/site-packages/django/core/management/__init__.py", line 356, in execute
modoboa    |     self.fetch_command(subcommand).run_from_argv(self.argv)
modoboa    |   File "/usr/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv
modoboa    |     self.execute(*args, **cmd_options)
modoboa    |   File "/usr/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute
modoboa    |     output = self.handle(*args, **options)
modoboa    |   File "/usr/lib/python3.6/site-packages/modoboa/core/management/commands/generate_postfix_maps.py", line 158, in handle
modoboa    |     self.__load_checksums(destdir)
modoboa    |   File "/usr/lib/python3.6/site-packages/modoboa/core/management/commands/generate_postfix_maps.py", line 53, in __load_checksums
modoboa    |     fname, dbtype, checksum = line.split(":")
modoboa    | ValueError: too many values to unpack (expected 3)

Desired behavior after PR is merged:

Modoboa should only log message: Cannot upgrade '…' map because it has been modified.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/modoboa/modoboa/pull/1654 **Author:** [@ntninja](https://github.com/ntninja) **Created:** 1/13/2019 **Status:** ❌ Closed **Base:** `master` ← **Head:** `fixes` --- ### 📝 Commits (3) - [`b6139d2`](https://github.com/modoboa/modoboa/commit/b6139d24f64ce6f46f087cb28c114f7087ea9f4e) Postfix map generator generate invalid map file if file integrity check fails - [`90056e9`](https://github.com/modoboa/modoboa/commit/90056e91890e9ea79e8732e471bc595cc8f896d2) Ignore incorrect Postfix checksum file lines - [`810b737`](https://github.com/modoboa/modoboa/commit/810b7374be4558b20bf12926166601a3b014ea81) Do not crash if Postfix checksum does not exist in Postfix generator file ### 📊 Changes **1 file changed** (+10 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `modoboa/core/management/commands/generate_postfix_maps.py` (+10 -6) </details> ### 📄 Description *Description of the issue/feature this PR addresses:* Modoboa's Postfix map file generator will generate a broken `modoboa-postfix-maps.chk` file if it fails to validate the existing map files due to user changes. On next start (ie: the second start after a user map file change!) modoboa will then crash inexplicably. Explanation of each commit: 1. Don't create invalid map files when detecting unexpected changes in a map file 2. Don't crash on startup when encountering invalid lines in the checksum file 3. Don't crash on startup when missing checksum file entries for only some (but not all) files As can be seen from the commit dates these commits are rather old – it's been a while since I encountered this issue last. *Current behavior before PR:* modoboa | Traceback (most recent call last): modoboa | File "manage.py", line 22, in <module> modoboa | execute_from_command_line(sys.argv) modoboa | File "/usr/lib/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line modoboa | utility.execute() modoboa | File "/usr/lib/python3.6/site-packages/django/core/management/__init__.py", line 356, in execute modoboa | self.fetch_command(subcommand).run_from_argv(self.argv) modoboa | File "/usr/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv modoboa | self.execute(*args, **cmd_options) modoboa | File "/usr/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute modoboa | output = self.handle(*args, **options) modoboa | File "/usr/lib/python3.6/site-packages/modoboa/core/management/commands/generate_postfix_maps.py", line 158, in handle modoboa | self.__load_checksums(destdir) modoboa | File "/usr/lib/python3.6/site-packages/modoboa/core/management/commands/generate_postfix_maps.py", line 53, in __load_checksums modoboa | fname, dbtype, checksum = line.split(":") modoboa | ValueError: too many values to unpack (expected 3) *Desired behavior after PR is merged:* Modoboa should only log message: *Cannot upgrade '…' map because it has been modified.* --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 12:10:15 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#2280
No description provided.