Hello, supervision list!

I am Debian maintainer of 'runit' package, and I ask for help with
issue, described at 'https://bugs.debian.org/916230'.

There is piece of code in svlogd.c, that causes strage behaviour, but it
looks it was introduced on puprose. If you know, could you please
explain this purpose to me?

[2018-12-19 09:21] Gerrit Pape <p...@dbnbgs.smarden.org>
> I'm sorry, can't give you any input, I'm busy with different things
> these days.  But there're people around knowing the runit programs and
> code, you can try to contact them through the mailing list
> <supervis...@list.skarnet.org> .

Thank you for hint.

> On Mon, Dec 17, 2018 at 02:54:43PM +0000, Dmitry Bogatov wrote:
> > 
> > [2018-12-12 19:39] Dmitry Bogatov <kact...@debian.org>
> > > I managed to reproduce bug. Seems that .u file appears when svlogd is
> > > restarted and there is some .s files, but not always. I plan to debug
> > > it this weekend.
> > > 
> > > Thank you for report. If you have some ideas, how to reproduce bug
> > > more reliable, it would be great!
> > 
> > Offending .u file is created by rename(2) call at line 532, in
> > logdir_open() function. It happens, when 'current' file exists,
> > non-executable and non-empty.
> > 
> > Well, this is quite normal state of affairs. When `svlogd' is running,
> > `current' file is getting appended, when its size reaches `ld->sizemax'
> > (or something like this), it gets renames to @timestamp, and new
> > `current' is created.
> > 
> > So, if I interrupt `svlogd' at any time, but just after rotation, I
> > will get this leftover .u file. I am not perfectly sure, but seems that
> > `struct logdir` has `size' field, that means current size of log file.
> > 
> > I believe following patch would solve current issue. But wouldn't
> > it cause another problems? There must be reason, why this logic was
> > implemented. Gerrit, some input, please?
> > 
> > diff --git a/runit-2.1.2/src/svlogd.c b/runit-2.1.2/src/svlogd.c
> > index fab8441..3f8ead4 100644
> > --- a/runit-2.1.2/src/svlogd.c
> > +++ b/runit-2.1.2/src/svlogd.c
> > @@ -521,20 +521,7 @@ unsigned int logdir_open(struct logdir *ld, const char 
> > *fn) {
> >  
> >    /* open current */
> >    if ((i =stat("current", &st)) != -1) {
> > -    if (st.st_size && ! (st.st_mode & S_IXUSR)) {
> > -      ld->fnsave[25] ='.'; ld->fnsave[26] ='u'; ld->fnsave[27] =0;
> > -      do {
> > -        taia_now(&now);
> > -        fmt_taia(ld->fnsave, &now);
> > -        errno =0;
> > -      } while ((stat(ld->fnsave, &st) != -1) || (errno != error_noent));
> > -      while (rename("current", ld->fnsave) == -1)
> > -        pause2("unable to rename current", ld->name);
> > -      rmoldest(ld);
> > -      i =-1;
> > -    }
> > -    else
> > -      ld->size =st.st_size;
> > +    ld->size =st.st_size;
> >    }
> >    else
> >      if (errno != error_noent) {
> 

Reply via email to