mb makehashes: Handle Permission Denieds Gracefully #105

Closed
poeml opened this Issue Jun 5, 2015 · 0 comments

1 participant

@poeml
Owner
                                                                                   [          ]

Issue migrated (2015-06-05) from old issue tracker http://mirrorbrain.org/issues/issue105

Title    mb makehashes: Handle Permission Denieds Gracefully
 Priority   bug             Status       resolved
Superseder                Nosy List      poeml, toma
Assigned To poeml          Keywords

msg368 (view) Author: toma Date: 2012-03-30.16:54:53

When there is a folder which is shielded from the public, mb crashes:

Traceback (most recent call last):
File "/usr/bin/mb", line 1645, in
r = mirrordoctor.main()
File "/usr/lib/pymodules/python2.6/cmdln.py", line 257, in main
return self.cmd(args)
File "/usr/lib/pymodules/python2.6/cmdln.py", line 280, in cmd
retval = self.onecmd(argv)
File "/usr/lib/pymodules/python2.6/cmdln.py", line 412, in onecmd
return self._dispatch_cmd(handler, argv)
File "/usr/lib/pymodules/python2.6/cmdln.py", line 1100, in _dispatch_cmd
return handler(argv[0], opts, *args)
File "/usr/bin/mb", line 1036, in do_makehashes
src_basenames = set(os.listdir(src_dir))
OSError: [Errno 13] Permission denied: '/srv/kde/stable/4.8.2'


This setup is used by KDE to provide pre-release tarballs to packagers. When
they are released, they get their public read bit set.

Mirrorbrain should not crash, but just give a warning and continue the hashing
job.

msg383 (view) Author: poeml Date: 2012-04-16.04:45:26

I see - I didn't foresee this use case yet. (I solved that in a different way, by
setting ownership such that mb makehashes can always see all files.) Right, mb
should not fail here.
Thanks for the report!

msg394 (view) Author: toma Date: 2012-05-28.13:04:53

--- mb.orig 2012-05-28 13:03:55.000000000 +0000
+++ mb 2012-05-28 12:48:30.000000000 +0000
@@ -1040,7 +1040,11 @@

           # a set offers the fastest access for "foo in ..." lookups
  • src_basenames = set(os.listdir(src_dir))
  • try:
  • src_basenames = set(os.listdir(src_dir))
  • except os.error:
  • sys.stderr.write('Can not access directory: %r\n' % src_dir)
  •            src_basenames = []
    
           if opts.verbose:
               print 'Examining directory', src_dir
    
msg395 (view) Author: poeml Date: 2012-05-31.20:45:13

Great, thanks!! Submitted to svn trunk.

http://svn.mirrorbrain.org/viewvc/mirrorbrain?view=revision&revision=8293

msg462 (view) Author: poeml Date: 2014-01-22.20:19:39

I'll close this bug since it's fixed in SVN and I don't expect problems. It'll ship
with 2.18.0.

History
         Date         User  Action                      Args
2014-01-22 20:19:39 poeml set    status: testing -> resolved
                                   messages: + msg462
2012-05-31 20:45:13 poeml set    status: chatting -> testing
                                   messages: + msg395
2012-05-28 13:04:53 toma  set    messages: + msg394
                                   status: unread -> chatting
                                   assignedto: poeml
                                   messages: + msg383
2012-04-16 04:45:26 poeml set    nosy: + poeml
                                   title: Handle Permission Denieds Gracefully ->
                                   mb makehashes: Handle Permission Denieds
                                   Gracefully
2012-03-30 16:54:53 toma  create

(end of migrated issue)
@poeml poeml added bug resolved labels Jun 5, 2015
@poeml poeml closed this Jun 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment