[PATCH] provision: use ASCII quotes

Noel Power nopower at suse.com
Wed Mar 13 09:27:17 UTC 2019


On 13/03/2019 08:18, Philipp Gesang via samba-technical wrote:
> Hi Douglas,
>
> -<| Quoting Douglas Bagnall <douglas.bagnall at catalyst.net.nz>, on Wednesday, 2019-03-13 12:36:44 PM |>-
>> hi Philipp,
>>  
>>> provisioning on a C locale breaks for me on devel master / commit
>>> a68e8af2d1, running under Python 3. Error output see the bottom
>>> of the mail. The problem is that open(…).read() trips over the
>>> Unicode quotes in the license blurb of extended-rights.ldif.
>> Your patch is obviously good, but it is not quite perfect.
>>
>> This exact string ("(“this documentation”)") has already caused the
>> trouble in https://bugzilla.samba.org/show_bug.cgi?id=13826 where
>> it refers to a file directly downloaded from Microsoft documentation.
>> In that case we don't want edit the file. Instead we do something
>> like this:
>>
>> -    input_file = open(input_file_name, "r")
>> +    input_file = io.open(input_file_name, "rt", encoding='utf8')
> I had that first actually but then I tested all ldif files in the
> tree and it turned out that only these two codepoints in a single
> file were affected.
>
> io.open() and open() are the same btw. and "t" mode is redundant.
>
>> source4/setup/extended-rights.ldif doesn't look to be directly
>> downloaded or machine generated, but it looks *close*, and there might
>> be others we haven't found yet.
> According to git log some hand-editing took place.
>
>> So, my question is: does adding "encoding='utf8'" in the right place
>> in read_and_sub_file() also solve the problem?
> It does, see attached patch.
>
> read_and_sub_file() is used in other contexts as well so I
> triggered a CI run; let’s see what breaks ;)
> https://gitlab.com/samba-team/devel/samba/pipelines/51577845
>
>> If it does, I would prefer that.
> Works for me.
>
> Philipp
>
lgtm - on a side note Douglas we already talked about this before when
we came across some similar issue and you did some code analysis on
existing open vs io.open (under python2). I had this on my todo list to
come back to after we got over the initial move to py3 hurdle, probably
time to revisit this. I guess targetted piecemeal changes are the way to
go. I  try to make a start on that

Noel




More information about the samba-technical mailing list