[Pkg-mailman-hackers] Bug#891703: Bug#891703: DB user isn't read from setting_local (mailman3-suite.py in /etc)

Jonas Meurer jonas at freesources.org
Sat Mar 3 10:51:38 UTC 2018


Hi Markus, hi Eric,

I'm pretty sure that the bug you discovered is not that the DB settings
are read from wrong file (settings.py instead of settings_local.py).

Instead it's that the permssions for the SQLite database file were
wrong. The initial django-admin commands in the postinst maintainer
script were run by root, which is wrong.

I fixed this now in the mailman3-suite packaging Git repo and the fix
will be part of the next mailman3-suite upload.

Am 02.03.2018 um 01:07 schrieb Markus Gschwendt:
> as a sidenote:
> there are 2 .db files in that directory:

That's now fixed as well :)

Cheers,
 jonas

Am 02.03.2018 um 01:07 schrieb Markus Gschwendt:
> I'm not sure if this is the same bug.
> 
> I get following in the logs:
> 
> ```
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/dist-
> packages/django/core/handlers/exception.py", line 41, in inner
>     response = get_response(request)
>   File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", 
> line 249, in _legacy_get_response
>     response = self._get_response(request)
>   File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", 
> line 187, in _get_response
>     response = self.process_exception_by_middleware(e, request)
>   File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", 
> line 185, in _get_response
>     response = wrapped_callback(request, *callback_args,
> **callback_kwargs)
>   File "/usr/lib/python2.7/dist-packages/django/views/generic/base.py", 
> line 68, in view
>     return self.dispatch(request, *args, **kwargs)
>   File "/usr/lib/python2.7/dist-packages/django/utils/decorators.py",
> line 67, in _wrapper
>     return bound_func(*args, **kwargs)
>   File "/usr/lib/python2.7/dist-
> packages/django/views/decorators/debug.py", line 76, in
> sensitive_post_parameters_wrapper
>     return view(request, *args, **kwargs)
>   File "/usr/lib/python2.7/dist-packages/django/utils/decorators.py",
> line 63, in bound_func
>     return func.__get__(self, type(self))(*args2, **kwargs2)
>   File "/usr/lib/python2.7/dist-packages/allauth/account/views.py",
> line 137, in dispatch
>     return super(LoginView, self).dispatch(request, *args, **kwargs)
>   File "/usr/lib/python2.7/dist-packages/allauth/account/views.py",
> line 80, in dispatch
>     **kwargs)
>   File "/usr/lib/python2.7/dist-packages/django/views/generic/base.py", 
> line 88, in dispatch
>     return handler(request, *args, **kwargs)
>   File "/usr/lib/python2.7/dist-packages/allauth/account/views.py",
> line 103, in post
>     response = self.form_valid(form)
>   File "/usr/lib/python2.7/dist-packages/allauth/account/views.py",
> line 150, in form_valid
>     return form.login(self.request, redirect_url=success_url)
>   File "/usr/lib/python2.7/dist-packages/allauth/account/forms.py",
> line 197, in login
>     redirect_url=redirect_url)
>   File "/usr/lib/python2.7/dist-packages/allauth/account/utils.py",
> line 146, in perform_login
>     send_email_confirmation(request, user, signup=signup)
>   File "/usr/lib/python2.7/dist-packages/allauth/account/utils.py",
> line 323, in send_email_confirmation
>     confirm=True)
>   File "/usr/lib/python2.7/dist-packages/allauth/account/managers.py",
> line 15, in add_email
>     user=user, email__iexact=email, defaults={"email": email}
>   File "/usr/lib/python2.7/dist-packages/django/db/models/manager.py",
> line 85, in manager_method
>     return getattr(self.get_queryset(), name)(*args, **kwargs)
>   File "/usr/lib/python2.7/dist-packages/django/db/models/query.py",
> line 466, in get_or_create
>     return self._create_object_from_params(lookup, params)
>   File "/usr/lib/python2.7/dist-packages/django/db/models/query.py",
> line 498, in _create_object_from_params
>     obj = self.create(**params)
>   File "/usr/lib/python2.7/dist-packages/django/db/models/query.py",
> line 394, in create
>     obj.save(force_insert=True, using=self.db)
>   File "/usr/lib/python2.7/dist-packages/django/db/models/base.py",
> line 808, in save
>     force_update=force_update, update_fields=update_fields)
>   File "/usr/lib/python2.7/dist-packages/django/db/models/base.py",
> line 838, in save_base
>     updated = self._save_table(raw, cls, force_insert, force_update,
> using, update_fields)
>   File "/usr/lib/python2.7/dist-packages/django/db/models/base.py",
> line 924, in _save_table
>     result = self._do_insert(cls._base_manager, using, fields,
> update_pk, raw)
>   File "/usr/lib/python2.7/dist-packages/django/db/models/base.py",
> line 963, in _do_insert
>     using=using, raw=raw)
>   File "/usr/lib/python2.7/dist-packages/django/db/models/manager.py",
> line 85, in manager_method
>     return getattr(self.get_queryset(), name)(*args, **kwargs)
>   File "/usr/lib/python2.7/dist-packages/django/db/models/query.py",
> line 1076, in _insert
>     return query.get_compiler(using=using).execute_sql(return_id)
>   File "/usr/lib/python2.7/dist-
> packages/django/db/models/sql/compiler.py", line 1112, in execute_sql
>     cursor.execute(sql, params)
>   File "/usr/lib/python2.7/dist-packages/django/db/backends/utils.py",
> line 64, in execute
>     return self.cursor.execute(sql, params)
>   File "/usr/lib/python2.7/dist-packages/django/db/utils.py", line 94,
> in __exit__
>     six.reraise(dj_exc_type, dj_exc_value, traceback)
>   File "/usr/lib/python2.7/dist-packages/django/db/backends/utils.py",
> line 64, in execute
>     return self.cursor.execute(sql, params)
>   File "/usr/lib/python2.7/dist-
> packages/django/db/backends/sqlite3/base.py", line 328, in execute
>     return Database.Cursor.execute(self, query, params)
> OperationalError: attempt to write a readonly database
> ```
> 
> after changing the owner of the database the error disappears:
> 
> chown www-data:www-data /var/lib/mailman3/web/mailman3suite.db.db
> 
> as a sidenote:
> there are 2 .db files in that directory:
> 
> /var/lib/mailman3/web/
> 0 -rw-r-----  1 www-data www-data 0 Mar 1 19:25 mailman3suite.db
> 476 -rw-r--r--  1 root root 487424 Mar 1 20:00 mailman3suite.db.db
> 
> mailman 3.1.1 stretch-backports
> fresh install an new machine
> 
> _______________________________________________
> Pkg-mailman-hackers mailing list
> Pkg-mailman-hackers at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-mailman-hackers
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 866 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-mailman-hackers/attachments/20180303/1564b53f/attachment.sig>


More information about the Pkg-mailman-hackers mailing list