lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 14 Dec 2021 12:14:37 +0900
From:   Akira Yokosawa <akiyks@...il.com>
To:     Randy Dunlap <rdunlap@...radead.org>
Cc:     linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
        Jonathan Corbet <corbet@....net>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Akira Yokosawa <akiyks@...il.com>
Subject: Re: [PATCH 5/3] docs: sphinx/kfigure.py: Delegate inkscape msgs to
 kernellog

On Mon, 13 Dec 2021 18:50:51 -0800, Randy Dunlap wrote:
> On 12/13/21 18:34, Akira Yokosawa wrote:
>> Instead of redirecting to /dev/null, capture inkscape messages and
>> output them via kernelloc.verbose or kerneldoc.warn depending on the
> 
>                   kernellog.verbose or kernellog.warn

Now fixed.

        Thanks, Akira
> 
>> exit code.
>>
>> Signed-off-by: Akira Yokosawa <akiyks@...il.com>
>> Cc: Mauro Carvalho Chehab <mchehab@...nel.org>
>> Cc: Jonathan Corbet <corbet@....net>
>> ---
>> Hi Mauro,
>>
>> On second thought, I took the path of delegating inkscape warnings
>> to kernellog.
>>
>> Now you can see those warning messages by "SPHINXOPTS=-v".
>>
>> Does this approach sound reasonable to you?
>>
>>         Thanks, Akira
>> --
>>  Documentation/sphinx/kfigure.py | 28 +++++++++++++---------------
>>  1 file changed, 13 insertions(+), 15 deletions(-)
>>
>> diff --git a/Documentation/sphinx/kfigure.py b/Documentation/sphinx/kfigure.py
>> index dbe75ee8ae61..a275ee0fec02 100644
>> --- a/Documentation/sphinx/kfigure.py
>> +++ b/Documentation/sphinx/kfigure.py
>> @@ -126,9 +126,6 @@ rsvg_convert_cmd = None
>>  inkscape_cmd = None
>>  # Inkscape prior to 1.0 uses different command options
>>  inkscape_ver_one = False
>> -# Show warning from inkscape(1), enabled by setting env var
>> -# SPHINX_SHOW_INKSCAPE_WARN
>> -inkscape_show_warn = False
>>  
>>  
>>  def setup(app):
>> @@ -178,7 +175,7 @@ def setupTools(app):
>>      This function is called once, when the builder is initiated.
>>      """
>>      global dot_cmd, dot_Tpdf, convert_cmd, rsvg_convert_cmd   # pylint: disable=W0603
>> -    global inkscape_cmd, inkscape_ver_one, inkscape_show_warn  # pylint: disable=W0603
>> +    global inkscape_cmd, inkscape_ver_one  # pylint: disable=W0603
>>      kernellog.verbose(app, "kfigure: check installed tools ...")
>>  
>>      dot_cmd = which('dot')
>> @@ -211,12 +208,6 @@ def setupTools(app):
>>          rsvg_convert_cmd = None
>>          dot_Tpdf = False
>>  
>> -        try:
>> -            if os.environ['SPHINX_SHOW_INKSCAPE_WARN']:
>> -                inkscape_show_warn = True
>> -        except KeyError:
>> -            pass
>> -
>>      else:
>>          if convert_cmd:
>>              kernellog.verbose(app, "use convert(1) from: " + convert_cmd)
>> @@ -384,14 +375,21 @@ def svg2pdf(app, svg_fname, pdf_fname):
>>          else:
>>              cmd = [inkscape_cmd, '-z', '--export-pdf=%s' % pdf_fname, svg_fname]
>>  
>> -    # use stdout and stderr from parent
>> -    if inkscape_show_warn:
>> -        exit_code = subprocess.call(cmd)
>> -    else:
>> -        exit_code = subprocess.call(cmd, stderr=subprocess.DEVNULL)
>> +    try:
>> +        warning_msg = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
>> +        exit_code = 0
>> +    except subprocess.CalledProcessError as err:
>> +        warning_msg = err.output
>> +        exit_code = 1
>> +        pass
>>  
>>      if exit_code != 0:
>>          kernellog.warn(app, "Error #%d when calling: %s" % (exit_code, " ".join(cmd)))
>> +        kernellog.warn(app, "Warning msg from inkscape: %s" % str(warning_msg, 'utf-8'))
>> +    if warning_msg:
>> +        kernellog.verbose(app, "Warning msg from inkscape (likely harmless):\n%s"
>> +                          % str(warning_msg, 'utf-8'))
>> +
>>      return bool(exit_code == 0)
>>  
>>  def svg2pdf_by_rsvg(app, svg_fname, pdf_fname):
>>
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