Mailing List Archive

BUG: SQL Error on adding first User to Davical 0.9.9.4
Hi Devs!

i recently found a problem in DaviCal 0.9.9.4 on Debian Lenny when i try
to add my first user(principal) to a all new fresh database. Then
DaviCal throws out a SQL Error on its Webinterface (details later).

I searched Internet already and asked IRC for that, but no luck yet. i
also did not found any bugreporting tool somewhere.

So i guess the DEV Mailing list should be a good start to report in.

The Problem is ALWAYS reproducable. The Error-Message thrown is always
the same. However the Results within the database seems to be not always
the same. Here is what ive done:


1. installed fresh debian lenny, followed all the instructions on the
Davical website for a debian installation.

2. where it comes to the point to creat the davical database by entering
"su postgres -c /usr/share/davical/dba/create-database.sh" it works fine
and i retrieve my admins password.

3. i then log in to the webinterface as "admin" using that password.
Anything looks fine yet.

4. trying to add my first principal(user) to the database using the
webinterface: i enter a username like "testuser1", password "1234",
Displayname "testuser1" , entering some email Adress, defining some
permissions to "All Users" (BTW: the ALL button is NOT WORKING AT ALL!
Any other preset-Button seems to work as expected). So i klick on
READ/WRITE and add view more permissions as i want them. Then i click on
CREATE and receive the following Error Screen in some BROWN block near
top of the screen:

* ERROR: SQL error "23505" - ERROR: duplicate key value violates
unique constraint "principal_pkey""
* Home calendar added.

The User HAS NOT BEEN CREATED! Nothing will be displayed in "list users"
, "list groups", "list resources".

5. i now repeat the same thing at 4. and this time IT WILL WORK. But as
you can see within the database itself, it somehow "skipped" an user-id
in some tables.

Also i once had a case where in some tables it created some strange
"half baked entry" with no username in it, but registered an ID and
password. realy strange!


btw: this is my config file atm:

<?php
$c->admin_email = 'mail at awerner.homeip.net';
$c->system_name = "10.230.20.80 - TEST AW DAViCal CalDAV Server";
$c->enable_row_linking = true;
$c->default_locale = de_DE.UTF-8;
$c->pg_connect[] = 'dbname=davical user=davical_app';


6. i can reproduce this by dropping the davical database and recreating
it. appears every time!

So again in short: this may be TWO SEPERATE BUGS. The Problem with the
ALL Button at Permissions, and the Problem adding the first user to the
database.

Hope this helps.
best regards
Axel
BUG: SQL Error on adding first User to Davical 0.9.9.4 [ In reply to ]
On Mon, 2011-01-31 at 13:38 +0100, Axel Werner wrote:
> Hi Devs!

Hi Axel :-)


> i recently found a problem in DaviCal 0.9.9.4 on Debian Lenny when i try
> to add my first user(principal) to a all new fresh database. Then
> DaviCal throws out a SQL Error on its Webinterface (details later).
>
> I searched Internet already and asked IRC for that, but no luck yet. i
> also did not found any bugreporting tool somewhere.
>
> So i guess the DEV Mailing list should be a good start to report in.
>
> The Problem is ALWAYS reproducable. The Error-Message thrown is always
> the same. However the Results within the database seems to be not always
> the same. Here is what ive done:
>
>
> 1. installed fresh debian lenny, followed all the instructions on the
> Davical website for a debian installation.
>
> 2. where it comes to the point to creat the davical database by entering
> "su postgres -c /usr/share/davical/dba/create-database.sh" it works fine
> and i retrieve my admins password.
>
> 3. i then log in to the webinterface as "admin" using that password.
> Anything looks fine yet.
>
> 4. trying to add my first principal(user) to the database using the
> webinterface: i enter a username like "testuser1", password "1234",
> Displayname "testuser1" , entering some email Adress, defining some
> permissions to "All Users" (BTW: the ALL button is NOT WORKING AT ALL!
> Any other preset-Button seems to work as expected). So i klick on
> READ/WRITE and add view more permissions as i want them. Then i click on
> CREATE and receive the following Error Screen in some BROWN block near
> top of the screen:
>
> * ERROR: SQL error "23505" - ERROR: duplicate key value violates
> unique constraint "principal_pkey""
> * Home calendar added.
>
> The User HAS NOT BEEN CREATED! Nothing will be displayed in "list users"
> , "list groups", "list resources".
>
> 5. i now repeat the same thing at 4. and this time IT WILL WORK. But as
> you can see within the database itself, it somehow "skipped" an user-id
> in some tables.

