Commit 726521d6 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 464cac34
From f0913cee83b897a58c150911ab9e8ed8c605c472 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Wed, 1 Nov 2023 09:44:23 +0100
Subject: [PATCH] fix pdf reader getting stuck when trying to read large files
wihhout xref marker #808
Backport of a PyPDF commit
---
PyPDF2/pdf.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/PyPDF2/pdf.py b/PyPDF2/pdf.py
index 7bba1c6..0034c90 100644
--- a/PyPDF2/pdf.py
+++ b/PyPDF2/pdf.py
@@ -1919,7 +1919,7 @@ class PdfFileReader(object):
def readNextEndLine(self, stream):
debug = False
if debug: print(">>readNextEndLine")
- line = b_("")
+ line_parts = []
while True:
# Prevent infinite loops in malformed PDFs
if stream.tell() == 0:
@@ -1946,10 +1946,11 @@ class PdfFileReader(object):
break
else:
if debug: print(" x is neither")
- line = x + line
+ line_parts.append(x)
if debug: print((" RNEL line:", line))
if debug: print("leaving RNEL")
- return line
+ line_parts.reverse()
+ return b"".join(line_parts)
def decrypt(self, password):
"""
--
2.39.2
......@@ -16,8 +16,8 @@ parts = ghostscript
[ghostscript]
recipe = slapos.recipe.cmmi
shared = true
url = https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs10020/ghostscript-10.02.0.tar.xz
md5sum = 80c1cdfada72f2eb5987dc0d590ea5b2
url = https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs10021/ghostscript-10.02.1.tar.xz
md5sum = 26c0cbfa2e09da97f1fc78728048ada8
pkg_config_depends = ${libidn:location}/lib/pkgconfig:${libtiff:location}/lib/pkgconfig:${libjpeg:location}/lib/pkgconfig:${fontconfig:location}/lib/pkgconfig:${fontconfig:pkg_config_depends}
# XXX --with-tessdata work arounds a slaprunner bug of having softwares installed in a path containing //
configure-options =
......
......@@ -2,6 +2,7 @@
extends =
../readline/buildout.cfg
../tcl/buildout.cfg
../xz-utils/buildout.cfg
../zlib/buildout.cfg
parts =
sqlite3
......@@ -22,4 +23,4 @@ configure-options =
environment =
CPPFLAGS=-I${readline:location}/include -I${ncurses:location}/include -I${zlib:location}/include -DSQLITE_MAX_VARIABLE_NUMBER=250000 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
LDFLAGS=-L@@LOCATION@@ -Wl,-rpath=${readline:location}/lib -Wl,-rpath=${ncurses:location}/lib -L${readline:location}/lib -L${ncurses:location}/lib -L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib
PATH=${tcl:location}/bin:%(PATH)s
PATH=${tcl:location}/bin:${xz-utils:location}/bin:%(PATH)s
......@@ -19,7 +19,7 @@ md5sum = a27e2cb34e4efe2ed0d4698f505554f0
[yarn.lock]
_update_hash_filename_ = yarn.lock
md5sum = bb7444ebfeea21fed1960700aa6becf9
md5sum = ae0f135e9c32967cc7cbc0a708225b60
[ms-python-disable-jedi-buildout.patch]
_update_hash_filename_ = ms-python-disable-jedi-buildout.patch
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -103,10 +103,6 @@
"null"
]
},
"nofile": {
"description": "Set open file descriptors soft limit to hard limit",
"type": "boolean"
},
"family-override": {
"description": "Family-wide options, possibly overriding global options",
"default": {},
......
......@@ -32,7 +32,6 @@ import glob
import http.client
import json
import os
import resource
import shutil
import socket
import sqlite3
......@@ -1101,36 +1100,3 @@ class TestNEO(ZopeSkinsMixin, CrontabMixin, ERP5InstanceTestCase):
'var',
'log',
f))
class TestNofileParameter(ERP5InstanceTestCase, TestPublishedURLIsReachableMixin):
"""Test setting the nofile parameter sets the open fd soft limit to the hard limit.
"""
__partition_reference__ = 'nofile'
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({'nofile': True})}
def test_nofile(self):
with self.slap.instance_supervisor_rpc as supervisor:
all_process_info = supervisor.getAllProcessInfo()
_, current_hard_limit = resource.getrlimit(resource.RLIMIT_NOFILE)
process_info, = (p for p in all_process_info if p['name'].startswith('zope-'))
self.assertEqual(
resource.prlimit(process_info['pid'], resource.RLIMIT_NOFILE),
(current_hard_limit, current_hard_limit))
class TestUnsetNofileParameter(ERP5InstanceTestCase, TestPublishedURLIsReachableMixin):
"""Test not setting the nofile parameter doesn't change the soft limit of erp5
"""
__partition_reference__ = 'unsetnofile'
def test_unset_nofile(self):
with self.slap.instance_supervisor_rpc as supervisor:
all_process_info = supervisor.getAllProcessInfo()
limit = resource.getrlimit(resource.RLIMIT_NOFILE)
process_info, = (p for p in all_process_info if p['name'].startswith('zope-'))
self.assertEqual(
resource.prlimit(process_info['pid'], resource.RLIMIT_NOFILE), limit)
......@@ -14,7 +14,7 @@
# not need these here).
[template-erp5]
filename = instance-erp5.cfg.in
md5sum = 577f9f137e81cd6d59db834f065884ff
md5sum = 2491969d49f8bf9b172e89b1c0e9d98e
[template-balancer]
filename = instance-balancer.cfg.in
......
......@@ -303,7 +303,6 @@ config-longrequest-logger-interval = {{ dumps(zope_parameter_dict.get('longreque
config-longrequest-logger-timeout = {{ dumps(zope_parameter_dict.get('longrequest-logger-timeout', 1)) }}
config-large-file-threshold = {{ dumps(zope_parameter_dict.get('large-file-threshold', "10MB")) }}
config-port-base = {{ dumps(zope_parameter_dict.get('port-base', 2200)) }}
config-nofile = {{ dumps(slapparameter_dict.get('nofile', false)) }}
{# BBB: zope_parameter_dict used to contain 'webdav', so fallback to it -#}
config-webdav = {{ dumps(current_zope_family_override_dict.get('webdav', zope_parameter_dict.get('webdav', False))) }}
config-publisher-timeout = {{ dumps(current_zope_family_override_dict.get('publisher-timeout', global_publisher_timeout)) }}
......
......@@ -15,7 +15,7 @@
[instance-theia]
_update_hash_filename_ = instance-theia.cfg.jinja.in
md5sum = b31e74f018ae92607f4ff63984b33c7a
md5sum = bf611d4551e6c2d4ea5fd22c3ae8ecfd
[instance]
_update_hash_filename_ = instance.cfg.in
......
......@@ -11,7 +11,6 @@ theia-environment-parts =
slapos-repository
runner-link
settings.json
python-enable-user-pip
theia-parts =
frontend-instance
......@@ -513,12 +512,6 @@ command =
${buildout:bin-directory}/slapos complete > $${directory:bash-completions}/slapos
${buildout:bin-directory}/slapos complete --shell fish > $${directory:fish-completions}/slapos.fish
[python-enable-user-pip]
# enable pip user installation for python extension
recipe = plone.recipe.command
stop-on-error = true
command =
${python:executable} -m ensurepip --user
# Embedded Instance
# -----------------
......
......@@ -63,11 +63,8 @@ repository_id_list += wendelin
list += ${wendelin:location}/bt5
# Jupyter is by default enabled in Wendelin
# and also the soft limit of open file descriptors is set
# to the hard limit.
[erp5-defaults]
jupyter-enable-default = true
nofile-enable-default = true
[wendelin]
recipe = slapos.recipe.build:gitclone
......
......@@ -185,7 +185,6 @@ context =
key instance_common_cfg instance-common:output
key jupyter_enable_default erp5-defaults:jupyter-enable-default
key wcfs_enable_default erp5-defaults:wcfs-enable-default
key nofile_enable_default erp5-defaults:nofile-enable-default
key kumo_location kumo:location
key local_bt5_repository local-bt5-repository:list
key logrotate_location logrotate:location
......@@ -339,8 +338,6 @@ cloudooo-connection-url-list =
jupyter-enable-default = false
# WCFS is by default disabled in ERP5
wcfs-enable-default = false
# nofile option of zopewsgi is disabled in ERP5
nofile-enable-default = false
[erp5]
recipe = slapos.recipe.build:gitclone
......@@ -693,7 +690,9 @@ Products.CMFCore-patches = ${:_profile_base_location_}/../../component/egg-patch
Products.CMFCore-patch-options = -p1
Products.DCWorkflow-patches = ${:_profile_base_location_}/../../component/egg-patch/Products.DCWorkflow/workflow_method-2.4.1.patch#ec7bb56a9f1d37fcbf960cd1e96e6e6d
Products.DCWorkflow-patch-options = -p1
PyPDF2-patches = ${:_profile_base_location_}/../../component/egg-patch/PyPDF2/0001-Custom-implementation-of-warnings.formatwarning-remo.patch#d25bb0f5dde7f3337a0a50c2f986f5c8
PyPDF2-patches =
${:_profile_base_location_}/../../component/egg-patch/PyPDF2/0001-Custom-implementation-of-warnings.formatwarning-remo.patch#d25bb0f5dde7f3337a0a50c2f986f5c8
${:_profile_base_location_}/../../component/egg-patch/PyPDF2/0002-fix-pdf-reader-getting-stuck-when-trying-to-read-lar.patch#c06a29b6b6a5df612ae36731b938fb95
PyPDF2-patch-options = -p1
python-magic-patches = ${:_profile_base_location_}/../../component/egg-patch/python_magic/magic.patch#de0839bffac17801e39b60873a6c2068
python-magic-patch-options = -p1
......@@ -743,7 +742,7 @@ depends =
Acquisition = 4.7+SlapOSPatched001
Products.DCWorkflow = 2.4.1+SlapOSPatched001
ocropy = 1.0+SlapOSPatched001
PyPDF2 = 1.26.0+SlapOSPatched001
PyPDF2 = 1.26.0+SlapOSPatched002
pysvn = 1.9.15+SlapOSPatched001
python-ldap = 2.4.32+SlapOSPatched001
python-magic = 0.4.12+SlapOSPatched001
......
......@@ -70,11 +70,11 @@ md5sum = b95084ae9eed95a68eada45e28ef0c04
[template]
filename = instance.cfg.in
md5sum = 4d4d1accdec116141d8c07d47eb18161
md5sum = 3f7b28085ceff321a3cb785db60f7c3e
[template-erp5]
filename = instance-erp5.cfg.in
md5sum = 631d49d494721c8aabc9f1f061ac4d39
md5sum = 098e1d02159aeca9b36f2a0726b7b230
[template-zeo]
filename = instance-zeo.cfg.in
......@@ -86,7 +86,7 @@ md5sum = 0ac4b74436f554cd677f19275d18d880
[template-zope]
filename = instance-zope.cfg.in
md5sum = e8e5e0bbfb4d4ceb98ef1eac35ec5178
md5sum = 9e6440425167a506bd473a3697eaa9e6
[template-balancer]
filename = instance-balancer.cfg.in
......
......@@ -11,7 +11,6 @@
{% set jupyter_zope_family = jupyter_dict.get('zope-family', '') -%}
{% set wcfs_dict = slapparameter_dict.get('wcfs', {}) -%}
{% set wcfs_enable = wcfs_dict.get('enable', wcfs_enable_default.lower() in ('true', 'yes')) -%}
{% set nofile_enable = slapparameter_dict.get('nofile', nofile_enable_default.lower() in ('true', 'yes')) %}
{% set test_runner_enabled = slapparameter_dict.get('test-runner', {}).get('enabled', True) -%}
{% set test_runner_node_count = slapparameter_dict.get('test-runner', {}).get('node-count', 3) -%}
{% set test_runner_extra_database_count = slapparameter_dict.get('test-runner', {}).get('extra-database-count', 3) -%}
......@@ -312,7 +311,6 @@ config-longrequest-logger-interval = {{ dumps(zope_parameter_dict.get('longreque
config-longrequest-logger-timeout = {{ dumps(zope_parameter_dict.get('longrequest-logger-timeout', 1)) }}
config-large-file-threshold = {{ dumps(zope_parameter_dict.get('large-file-threshold', "10MB")) }}
config-port-base = {{ dumps(zope_parameter_dict.get('port-base', 2200)) }}
config-nofile = {{ dumps(nofile_enable) }}
{# BBB: zope_parameter_dict used to contain 'webdav', so fallback to it -#}
config-webdav = {{ dumps(current_zope_family_override_dict.get('webdav', zope_parameter_dict.get('webdav', False))) }}
config-publisher-timeout = {{ dumps(current_zope_family_override_dict.get('publisher-timeout', global_publisher_timeout)) }}
......
{% from "instance_zodb_base" import zodb_dict with context %}
{% set webdav = slapparameter_dict['webdav'] -%}
{% set nofile = slapparameter_dict['nofile'] -%}
{% set thread_amount = slapparameter_dict['thread-amount'] %}
{% set use_ipv6 = slapparameter_dict.get('use-ipv6', False) -%}
{% set ports = itertools.count(slapparameter_dict['port-base']) -%}
......@@ -347,7 +346,6 @@ wrapped-command-line =
--access-log-file={{ '${' ~ conf_parameter_name ~ ':z2-log}' }}
{% if longrequest_logger_interval > 0 %} --long-request-log-file={{ '${' ~ conf_parameter_name ~ ':longrequest-logger-file}' }} {% endif %}
{% if webdav %}-w{% endif %}
{% if nofile %}--nofile{% endif %}
{{ ipv4 }}:${:port}
{% if timerserver_interval %}--timerserver-interval={{ timerserver_interval }}{% endif %}
'${:configuration-file}'
......
......@@ -43,7 +43,6 @@ init =
default-cloudooo-url-list = ${default-cloudooo-url-list:url-list}
jupyter-enable-default = {{ jupyter_enable_default }}
wcfs-enable-default = {{ wcfs_enable_default }}
nofile-enable-default = {{ nofile_enable_default }}
local-bt5-repository = {{ ' '.join(local_bt5_repository.split()) }}
[context]
......@@ -59,7 +58,6 @@ extra-context =
key default_cloudooo_url_list dynamic-template-erp5-parameters:default-cloudooo-url-list
key jupyter_enable_default dynamic-template-erp5-parameters:jupyter-enable-default
key wcfs_enable_default dynamic-template-erp5-parameters:wcfs-enable-default
key nofile_enable_default dynamic-template-erp5-parameters:nofile-enable-default
key local_bt5_repository dynamic-template-erp5-parameters:local-bt5-repository
key openssl_location :openssl-location
import re re
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment