Hi again, A couple more patches:
>> First I guest we need NOT here (?) > > Doh! acsieve-sievedir.patch corrects this (though it sounds like you've already made this change yourself -- included for completion though) >> Oct 7 16:54:10 imapsync cyrus/imap[4062]: autocreate_sieve: >> Unable to create /var/spool/sieve/r/root/default.script.bc.NEW. Unknown error This wouldn't be an "unknown error" if it would bother to tell us what the error was.... acsieve-syslog.patch fixes this, so the actual error will be logged. It also fixes a bunch of similar syslog calls through this function that were doing the same unhelpful thing (i.e. logging an error without including the error message). I haven't had a chance to put together a test case for this yet, sorry. In the meantime hopefully the improved error messages will help us track this down. Thanks for sending through these reports! :) Cheers, ellie On Fri, Oct 9, 2015, at 08:41 AM, ellie timoney wrote: >> First I guest we need NOT here (?) > > Doh! > >> And second creating are failing with follow logs (yes I use 'root' >> user for testing) >> >> Oct 7 16:54:10 imapsync cyrus/imap[4062]: User root, Inbox >> subfolders, created 4, subscribed 4 Oct 7 16:54:10 imapsync >> cyrus/imap[4062]: autocreate_sieve: Unable to create >> /var/spool/sieve/r/root/default.script.bc.NEW. Unknown error Oct 7 >> 16:54:10 imapsync cyrus/imap[4062]: autocreate_sieve: User root, >> default sieve script creation failed No one files/folders are >> creating. >> > > That path looks okay, at least. I expected more problems to shake out > when the paths were fixed, so I'll look into this some more. > > - ellie > > On Thu, Oct 8, 2015, at 01:04 AM, Artyom Aleksandrov wrote: >> Hi, thank you for patch. But it does not work. (( First I guest we >> need NOT here (?) >> >> @@ -139,7 +138,7 @@ static int autocreate_sieve(const char *userid, >> const char *source_script) } >> >> /* Check if sievedir is defined in imapd.conf */ - if(!(sieve_dir >> = config_getstring(IMAPOPT_SIEVEDIR))) { + >> if(config_getstring(IMAPOPT_SIEVEDIR)) { And second creating are >> failing with follow logs (yes I use 'root' user for testing) >> >> Oct 7 16:54:10 imapsync cyrus/imap[4062]: User root, Inbox >> subfolders, created 4, subscribed 4 Oct 7 16:54:10 imapsync >> cyrus/imap[4062]: autocreate_sieve: Unable to create >> /var/spool/sieve/r/root/default.script.bc.NEW. Unknown error Oct 7 >> 16:54:10 imapsync cyrus/imap[4062]: autocreate_sieve: User root, >> default sieve script creation failed No one files/folders are >> creating. >> >> On Tue, Oct 6, 2015 at 3:51 AM, ellie timoney >> <el...@fastmail.com> wrote: >>> __ >>> Hi Artyom, >>> >>> Yeah wow, this is really gross. >>> >>> I'm pretty sure the gibberish in those "??????Default.script.bc" >>> filenames is just whatever junk was in the (uninitialised) >>> sieve_script_dir variable. >>> >>> I've had a rummage around, and there's a user_sieve_path() function >>> in imap/user.c that does the heavy lifting of finding a user's sieve >>> script directory. Looks like sieve_script_dir wanted to be the >>> result of that. Your fix is on the right track. :) >>> >>> I've attached a patch for 2.5.x that fixes these paths using >>> user_sieve_path(). It also fixes the assumption that the sievedir >>> value will end in a "/", which it doesn't by default, and shouldn't >>> need to. Can you try it out and see how it goes? (The patch should >>> apply cleanly on any version of 2.5, this file has barely changed >>> since it was created.) >>> >>> The rest of the autocreate_sieve() function is pretty awful too -- >>> there's almost certainly more bugs in there, and fixing the paths >>> might just shake them out. I'd like to tidy this up significantly >>> (and make some test cases for it), but in the meantime hopefully >>> this will get you moving forward. >>> >>> Cheers, >>> >>> >>> ellie >>> >>> >>> On Tue, Oct 6, 2015, at 12:56 AM, Artyom Aleksandrov wrote: >>>> Guys I don't understand hot it can work. >>>> >>>> I added additional logging and found that sieve_script_dir is not >>>> defined. After adding this definition the problem gone. >>>> >>>> >>>> 147 /* Check if autocreate_sieve_compiledscript is defined in >>>> imapd.conf */ 148 if(!(compiled_source_script = >>>> config_getstring(IMAPOPT_AUTOCREATE_SIEVE_SCRIPT_COMPILED))) { 149 >>>> syslog(LOG_WARNING, "autocreate_sieve: >>>> autocreate_sieve_compiledscript option is not defined. Compiling >>>> it"); 150 do_compile = 1; 151 } 152 153 char >>>> userletter[1]; 154 userletter[0]=userid[0]; 155 >>>> snprintf(sieve_script_dir, MAX_FILENAME, >>>> "%s%s/%s/",sieve_dir,userletter,userid); >>>> >>>> >>>> >>>> On Thu, Oct 1, 2015 at 8:49 PM, Artyom Aleksandrov >>>> <mailing.l...@tem4uk.ru> wrote: >>>>> Is it works? Which version do you use? Could you guest the reason >>>>> of the problem? How I can troubleshoot it? >>>>> >>>>> :/var/lib/cyrus# ls -la >>>>> total 2176 -rw------- 1 cyrus mail 124 Sep 25 16:04 >>>>> ??????Default.script.bc -rw------- 1 cyrus mail 231 Sep 25 >>>>> 16:04 ??????Default.script.script lrwxrwxrwx 1 cyrus mail 17 >>>>> Sep 25 16:04 ??????defaultbc -> Default.script.bc -rw------- 1 >>>>> cyrus mail 124 Jul 2 12:38 ??N???Default.script.bc -rw------- >>>>> 1 cyrus mail 231 Jul 2 12:38 ??N???Default.script.script >>>>> lrwxrwxrwx 1 cyrus mail 17 Jul 2 12:38 ??N???defaultbc -> >>>>> Default.script.bc -rw------- 1 cyrus mail 124 Sep 22 15:10 >>>>> 0#?>??Default.script.bc -rw------- 1 cyrus mail 231 Sep 22 >>>>> 15:10 0#?>??Default.script.script lrwxrwxrwx 1 cyrus mail 17 >>>>> Sep 22 15:10 0#?>??defaultbc -> Default.script.bc >>>>> >>>>> >>>>> On Thu, Oct 1, 2015 at 7:55 PM, Alvin Starr <al...@netvel.net> >>>>> wrote: >>>>>> I use autocreate. >>>>>> >>>>>> So there is at least one. >>>>>> >>>>>> >>>>>> On 10/01/2015 12:18 PM, Artyom Aleksandrov wrote: >>>>>>> Does anybody use autocreate_sieve? >>>>>>> >>>>>>> On Sat, Sep 26, 2015 at 1:30 AM, Artyom Aleksandrov <mailing.l...@tem4uk.ru> wrote: >>>>>>>> >>>>>>>> Hello,I want to create default sieve scipt for all my users but I stuck with strange problem that looks like the bug. Unfortunately I've never wrote on C so it's difficult for me to find it. >>>>>>>> When Cyrus (2.5.3 or 2.5.6) create default sieve script it doesn't put file in sieve_dir/?/user folder. It jist creates tmp files in configdirectory with names like this >>>>>>>> -rw------- 1 cyrus mail 124 Sep 26 00:41 ?&?P??default.script.bc >>>>>>>> -rw------- 1 cyrus mail 231 Sep 26 00:41 ?&?P??default.script.script >>>>>>>> lrwxrwxrwx 1 cyrus mail 17 Sep 26 00:41 ?&?P??defaultbc -> default.script.bc >>>>>>>> >>>>>>>> There are not checks in this stage so my syslog is clean of error. >>>>>>>> Everything seems fine. Sep 26 00:41:34 imapsync cyrus/imap[26117]: autocreate_sieve: Problem opening compiled script file: default.script.bc. Compiling it >>>>>>>> Sep 26 00:41:34 imapsync cyrus/imap[26117]: autocreate_sieve: Compiled sieve script was successfully saved in default.script.bc >>>>>>>> Sep 26 00:41:34 imapsync cyrus/imap[26117]: autocreate_sieve: User XXXX, default sieve script creation succeeded >>>>>>>> >>>>>>>> My setting: autocreate_sieve_script: /var/spool/sieve/global/default.script >>>>>>>> autocreate_sieve_script_compile: yes >>>>>>>> autocreate_sieve_script_compiled: default.script.bc >>>>>>>> sievedir: /var/spool/sieve/ >>>>>>>> Distributive: Ubuntu 14.04.3 >>>>>>>> >>>>>>>> >>>>>>>> I'll be glad for any help. ) >>>>>>>> >>>>>>>> Best regards, Artyom >>>>>>> >>>>>>> >>>>>>> >>>>>>> ---- Cyrus Home Page: http://www.cyrusimap.org/ List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/ To Unsubscribe: >>>>>>> https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus >>>>>>> >>>>>> >>>>>> -- Alvin Starr || voice: (905)513-7688[1] Netvel Inc. || Cell: (416)806-0133[2] al...@netvel.net || >>>>>> >>>>>> >>>>>> >>>>>> ---- >>>>>> Cyrus Home Page: http://www.cyrusimap.org/ List Archives/Info: >>>>>> http://lists.andrew.cmu.edu/pipermail/info-cyrus/ To Unsubscribe: >>>>>> https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus >>>> ---- >>>> Cyrus Home Page: http://www.cyrusimap.org/ List Archives/Info: >>>> http://lists.andrew.cmu.edu/pipermail/info-cyrus/ To Unsubscribe: >>>> https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus >>> >>> >>> ---- >>> Cyrus Home Page: http://www.cyrusimap.org/ List Archives/Info: >>> http://lists.andrew.cmu.edu/pipermail/info-cyrus/ To Unsubscribe: >>> https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus > > ---- > Cyrus Home Page: http://www.cyrusimap.org/ List Archives/Info: > http://lists.andrew.cmu.edu/pipermail/info-cyrus/ To Unsubscribe: > https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus Links: 1. tel:%28905%29513-7688 2. tel:%28416%29806-0133
diff --git a/imap/autocreate.c b/imap/autocreate.c index 2ffa95f..33c6b71 100644 --- a/imap/autocreate.c +++ b/imap/autocreate.c @@ -138,7 +138,7 @@ static int autocreate_sieve(const char *userid, const char *source_script) } /* Check if sievedir is defined in imapd.conf */ - if(config_getstring(IMAPOPT_SIEVEDIR)) { + if(!config_getstring(IMAPOPT_SIEVEDIR)) { syslog(LOG_WARNING, "autocreate_sieve: sievedir option is not defined. Check imapd.conf"); return 1; }
diff --git a/imap/autocreate.c b/imap/autocreate.c index 33c6b71..765eb7a 100644 --- a/imap/autocreate.c +++ b/imap/autocreate.c @@ -220,7 +220,7 @@ static int autocreate_sieve(const char *userid, const char *source_script) fclose(in_stream); return 1; } else { - syslog(LOG_WARNING,"autocreate_sieve: Unable to create %s. Unknown error",sieve_bctmpname); + syslog(LOG_WARNING,"autocreate_sieve: Unable to create %s: %m",sieve_bctmpname); fclose(in_stream); return 1; } @@ -229,7 +229,7 @@ static int autocreate_sieve(const char *userid, const char *source_script) if(!do_compile && compiled_source_script && (in_fd = open(compiled_source_script, O_RDONLY)) != -1) { while((r = read(in_fd, buf, sizeof(buf))) > 0) { if((k=write(out_fd, buf,r)) < 0) { - syslog(LOG_WARNING, "autocreate_sieve: Error writing to file: %s, error: %d", sieve_bctmpname, errno); + syslog(LOG_WARNING, "autocreate_sieve: Error writing to file %s: %m", sieve_bctmpname); close(out_fd); close(in_fd); fclose(in_stream); @@ -242,12 +242,12 @@ static int autocreate_sieve(const char *userid, const char *source_script) xclose(out_fd); xclose(in_fd); } else if (r < 0) { - syslog(LOG_WARNING, "autocreate_sieve: Error reading compiled script file: %s. Will try to compile it", + syslog(LOG_WARNING, "autocreate_sieve: Error reading compiled script file %s: %m. Will try to compile it", compiled_source_script); xclose(in_fd); do_compile = 1; if(lseek(out_fd, 0, SEEK_SET)) { - syslog(LOG_WARNING, "autocreate_sieve: Major IO problem. Aborting"); + syslog(LOG_WARNING, "autocreate_sieve: Major IO problem (lseek: %m). Aborting"); xclose(out_fd); return 1; } @@ -308,7 +308,7 @@ static int autocreate_sieve(const char *userid, const char *source_script) /* Copy the initial script */ oldmask = umask(077); if((out_fp = fopen(sieve_tmpname, "w")) == NULL) { - syslog(LOG_WARNING,"autocreate_sieve: Unable to open %s destination sieve script", sieve_tmpname); + syslog(LOG_WARNING,"autocreate_sieve: Unable to open destination sieve script %s: %m", sieve_tmpname); unlink(sieve_bctmpname); umask(oldmask); fclose(in_stream); @@ -318,7 +318,7 @@ static int autocreate_sieve(const char *userid, const char *source_script) while((r = fread(buf,sizeof(char), sizeof(buf), in_stream)) > 0) { if( fwrite(buf,sizeof(char), r, out_fp) != (unsigned)r) { - syslog(LOG_WARNING,"autocreate_sieve: Problem writing to sieve script file: %s",sieve_tmpname); + syslog(LOG_WARNING,"autocreate_sieve: Problem writing to sieve script file %s: %m",sieve_tmpname); fclose(out_fp); unlink(sieve_tmpname); unlink(sieve_bctmpname); @@ -354,7 +354,7 @@ static int autocreate_sieve(const char *userid, const char *source_script) /* end now with the symlink */ if(symlink(sieve_bclink_name, sieve_default)) { if(errno != EEXIST) { - syslog(LOG_WARNING, "autocreate_sieve: problem making the default link."); + syslog(LOG_WARNING, "autocreate_sieve: problem making the default link (symlink: %m)."); /* Lets delete the files */ unlink(sieve_script_name); unlink(sieve_bcscript_name); @@ -394,7 +394,7 @@ static int autocreate_sieve(const char *userid, const char *source_script) close(in_fd); return 0; } else { - syslog(LOG_WARNING,"autocreate_sieve: Unable to create %s",sieve_tmpname); + syslog(LOG_WARNING,"autocreate_sieve: Unable to create %s: %m",sieve_tmpname); close(in_fd); return 0; } @@ -402,7 +402,7 @@ static int autocreate_sieve(const char *userid, const char *source_script) while((r = read(in_fd, buf, sizeof(buf))) > 0) { if((k = write(out_fd,buf,r)) < 0) { - syslog(LOG_WARNING, "autocreate_sieve: Error writing to file: %s, error: %d", sieve_tmpname, errno); + syslog(LOG_WARNING, "autocreate_sieve: Error writing to file: %s: %m", sieve_tmpname); close(out_fd); close(in_fd); unlink(sieve_tmpname); @@ -414,7 +414,7 @@ static int autocreate_sieve(const char *userid, const char *source_script) xclose(out_fd); xclose(in_fd); } else if (r < 0) { - syslog(LOG_WARNING, "autocreate_sieve: Error writing to file: %s, error: %d", sieve_tmpname, errno); + syslog(LOG_WARNING, "autocreate_sieve: Error reading file: %s: %m", sieve_bcscript_name); xclose(out_fd); xclose(in_fd); unlink(sieve_tmpname);
---- Cyrus Home Page: http://www.cyrusimap.org/ List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/ To Unsubscribe: https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus