[PATCH] Improve samba-tool testparm and remove unused script

Andrew Bartlett abartlet at samba.org
Fri Jan 24 13:44:21 MST 2014


On Sat, 2014-01-25 at 09:38 +1300, Andrew Bartlett wrote:
> On Fri, 2014-01-24 at 20:59 +0100, Jelmer Vernooij wrote:
> > On Sat, Jan 25, 2014 at 08:44:46AM +1300, Andrew Bartlett wrote:
> > > On Fri, 2014-01-24 at 20:30 +0100, Jelmer Vernooij wrote:
> > > > On Sat, Jan 25, 2014 at 08:17:48AM +1300, Andrew Bartlett wrote:
> > > > > On Fri, 2014-01-24 at 13:28 +0100, Jelmer Vernooij wrote:
> > > > > > On Fri, Jan 24, 2014 at 09:06:23PM +1300, Andrew Bartlett wrote:
> > > > > > > From a2b0fbde9d4118bc8bc14f410511436bda83fa3a Mon Sep 17 00:00:00 2001
> > > > > > > From: Andrew Bartlett <abartlet at samba.org>
> > > > > > > Date: Tue, 24 Dec 2013 14:06:47 +1300
> > > > > > > Subject: [PATCH 1/4] script: Remove unused and no-longer-working
> > > > > > >  extract_allparms.sh
> > > > > > > 
> > > > > > > Signed-off-by: Andrew Bartlett <abartlet at samba.org>
> > > > > > > Signed-off-by: Garming Sam <garming at catalyst.net.nz>
> > > > > > Reviewed-By: Jelmer Vernooij <jelmer at samba.org>
> > > > > > 
> > > > > > > From ff6495e4683d7cecf4fe289c91d930e2c6f5b5ab Mon Sep 17 00:00:00 2001
> > > > > > > From: Garming Sam <garming at catalyst.net.nz>
> > > > > > > Date: Fri, 27 Dec 2013 17:09:35 +1300
> > > > > > > Subject: [PATCH 2/4] testparm: fix --parameter-name failure to convert to
> > > > > > >  output string
> > > > > > 
> > > > > > > Signed-off-by: Garming Sam <garming at catalyst.net.nz>
> > > > > > > Signed-off-by: Andrew Bartlett <abartlet at samba.org>
> > > > > > > ---
> > > > > > >  python/samba/netcmd/testparm.py | 2 +-
> > > > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > > > 
> > > > > > > diff --git a/python/samba/netcmd/testparm.py b/python/samba/netcmd/testparm.py
> > > > > > > index 9251469..dbf79c7 100644
> > > > > > > --- a/python/samba/netcmd/testparm.py
> > > > > > > +++ b/python/samba/netcmd/testparm.py
> > > > > > > @@ -105,7 +105,7 @@ class cmd_testparm(Command):
> > > > > > >                      lp[section_name].dump(sys.stdout, lp.default_service,
> > > > > > >                              verbose)
> > > > > > >                  else:
> > > > > > > -                    self.outf.write(lp.get(parameter_name, section_name)+"\n")
> > > > > > > +                    self.outf.write(str(lp.get(parameter_name, section_name))+"\n")
> > > > > > 
> > > > > > What this is trying to avoid? Doesn't sys.stdout.write already cast to string?
> > > > > 
> > > > > Correct, we get:
> > > > > 
> > > > > ERROR(<type 'exceptions.TypeError'>): uncaught exception - can only concatenate list (not "str") to list
> > > > >   File "bin/python/samba/netcmd/__init__.py", line 175, in _run
> > > > >     return self.run(*args, **kwargs)
> > > > >   File "bin/python/samba/netcmd/testparm.py", line 108, in run
> > > > >     self.outf.write(lp.get(parameter_name, section_name)+"\n")
> > > > Do we really want to simply call str in that case though? That will result in
> > > > output that is fairly python specific, rather than similar to smb.conf syntax:
> > > > 
> > > > >>> x = ["a", "b", "c"]
> > > > >>> str(x)
> > > > "['a', 'b', 'c']"
> > > > 
> > > > A test to verify this behaviour would also be nice. :-)
> > > 
> > > The docs.py test is what found and will verify this, because it now (in
> > > the full branch) checks the output against the 'man smb.conf' contents,
> > > including formatting. 
> > 
> > I'm not sure if I follow. If the docs.py test found and verifies this, does that
> > mean that the output is not ['a', 'b', 'c'] for the example given above?
> 
> It isn't, once the second patch is applied.  Garming first fixed it to
> work at all, then fixed it to correctly format the output in the next
> patch.  (One step at a time and all that). 

To be clear.  This, and most of the changes beyond the renames in this
monster branch were found by a vastly improved docs.py test, not
featured yet because > 100 patches were required to fix up Samba so it
would pass.  

I'm trying to get these patches in so that we can get to that test.

Andrew Bartlett

-- 
Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba




More information about the samba-technical mailing list