OK. Looks like the sequence is not being assigned an appropriate first
value at the end of the database create.

I guess nobody's reported this before, since the second attempt "just
works" and all of my regression tests create a bunch of users, so I
almost never actually see an empty database myself :-)


> Also i once had a case where in some tables it created some strange
> "half baked entry" with no username in it, but registered an ID and
> password. realy strange!

It shouldn't be possible to create an entry with no username, but it
might be possible to create one with a silly username like a
non-breaking space or something.

If you can figure out what you did in a repeatable manner I can try and
do some extra validation.


> btw: this is my config file atm:
>
> <?php
> $c->admin_email = 'mail at awerner.homeip.net';
> $c->system_name = "10.230.20.80 - TEST AW DAViCal CalDAV Server";
> $c->enable_row_linking = true;
> $c->default_locale = de_DE.UTF-8;
> $c->pg_connect[] = 'dbname=davical user=davical_app';

Looks fine.


> So again in short: this may be TWO SEPERATE BUGS. The Problem with the
> ALL Button at Permissions, and the Problem adding the first user to the
> database.

Yes, definitely. I had noticed the permissions javascript issue
already.

Cheers,
Andrew.
--
------------------------------------------------------------------------
andrew (AT) morphoss (DOT) com +64(272)DEBIAN
If not completely satisfied, return for full refund of purchase price.
------------------------------------------------------------------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.davical.org/pipermail/davical-dev/attachments/20110201/41214be0/attachment.pgp>
BUG: SQL Error on adding first User to Davical 0.9.9.4 [ In reply to ]
Hi,

I'm pretty sure that I didn't had any SQL errors on my first attempts. As a couple of months already has passed since, I won't say this to a judge. ;-)

Cheers
Matthias
BUG: SQL Error on adding first User to Davical 0.9.9.4 [ In reply to ]
Hi Devs !

Concerning this BUG i now to have additional Stuff to report in.

Still using the same davical config file, while the davical database is
still "virgin", watching the Apache Error Logs i discovered this error
message if i just visit the "creat principal" webinterface page.


[Thu Feb 03 13:13:27 2011] [error] [client 10.230.50.182] davical: ***:
ERROR:Cannot convert privilege of "" into bits., referer:
http://10.230.20.80/admin.php?action=edit&t=principal&id=1

best regard
Axel
BUG: SQL Error on adding first User to Davical 0.9.9.4 [ In reply to ]
> Hi Devs !
>
> Concerning this BUG i now to have additional Stuff to report in.

on trying to add my first user (principal) to the "virgin davical db"
ill receive the following error messages within the apache log:

[Thu Feb 03 14:01:37 2011] [error] [client 10.230.50.182] davical: LOG:
Editor::Write: Query: QF: SQL error "23505" - ERROR: duplicate key value
violates unique constraint "principal_pkey"", referer:
http://10.230.20.80/admin.php?action=edit&t=principal
[Thu Feb 03 14:01:37 2011] [error] [client 10.230.50.182] davical: LOG:
Editor::Write: Query: QF: INSERT INTO dav_principal (user_active,
username, password, fullname, email, date_format_type, locale, type_id,
displayname, default_privileges) VALUES( TRUE, 'user10',
'*uxoS5dnNL*{SSHA}FrLp8ZM+Te04dwsctKAEpnxYzRt1eG9TNWRuTkw=', 'user10', ,
referer: http://10.230.20.80/admin.php?action=edit&t=principal
[Thu Feb 03 14:01:37 2011] [error] [client 10.230.50.182] davical: LOG:
Editor::Write: Query: QF: 'user10 at dom.ain', 'E', '', 1, 'user10',
'000000001111111011111111' ); , referer:
http://10.230.20.80/admin.php?action=edit&t=principal
[Thu Feb 03 14:01:37 2011] [error] [client 10.230.50.182] davical: ***:
ERROR:Cannot convert privilege of "" into bits., referer:
http://10.230.20.80/admin.php?action=edit&t=principal

