Fwd: Re: [PATCH] Allow py_smb_savefile() to except utf text
Andrew Bartlett
abartlet at samba.org
Thu Aug 31 01:57:19 UTC 2017
On Thu, 2017-08-24 at 14:27 -0600, David Mulder wrote:
> Added tests for reading/writing of Greek and Chinese texts.
>
> On 08/23/2017 04:55 PM, Andrew Bartlett wrote:
> > On Wed, 2017-08-23 at 13:05 -0600, David Mulder via samba-technical
> > wrote:
> > > -------- Forwarded Message --------
> > > Subject: Re: [PATCH] Allow py_smb_savefile() to except
> > > utf
> > > text
> > > Date: Wed, 23 Aug 2017 13:04:10 -0600
> > > From: David Mulder <dmulder at suse.com>
> > > To: Andrew Bartlett <abartlet at samba.org>
> > >
> > >
> > >
> > > Here is that same patch, but with testing added. Please review
> > > and
> > > push.
> > >
> > > Thanks!
> >
> > Don't you need some non-ASCII chars for this to be a really good
> > test?
> >
> > Thanks,
> >
> > Andrew Bartlett
Are you sure this is correct?
When I autobuild this on sn-devel (Ubuntu 14.04) and similar machines
in the Catalyst Cloud, I get:
commit 7a8bd382e561498ace00834298ec62d663c67e55
Author: David Mulder <dmulder at suse.com>
Date: Fri Jul 28 08:47:58 2017 -0600
Allow py_smb_savefile() to except utf text
py_smb_loadfile() is able to read utf-16, but py_smb_savefile() was
not able to write
utf-16. Using the 's#' string format allows an invisible length
parameter to be passed
to the c code by python, thus eliminating the need to do a
strlen(), and making
the function compatible with other string encodings.
Signed-off-by: David Mulder <dmulder at suse.com>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Garming Sam <garming at catalyst.net.nz>
The last 50 lines of log messages:
[1997(12411)/2193 at 1h58m57s]
samba4.winbind.dom_name_parse.cmd(s4member)
[1998(12412)/2193 at 1h58m57s]
samba4.winbind.dom_name_parse.cmd(s4member)
[1999(12413)/2193 at 1h58m57s]
samba4.winbind.dom_name_parse.cmd(s4member)
[2000(12414)/2193 at 1h58m57s]
samba4.winbind.dom_name_parse.cmd(s4member)
[2001(12415)/2193 at 1h58m57s] samba.nss.test using
winbind(ad_dc:local)(ad_dc:local)
[2002(12416)/2193 at 1h59m14s] samba.nss.test using
winbind(s4member:local)(s4member:local)
[2003(12417)/2193 at 1h59m14s] samba.nss.test using
winbind(nt4_dc:local)(nt4_dc:local)
[2004(12418)/2193 at 1h59m14s] samba.nss.test using
winbind(ad_member:local)(ad_member:local)
[2005(12419)/2193 at 1h59m15s] samba.nss.test using
winbind(nt4_member:local)(nt4_member:local)
[2006(12420)/2193 at 1h59m16s] samba.tests.gensec(ad_dc_ntvfs:local)
[2007(12431)/2193 at 1h59m17s] samba.tests.gensec(ad_dc_ntvfs:local)
[2008(12442)/2193 at 1h59m18s] tdb.python
[2009(12496)/2193 at 1h59m18s]
samba.tests.dcerpc.sam(ad_dc_ntvfs:local)
[2010(12499)/2193 at 1h59m18s] samba.tests.dsdb(ad_dc_ntvfs:local)
[2011(12518)/2193 at 1h59m37s]
samba.tests.dcerpc.bare(ad_dc_ntvfs:local)
[2012(12522)/2193 at 1h59m37s]
samba.tests.dcerpc.srvsvc(ad_dc_ntvfs:local)
[2013(12522)/2193 at 1h59m37s]
samba.tests.samba_tool.timecmd(ad_dc_ntvfs:local)
[2014(12524)/2193 at 1h59m40s]
samba.tests.samba_tool.join(ad_dc_ntvfs:local)
[2015(12525)/2193 at 1h59m41s]
samba.tests.samba_tool.fsmo(ad_dc_ntvfs:local)
[2016(12526)/2193 at 1h59m42s]
samba.tests.samba_tool.fsmo(fl2000dc:local)
[2017(12527)/2193 at 1h59m42s]
samba.tests.samba_tool.fsmo(fl2003dc:local)
[2018(12528)/2193 at 1h59m43s]
samba.tests.samba_tool.fsmo(fl2008r2dc:local)
[2019(12529)/2193 at 1h59m43s] samba.tests.samba_tool.edit(ad_dc:local)
[2020(12532)/2193 at 1h59m45s]
samba.tests.samba_tool.edit(ad_dc_ntvfs:local)
[2021(12535)/2193 at 1h59m46s]
samba.tests.samba_tool.edit(fl2000dc:local)
[2022(12538)/2193 at 1h59m47s]
samba.tests.samba_tool.edit(fl2003dc:local)
[2023(12541)/2193 at 1h59m48s]
samba.tests.samba_tool.edit(fl2008r2dc:local)
[2024(12544)/2193 at 1h59m49s]
samba.tests.samba_tool.gpo(ad_dc_ntvfs:local)
WARNING: The "lsa over netlogon" option is deprecated
UNEXPECTED(error):
samba.tests.samba_tool.gpo.samba.tests.samba_tool.gpo.GpoCmdTestCase.te
st_aclcheck (samba.subunit.RemotedTestCase)(ad_dc_ntvfs:local)
REASON: Exception: Exception: was started but never finished!
UNEXPECTED(error):
samba.tests.samba_tool.gpo.samba.tests.samba_tool.gpo.GpoCmdTestCase.te
st_aclcheck(ad_dc_ntvfs:local) (samba.subunit.RemotedTestCase)
REASON: was started but never finished!
The failure is a core file (in a wrapper in /var/cores). Running gdb
on that gives:
(gdb) up
#1 0x00002b5f129b9bba in smbcli_req_append_string (req=0x1524910,
str=0x2b5f00000000 <error: Cannot access memory at address
0x2b5f00000000>, flags=9)
at ../source4/libcli/raw/rawrequest.c:455
455 len = (strlen(str)+2) * MAX_BYTES_PER_CHAR;
(gdb)
#2 0x00002b5f129b9ce8 in smbcli_req_append_string_len (req=0x1524910,
str=0x2b5f00000000 <error: Cannot access memory at address
0x2b5f00000000>, flags=9, len=0x7ffcbd40dc84)
at ../source4/libcli/raw/rawrequest.c:494
494 ret = smbcli_req_append_string(req, str, flags);
(gdb)
#3 0x00002b5f129b0628 in smb_raw_open_send (tree=0x15130d0,
parms=0x151ac70) at ../source4/libcli/raw/rawfile.c:531
531 smbcli_req_append_string_len(req, parms-
>ntcreatex.in.fname, STR_TERMINATE, &len);
(gdb)
#4 0x00002b5f129ce82f in smb_composite_savefile_send (tree=0x15130d0,
io=0x7ffcbd40dd40)
at ../source4/libcli/smb_composite/savefile.c:252
252 state->req = smb_raw_open_send(tree, io_open);
(gdb)
#5 0x00002b5f129ce8f1 in smb_composite_savefile (tree=0x15130d0,
io=0x7ffcbd40dd40)
at ../source4/libcli/smb_composite/savefile.c:286
286 struct composite_context *c =
smb_composite_savefile_send(tree, io);
(gdb)
#6 0x00002b5f160f9535 in py_smb_savefile (self=<smb.SMB at remote
0x2b5f161f6a58>,
args=('samba.example.com\\Policies\\{95CFFA08-34CE-48B8-861D-
11CC23C01595}\\GPT.INI', '[General]\r\nVersion=0\r\n'))
at ../source4/libcli/pysmb.c:142
142 status = smb_composite_savefile(spdata->tree, &io);
(gdb)
#7 0x0000000000523f6d in call_function (oparg=<optimized out>,
pp_stack=0x7ffcbd40de70) at ../Python/ceval.c:4020
4020 ../Python/ceval.c: No such file or directory.
(gdb) down
#6 0x00002b5f160f9535 in py_smb_savefile (self=<smb.SMB at remote
0x2b5f161f6a58>,
args=('samba.example.com\\Policies\\{95CFFA08-34CE-48B8-861D-
11CC23C01595}\\GPT.INI', '[General]\r\nVersion=0\r\n'))
at ../source4/libcli/pysmb.c:142
142 status = smb_composite_savefile(spdata->tree, &io);
(gdb) p filename
$1 = 0x2b5f00000000 <error: Cannot access memory at address
0x2b5f00000000>
(gdb) p ip
No symbol "ip" in current context.
(gdb) p io
$2 = {in = {fname = 0x2b5f00000000 <error: Cannot access memory at
address 0x2b5f00000000>,
data = 0x2b5f16134f94 "[General]\r\nVersion=0\r\n", size = 22}}
(gdb) p args
$3 = ('samba.example.com\\Policies\\{95CFFA08-34CE-48B8-861D-
11CC23C01595}\\GPT.INI', '[General]\r\nVersion=0\r\n')
(gdb) p *io
Structure has no component named operator*.
(gdb) p io
$4 = {in = {fname = 0x2b5f00000000 <error: Cannot access memory at
address 0x2b5f00000000>,
data = 0x2b5f16134f94 "[General]\r\nVersion=0\r\n", size = 22}}
(gdb) up
While it doesn't fail on Fedora, it fails reliably on Ubuntu 14.04
x86_64.
Can you please look into it?
Thanks,
Andrew Bartlett
--
Andrew Bartlett
https://samba.org/~abartlet/
Authentication Developer, Samba Team https://samba.org
Samba Development and Support, Catalyst IT
https://catalyst.net.nz/services/samba
More information about the samba-technical
mailing list