[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Demexp-dev] Problem with preference saving ?
From: |
David MENTRE |
Subject: |
Re: [Demexp-dev] Problem with preference saving ? |
Date: |
Wed, 28 Sep 2005 09:29:01 +0200 |
Hello Thomas,
2005/9/28, Thomas Petazzoni <address@hidden>:
> Ok, I *think* I've found the bug. (Line numbers refers to 0.6.2).
>
> In srv/participants.ml.nw, the function which is in charge of creating
> the default root login (with the demexp password) is
> initialize_default_participant_base. After a quick grep inside
> srv/*.ml.nw, I found two places where this function is called:
> - inside the participants autotest
> - in src/demexp-server.ml.nw
>
> In srv/demexp-server.ml.nw, line 290, we can read:
>
> if !flag_autotests then (
> log "server: use default participant base";
> Participants.initialize_default_participant_base ()
> ) else
> log "server: use bases '%s'" !flag_bases_name;
> start_server ()
>
> If I correctly read OCaml, it means that
> initialize_default_participant_base() is called *only* in the case of
> autotests. Otherwise, start_server() is called, will try to load a
> bases.dmxp file, won't find it... and will run the server with not
> default root login.
>
> Is that right ?
I think you have spoted the bug quite well.
> Anyway, the enclosed patch fixes it. It simply calls the
> initialize_default_participant_base() when the base loading fails.
At first sight, your patch is wrong. The
initialize_default_participant_base() is always called, because the
else includes only the log function call.
> (The !flag_autotests notation is quite strange for the C programmer,
> which may think that it's the same as if flag_autotests == FALSE. In
> fact, after a quick read inside Weis and Leroy book, I've
> (re)-discovered that it's like the '*' in C, a dereference operator. Funny).
Yes. Even after years of using OCaml, I easily read this construct as
negation. :(
> --- demexp-0.6.2/srv/io.ml.nw 2005-09-28 00:36:50.000000000 +0200
> +++ demexp-0.6.2-new/srv/io.ml.nw 2005-09-28 00:37:02.000000000 +0200
> @@ -103,5 +103,6 @@
> log " done."
> ) else
> log " File \"%s\" does not exists. Don't load bases." filename;
> + Participants.initialize_default_participant_base () ;
> flush_all ()
> @
I would write it:
) else (
log " File \"%s\" does not exists. Don't load bases." filename;
Participants.initialize_default_participant_base ()
) ;
flush_all ()
I just looked at your patch an not the original source code, so do not
take my words for an absolute answer. ;)
It's been a long time since I looked at that code, so I need to dive
into it to fix it properly.
Sorry for the stupid bug,
Yours,
d.
- [Demexp-dev] Problem with preference saving ?, Thomas Petazzoni, 2005/09/25
- Re: [Demexp-dev] Problem with preference saving ?, David MENTRE, 2005/09/26
- Re: [Demexp-dev] Problem with preference saving ?, Thomas Petazzoni, 2005/09/26
- Re: [Demexp-dev] Problem with preference saving ?, David MENTRE, 2005/09/26
- Re: [Demexp-dev] Problem with preference saving ?, Thomas Petazzoni, 2005/09/27
- Re: [Demexp-dev] Problem with preference saving ?, David MENTRE, 2005/09/27
- Re: [Demexp-dev] Problem with preference saving ?, Thomas Petazzoni, 2005/09/27
- Re: [Demexp-dev] Problem with preference saving ?, Thomas Petazzoni, 2005/09/27
- Re: [Demexp-dev] Problem with preference saving ?, Thomas Petazzoni, 2005/09/27
- Re: [Demexp-dev] Problem with preference saving ?,
David MENTRE <=
- Re: [Demexp-dev] Problem with preference saving ?, Thomas Petazzoni, 2005/09/28