Re: [Exim] can't get "create_directory" to work

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Philip Hazel
Datum:  
To: Jeremy C. Reed
CC: exim-users
Betreff: Re: [Exim] can't get "create_directory" to work
On Mon, 4 Oct 1999, Jeremy C. Reed wrote:

> Here is my debugging output (JUST the "Local deliveries" section)
> (the folder /var/spool/virtual/poptest.reedmedia.net does NOT exist,
> but when it does exist, it works)


That debugging output looks exactly as if you haven't got
create_directory set at all. Mysterious. Can you check the setting with

exim -bP transport virtual_localdelivery

to ensure it really is there? It looks as if code hacking is needed.
Around line 1083 in the file src/transports/appendfile.c there are the
lines

  /* If ob->create_directory is set, attempt to create the directories in      
  which this mailbox lives. We know we are dealing with an absolute path,  
  because this has been checked above. */                                 


  if (ob->create_directory)                                            
    {                                                                    
    char *p = strrchr(path, '/');                                
    *p = '\0';                                             
    if (directory_make("/", path, ob->dirmode, FALSE) < 0)               
      {                                                                  
      addr->basic_errno = errno;                   
      addr->message =                                                         
        string_sprintf("failed to create directories for %s: %s", path,
          strerror(errno));                             
      DEBUG(9) debug_printf("%s transport: %s\n", tblock->name, path);
      return;                                                                 
      }                                                         
    *p = '/';                                                                   
    }                            


Before those lines you could insert

DEBUG(9) debug_printf("ob->create_directory=%d\n", ob->create_directory);

and check that it has the value 1. It might also be worth putting in
something just before the *p = '/'; line just to check that it is
getting there.

The actual directory building is done in a function whose code is in
directory.c ... ... Aarrgghh! I've just spotted a bug in the code while
checking that. It returns FALSE if making the directory fails, but the
code in appendfile is checking for a negative return.

OK. The problem is that making the directory is failing for some reason,
but that isn't being reported correctly. Please change the line in
appendfile (part of the block shown above) that reads

    if (directory_make("/", path, ob->dirmode, FALSE) < 0)               


to

    if (!directory_make("/", path, ob->dirmode, FALSE))               


It should then report the error it is getting, and we should be a bit
further along the road to figuring out what is going on.

Sorry about that. That is *very* old code, so you have just helped to
kill a bug of great longevity.

Regards,
Philip

-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.