docs: add Russian README and update English docs

Add a Russian README and revise the English documentation to keep both versions aligned.
This commit is contained in:
user
2026-09-23 23:34:03 +04:00
parent 74d248fa7b
commit d0fcb3b062
2 changed files with 244 additions and 39 deletions
+39 -39
View File
@@ -4,65 +4,65 @@ SPDX-FileCopyrightText: 2026 Contributors to cups-kyocera-rastertokpsl-fix
SPDX-License-Identifier: CC0-1.0
-->
# CUPS wrapper для Kyocera `rastertokpsl`
# CUPS wrapper for Kyocera `rastertokpsl`
Обёртка для CUPS-фильтра `rastertokpsl`, предназначенная для устранения падений оригинального Kyocera-фильтра при печати заданий с длинными или не-ASCII названиями.
A wrapper for the CUPS `rastertokpsl` filter designed to prevent crashes of the original Kyocera filter when processing print jobs with long or non-ASCII titles.
## Проблема
## Problem
Некоторые версии Kyocera `rastertokpsl` используют фиксированный буфер для обработки названия задания. При передаче длинной строки или строки с кириллицей это может приводить к переполнению буфера и аварийному завершению фильтра:
Some versions of the Kyocera `rastertokpsl` filter use a fixed-size buffer to process the job title. Passing a long string or a string containing Cyrillic characters can cause a buffer overflow and result in the filter terminating unexpectedly:
```text
*** buffer overflow detected ***: terminated
```
В журналах CUPS это может выглядеть примерно так:
In the CUPS logs, this may look like:
```text
PID 30752 (/usr/lib/cups/filter/rastertokpsl) crashed on signal 6
```
В результате задание не печатается, а очередь принтера может перейти в состояние `stopped`.
As a result, the job is not printed and the printer queue may enter the `stopped` state.
## Решение
## Solution
Wrapper перехватывает аргументы CUPS перед запуском оригинального `rastertokpsl`.
The wrapper intercepts the CUPS arguments before launching the original `rastertokpsl`.
Перед передачей названия задания оригинальному фильтру wrapper:
Before passing the job title to the original filter, the wrapper:
- преобразует UTF-8 в ASCII;
- удаляет неподдерживаемые символы;
- ограничивает длину строки;
- использует `print-job`, если после обработки строка оказалась пустой.
- converts UTF-8 to ASCII;
- removes unsupported characters;
- limits the string length;
- uses `print-job` if the resulting string is empty.
Оригинальный бинарник сохраняется под именем:
The original binary is stored as:
```text
/usr/lib/cups/filter/rastertokpsl.real
```
Wrapper устанавливается вместо него:
The wrapper is installed in its place:
```text
/usr/lib/cups/filter/rastertokpsl
```
## Установка
## Installation
Сначала сохраните оригинальный фильтр:
First, save the original filter:
```bash
sudo cp /usr/lib/cups/filter/rastertokpsl \
/usr/lib/cups/filter/rastertokpsl.real
```
Создайте файл wrapper:
Create the wrapper file:
```bash
sudo nano /usr/lib/cups/filter/rastertokpsl
```
Содержимое:
Contents:
```bash
#!/bin/bash
@@ -107,7 +107,7 @@ exec "$REAL" \
"$options"
```
Назначьте права:
Set the appropriate permissions:
```bash
sudo chown root:root /usr/lib/cups/filter/rastertokpsl
@@ -115,59 +115,59 @@ sudo chmod 755 /usr/lib/cups/filter/rastertokpsl
sudo chmod 755 /usr/lib/cups/filter/rastertokpsl.real
```
Перезапустите CUPS:
Restart CUPS:
```bash
sudo systemctl restart cups
```
## Проверка
## Verification
Убедитесь, что оригинальный файл является исполняемым бинарником:
Make sure the original file is an executable binary:
```bash
file /usr/lib/cups/filter/rastertokpsl.real
```
Ожидается вывод с `ELF ... executable`.
The expected output should contain `ELF ... executable`.
Проверьте печать обычного задания:
Test printing a normal job:
```bash
lp -d PRINTER /tmp/test.pdf
```
Затем проверьте длинное название задания:
Then test a job with a long title:
```bash
lp -d PRINTER \
-t "Очень длинное кириллическое название задания для проверки" \
-t "Very long Cyrillic job title for testing" \
/tmp/test.pdf
```
Посмотреть состояние очереди:
Check the queue status:
```bash
lpstat -p
lpstat -o
```
При необходимости включить подробное логирование CUPS:
To enable verbose CUPS logging when needed:
```bash
sudo cupsctl --debug-logging
sudo tail -F /var/log/cups/error_log
```
После завершения диагностики:
After troubleshooting is complete:
```bash
sudo cupsctl --no-debug-logging
```
## Восстановление оригинального фильтра
## Restoring the Original Filter
Чтобы удалить wrapper и вернуть оригинальный `rastertokpsl`:
To remove the wrapper and restore the original `rastertokpsl`:
```bash
sudo mv /usr/lib/cups/filter/rastertokpsl.real \
@@ -176,21 +176,21 @@ sudo mv /usr/lib/cups/filter/rastertokpsl.real \
sudo systemctl restart cups
```
## Ограничения
## Limitations
Wrapper рассчитан на конкретный вариант интерфейса Kyocera `rastertokpsl`, использующий пять аргументов:
The wrapper is designed for a specific Kyocera `rastertokpsl` interface that uses five arguments:
```text
printer job-id title copies options
```
Размер `20` символов выбран как консервативное ограничение для проблемных версий фильтра. Точный размер внутреннего буфера конкретной версии `rastertokpsl` зависит от драйвера и не определяется самим CUPS.
The `20` character limit was chosen as a conservative restriction for problematic filter versions. The exact size of the internal buffer depends on the specific `rastertokpsl` driver version and is not determined by CUPS itself.
Перед установкой рекомендуется сохранить исходный бинарник и проверить версию драйвера.
Before installation, it is recommended to back up the original binary and check the driver version.
## Структура
## Repository Structure
Пример структуры репозитория:
Example repository structure:
```text
cups-kyocera-rastertokpsl-fix/
@@ -198,7 +198,7 @@ cups-kyocera-rastertokpsl-fix/
└── rastertokpsl
```
Файл `rastertokpsl` из репозитория устанавливается в:
The `rastertokpsl` file from the repository is installed to:
```text
/usr/lib/cups/filter/rastertokpsl