Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 53533 - Mailman check_perm fails because of .keep file
Summary: Mailman check_perm fails because of .keep file
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: x86 Linux
: High normal
Assignee: Net-Mail Packages
URL:
Whiteboard:
Keywords:
: 56250 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-06-10 08:30 UTC by Jim Ramsay (lack) (RETIRED)
Modified: 2004-08-05 09:25 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to 'check_perm' script to make it ignore '.keep' files (mailman-2.1.5-gentoo-check_perm.patch,1.76 KB, patch)
2004-06-28 12:00 UTC, Jim Ramsay (lack) (RETIRED)
Details | Diff
mailman-2.1.5-directory-check.patch (mailman-2.1.5-directory-check.patch,606 bytes, patch)
2004-07-21 10:22 UTC, Brian Harring (RETIRED)
Details | Diff
mailman-2.1.5-directory-check.patch (mailman-2.1.5-directory-check.patch,641 bytes, patch)
2004-07-21 15:29 UTC, Brian Harring (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jim Ramsay (lack) (RETIRED) gentoo-dev 2004-06-10 08:30:41 UTC
Emerge of Mailman 2.1.5 fails when running check_perm.  Also, instructions urge user to run check_perm as either root or mailman user.  In either case, the script fails with this python stacktrace:

Traceback (most recent call last):
  File "bin/check_perms.orig", line 367, in ?
    checkdata()
  File "bin/check_perms.orig", line 321, in checkdata
    mode = statmode(path)
  File "bin/check_perms.orig", line 81, in statmode
    return os.stat(path)[ST_MODE]
OSError: [Errno 20] Not a directory: '/usr/local/mailman/lists/.keep/config.pck'

Reproducible: Always
Steps to Reproduce:
1. Run bin/check_perms in /usr/local/mailman
Actual Results:  
Script failed and said:

Traceback (most recent call last):
  File "bin/check_perms.orig", line 367, in ?
    checkdata()
  File "bin/check_perms.orig", line 321, in checkdata
    mode = statmode(path)
  File "bin/check_perms.orig", line 81, in statmode
    return os.stat(path)[ST_MODE]
OSError: [Errno 20] Not a directory: '/usr/local/mailman/lists/.keep/config.pck'

Expected Results:  
Checked permissions and completed successfully

This is because some directories have a .keep file added by the ebuild system in
some directories that this script is not expecting.  The following patch seems
to fix it:

--- check_perms.orig    2004-06-10 09:26:22.717024396 -0600
+++ check_perms 2004-06-09 16:27:49.000000000 -0600
@@ -313,23 +313,24 @@
         print _('checking permissions on list data')
     # BAW: This needs to be converted to the Site module abstraction
     for dir in os.listdir(mm_cfg.LIST_DATA_DIR):
-        for file in checkfiles:
-            path = os.path.join(mm_cfg.LIST_DATA_DIR, dir, file)
-            if STATE.VERBOSE:
-                print _('    checking permissions on: %(path)s')
-            try:
-                mode = statmode(path)
-            except OSError, e:
-                if e.errno <> errno.ENOENT: raise
-                continue
-            if (mode & targetmode) <> targetmode:
-                STATE.ERRORS += 1
-                print _('file permissions must be at least 660: %(path)s'),
-                if STATE.FIX:
-                    print _('(fixing)')
-                    os.chmod(path, mode | targetmode)
-                else:
-                    print
+       if dir != '.keep':
+            for file in checkfiles:
+                path = os.path.join(mm_cfg.LIST_DATA_DIR, dir, file)
+                if STATE.VERBOSE:
+                    print _('    checking permissions on: %(path)s')
+                try:
+                    mode = statmode(path)
+                except OSError, e:
+                    if e.errno <> errno.ENOENT: raise
+                    continue
+                if (mode & targetmode) <> targetmode:
+                    STATE.ERRORS += 1
+                    print _('file permissions must be at least 660: %(path)s'),
+                    if STATE.FIX:
+                        print _('(fixing)')
+                        os.chmod(path, mode | targetmode)
+                    else:
+                        print
Comment 1 Matteo Settenvini 2004-06-25 01:56:16 UTC
Thank you, this works for me.

Could you create an attachment with the patch? It makes it easier to include it in portage / try it out / keep things in order.
Comment 2 Jim Ramsay (lack) (RETIRED) gentoo-dev 2004-06-28 12:00:24 UTC
Created attachment 34345 [details, diff]
Patch to 'check_perm' script to make it ignore '.keep' files
Comment 3 Jaco Kroon 2004-07-16 14:35:54 UTC
Wouldn't a simpler solution be to delete the .keep file from the lists directory before calling the check_perms script?
Comment 4 Jim Ramsay (lack) (RETIRED) gentoo-dev 2004-07-18 20:25:12 UTC
Yes, but I'm assuming that the .keep file is there for a reason... 

Probably to stop some gentoo-only process somewhere from deleting that directory if there aren't any lists yet.
Comment 5 Tuan Van (RETIRED) gentoo-dev 2004-07-21 09:47:01 UTC
the '.keep' file put in there to _keep_ the directory from wipeout by portage during unmerge the older version if it's empty.
Jim, I don't know any python, so I asked. Will your patch skips check on the file '.keep' or skips any directory that contains '.keep'?
Comment 6 Brian Harring (RETIRED) gentoo-dev 2004-07-21 10:22:07 UTC
Created attachment 35893 [details, diff]
mailman-2.1.5-directory-check.patch

Problem with this code is that it assumes everything in mm_cfg.LIST_DATA_DIR is
going to be a directory (which the .keep file has disproven already).

I'm not much for singling out just the .keep file to ignore; in my books, if it
ain't a directory, don't try using it as one :)
Either way, this is a 2 line fix that checks to see if dir is actually a
directory; if so, do the checks in that directory, otherwise go on to the next
returned entry from os.listdir .
Comment 7 Brian Harring (RETIRED) gentoo-dev 2004-07-21 15:29:07 UTC
Created attachment 35923 [details, diff]
mailman-2.1.5-directory-check.patch

...and I'm a tool for not concattenating the path :D

Corrected version.
Comment 8 Tuan Van (RETIRED) gentoo-dev 2004-07-21 17:36:34 UTC
fixed in mailman-2.1.5-r1 with ~arch keywords. Please test and report back you experience any problem. Thanks everyone.

sparc: this is a minor fix. Please test stable this if you can. Thanks.
Comment 9 Tuan Van (RETIRED) gentoo-dev 2004-07-21 17:41:01 UTC
*** Bug 56250 has been marked as a duplicate of this bug. ***
Comment 10 Jim Ramsay (lack) (RETIRED) gentoo-dev 2004-08-05 09:25:52 UTC
Works here.