[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#655179: pastebinit does not read .conf files from ~/.pastebin.d/ directory



Am 15.01.2012 13:25, schrieb Adam D. Barratt:
> Yes, it needs an explicit manual ack before it moves in to
> proposed-updates.  We still prefer to finalise the debdiff before the
> upload occurs however, as repeated upload/reject cycles are annoying for
> both sides.
> 
> Looking at the diff in the context of the original code, I'm a little
> confused as to the intended functionality.  Assume that I
> have /etc/pastebin.d/config1, /etc/pastebin.d/config2 and
> ~/.pastebin.d/config2.  What is the expected resulting set of
> configuration files which will be used by pastebinit?  From reading the
> comments in the source code I assumed that it would
> be /etc/pastebin.d/config1 and ~/.pastebin.d/config2.  However, the list
> of configuration files ("pastebind") is reset on each iteration of the
> outer loop, meaning that afaict the result would actually be just
> ~/.pastebin.d/config2.
> 
> Regards,
> 
> Adam
> 
> 
> .
> 
You are right Adam. Adding configs to ~/.pastebin.d overrides
everything, because of the "pastebind" configuration list reset. But
that's the way it is upstream. If you move this out of the outer loop
the resulting set is a merge of all configs. The attached patch contains
both changes, indention fix and config merge.

Regards,
Max
--- orig/pastebinit	2012-01-15 16:07:05.475776814 +0100
+++ pastebinit	2012-01-15 15:46:05.919821365 +0100
@@ -39,6 +39,7 @@
         #  - for source checkout, config in the checkout
         #  - user's overrides in ~/.pastebin.d
         # Files found later override files found earlier.
+        pastebind = {}
         for confdir in ['/etc/pastebin.d',
                         os.path.join(os.path.dirname(__file__), 'pastebin.d'),
                         os.path.expanduser('~/.pastebin.d')]:
@@ -46,7 +47,6 @@
                 confdirlist = os.listdir(confdir)
             except OSError:
                 continue
-            pastebind = {}
             for fileitem in confdirlist:
                 if fileitem.startswith('.'):
                     continue
@@ -67,7 +67,7 @@
                     print >> sys.stderr, _("%s: no 'basename' in [pastebin]") % filename
                     continue
                 pastebind[basename] = bininstance
-            return pastebind
+        return pastebind
 
     # pastey.net obfuscates parent ids for replies.  Rather than taking the
     # post ID given as the parent ID, we must handle this by going to that

Reply to: