Issue #930 resolved

The tidy and nsgmls tools will fail for concurrent requests

created an issue

The built-in tidy and nsgmls tools create temporary files for use as the i/o conduit to the tidy subprocess they create. They use fixed names for these temporary files:

{{{ page_file = os.path.join(temp_dir, 'page.html') open(page_file, 'wb').write(orig_body)

    out_file = os.path.join(temp_dir, 'tidy.out')
    err_file = os.path.join(temp_dir, 'tidy.err')


    result = os.system('"%s" %s%s%s%s -f %s -o %s %s' %
                       (tidy_path, tidy_enc, strict_xml, indent, wrap,
                        err_file, out_file, page_file))


        output = open(out_file, 'rb').read()


This can produce interesting results when concurrent requests invoke these tools.

I also consider the use of os.system() to create the child process to be a defect.

In addition to being broken, these tools are also under-documented.

I also think the functionality of the tidy and nsgmls tools is not really appropriate for being part of the built-in tools in the first place. Certainly they should not be there in the state they are currently in. I suggest removing them from CherryPy.

Comments (3)

  1. Log in to comment