> best regard
> Axel
BUG: SQL Error on adding first User to Davical 0.9.9.4 [ In reply to ]
I may have some additional information regarding this issue.

After running into the exact same issue, I've noticed creating users
after the first failed one it all worked fine. Looking at my principal
table, I noticed the following. Firstly, principal id's are uneven. All
even id's are gone? Also, the admin is user_no 1, 1001 appearantly
failed and then numbering does continue properly. On a 0.9.9.2 or
0.9.9.3 install my principal_id jumped from 2 to 18, with user_no's
being 1001 and 1002 respectivily. I don't know wether these
principal_id's are semi random ... anyway, just providing some extra
insight.



davical=> select * from principal;
principal_id | type_id | user_no | displayname |
default_privileges
--------------+---------+---------+---------------------------+--------------------------
1 | 1 | 1 | DAViCal Administrator |
000000000000000000000000
3 | 1 | 1002 | xxxx |
000000000000000000000000
5 | 1 | 1003 | xxxx | 000000000000000000000000
7 | 2 | 1004 | xxxx | 000000000000000000000000
9 | 2 | 1005 | xxxx | 000000000000000000000000
11 | 2 | 1006 | xxxx | 000000000001001000100001
(6 rows)


On 02/09/11 09:48, davical-dev-request at lists.davical.org wrote:
> Welcome to the DAViCal-dev at lists.davical.org mailing list!
>
> To post to this list, send your email to:
>
> davical-dev at lists.davical.org
>
> General information about the mailing list is at:
>
> http://lists.davical.org/listinfo/davical-dev
>
> If you ever want to unsubscribe or change your options (eg, switch to
> or from digest mode, change your password, etc.), visit your
> subscription page at:
>
> http://lists.davical.org/options/davical-dev/oliver%40schinagl.nl
>
> You can also make such adjustments via email by sending a message to:
>
> DAViCal-dev-request at lists.davical.org
>
> with the word `help' in the subject or body (don't include the
> quotes), and you will get back a message with instructions.
>
> You must know your password to change your options (including changing
> the password, itself) or to unsubscribe. It is:
>
> icaldav
>
> Normally, Mailman will remind you of your lists.davical.org mailing
> list passwords once every month, although you can disable this if you
> prefer. This reminder will also include instructions on how to
> unsubscribe or change your account options. There is also a button on
> your options page that will email your current password to you.
BUG: SQL Error on adding first User to Davical 0.9.9.4 [ In reply to ]
On Wed, 2011-02-09 at 10:10 +0100, Oliver Schinagl wrote:
> I may have some additional information regarding this issue.
>
> After running into the exact same issue, I've noticed creating users
> after the first failed one it all worked fine. Looking at my principal
> table, I noticed the following. Firstly, principal id's are uneven. All
> even id's are gone? Also, the admin is user_no 1, 1001 appearantly
> failed and then numbering does continue properly. On a 0.9.9.2 or
> 0.9.9.3 install my principal_id jumped from 2 to 18, with user_no's
> being 1001 and 1002 respectivily. I don't know wether these
> principal_id's are semi random ... anyway, just providing some extra
> insight.

Hi Oliver,

The IDs for principals, resources & collections all come from the same
PostgreSQL sequence, so there will always be gaps when you look at just
one of those things.

When the create-database script is run the administrator is created
arbitrarily with id 1, and then the sequence is reset to 1000.

I think what might be happening is that the sequence is reset, but it's
set in such a way that the first call fails. I don't think it's a big
deal.

The SQL error when the principal page is displayed on creating a new
principal is just cosmetic, and I'm pretty sure it is unrelated.

Cheers,
Andrew.
--
------------------------------------------------------------------------
andrew (AT) morphoss (DOT) com +64(272)DEBIAN
You never get a second chance to make a first impression.
------------------------------------------------------------------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.davical.org/pipermail/davical-dev/attachments/20110210/4b77f67b/attachment.pgp>