[Mailman-Users] permission problem saving attachments to archives

Mark Sapiro msapiro at value.net
Fri Mar 31 01:49:14 CEST 2006

kristina clair wrote:

>On 3/29/06, Mark Sapiro <msapiro at value.net> wrote:
>> This is puzzling. Something is not right about this. Possibly the full
>> traceback will contradict me, but I think that Scrubber is in it's
>> save_attachment() function and is trying to lock the attachment
>> directory
>> (/home/mailman/archives/private/membership/attachments/20060301/cf7df1b6/
>> in this case) in order to keep other processes out while it computes a
>> unique file name to save the attachment. It is the lock.lock() call in
>> Scrubber that trys to create
>> /home/mailman/archives/private/membership/attachments/20060301/cf7df1b6/a=

And the traceback confirms that the above is the actual scenario.

>> However, well before this, Scrubber has called its makedirs() function
>> to create as necessary all the directories in
>> /home/mailman/archives/private/membership/attachments/20060301/cf7df1b6/,
>> and this apparently succeeded yet the directories 20060301/ and
>> 20060301/cf7df1b6/ (and even the attachments/ directory initially)
>> don't exist.
>> Do these directories exist somewhere else?
>I did a find for cf7df1b6 and didn't find it anywhere.

How about 20060301? Although if you didn't find the other, you probably
won't find this either.

>Here is the full traceback from the error log:
>  File "/home/mailman/Mailman/Handlers/Scrubber.py", line 227, in process
>    url = save_attachment(mlist, part, dir, filter_html=False)

So here save_attachment() is called, and the first two lines thereof are

    fsdir = os.path.join(mlist.archive_dir(), dir)

where in this case, fsdir computes to be
and makedirs() calls the Python library os.makedirs() to create any
missing directories in the path with permissions 02775. The only
exception from this that is passed is 'directory exists'.

So somehow - don't ask me how - we get past this without having created
the directories.

>  File "/home/mailman/Mailman/Handlers/Scrubber.py", line 374, in save_attachment
>    lock.lock()
>  File "/home/mailman/Mailman/LockFile.py", line 243, in lock
>    self.__write()
>  File "/home/mailman/Mailman/LockFile.py", line 422, in __write
>    fp = open(self.__tmpfname, 'w')
>IOError: [Errno 13] Permission denied: '/home/mailman/archives/private/membership/attachments/20060301/cf7df1b6/attachments.lock.sparks.serve.com.23421.369'

Then we get this error when we try to create the lock file in the
non-existent directory. I'd expect the error to be 'No such file or
directory' rather than 'Permission denied'. Maybe that's another clue,
but if so, I don't know how to use it.

What happens if you try the following:

su mailman
>>> import os
>>> os.umask(002)
>>> os.makedirs('/home/mailman/archives/private/membership/attachments/20060301/cf7df1b6', 02775)
>>> open('/home/mailman/archives/private/membership/attachments/20060301/cf7df1b6/xxx', 'w')

os.makedirs( ... 2775) is all one line as is
open( ... 'w')

Does this throw any exception? Does it create the missing directories?
(note, type control-D in response to a >>> prompt to exit Python)

Mark Sapiro <msapiro at value.net>       The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

More information about the Mailman-Users mailing list