rastertoepson never sends ESC { A for the Oki drivers: nickname test looks for "OKIDATA"
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 86/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Área
- operating-systems
Línea de trabajo
Empieza por StartPage() en filter/rastertoepson.c y los apodos de Oki en ppdc/sample.drv. Ejecuta el repro.py proporcionado con el rastertoepson local para confirmar que la salida de Oki no contiene ESC { A; terminado significa que la salida de Oki comienza con ese comando y ya no coincide con el controlador Epson.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
The Oki 9-pin driver (drv:///sample.drv/okidata9.ppd, and okidat24.ppd) never sends ESC { A, the Oki command that selects Epson emulation, so its output is byte for byte the Epson driver's, and an Oki printer not already set to Epson emulation does not get switched.
Cause
StartPage() in filter/rastertoepson.c (master at 4fb4b58, line 145) sends it only when the PPD's nickname contains "OKIDATA":
if (ppd && ppd->nickname && strstr(ppd->nickname, "OKIDATA") != NULL)
printf("\033{A");
but ppdc/sample.drv gives these drivers the nicknames "Oki 9-Pin Series" and "Oki 24-Pin Series", so the test never matches.
To Reproduce
With CUPS and Python 3, the script below prints a page through okidata9.ppd and epson9.ppd:
okidata9 output starts: 1b 40 1b 50 12 1b (ESC { A would be 1b 7b 41)
okidata9 output identical to epson9: True
The same output comes from macOS's CUPS 2.3.4 filter and from filter/rastertoepson.c at master (4fb4b58), built against the system libcups.
repro.py
"""Reproduce two rastertoepson bugs with CUPS's own sample drivers.
Usage: python3 repro.py [path/to/rastertoepson]
Prints a page filled with black through the Epson 9-pin driver at
60x72dpi on Letter, and through the Oki 9-pin driver.
"""
import os
import struct
import subprocess
import sys
from pathlib import Path
serverbin = Path(subprocess.run(["cups-config", "--serverbin"], capture_output=True,
text=True, check=True).stdout.strip())
rastertoepson = sys.argv[1] if len(sys.argv) > 1 else str(serverbin / "filter" / "rastertoepson")
# A US Letter PDF filled with black.
content = b"0 0 612 792 re f"
objects = [
b"<< /Type /Catalog /Pages 2 0 R >>",
b"<< /Type /Pages /Kids [3 0 R] /Count 1 >>",
b"<< /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 4 0 R >>",
b"<< /Length %d >>\nstream\n%s\nendstream" % (len(content), content),
]
pdf = bytearray(b"%PDF-1.4\n")
offsets = []
for number, body in enumerate(objects, 1):
offsets.append(len(pdf))
pdf += b"%d 0 obj\n%s\nendobj\n" % (number, body)
xref = len(pdf)
pdf += b"xref\n0 %d\n0000000000 65535 f \n" % (len(objects) + 1)
pdf += b"".join(b"%010d 00000 n \n" % o for o in offsets)
pdf += b"trailer\n<< /Size %d /Root 1 0 R >>\nstartxref\n%d\n%%%%EOF\n" % (len(objects) + 1, xref)
Path("black.pdf").write_bytes(pdf)
def run(ppd_name, resolution):
ppd = subprocess.run([str(serverbin / "daemon" / "cups-driverd"), "cat",
f"drv:///sample.drv/{ppd_name}.ppd"],
capture_output=True, check=True).stdout
Path(f"{ppd_name}.ppd").write_bytes(ppd)
options = ["-o", "PageSize=Letter", "-o", f"Resolution={resolution}"]
raster = subprocess.run(["cupsfilter", "-p", f"{ppd_name}.ppd", "-m",
"application/vnd.cups-raster", *options, "black.pdf"],
capture_output=True, check=True).stdout
Path(f"{ppd_name}.ras").write_bytes(raster)
out = subprocess.run([rastertoepson, "1", "user", "title", "1", "", f"{ppd_name}.ras"],
capture_output=True, check=True,
env={**os.environ, "PPD": f"{ppd_name}.ppd"}).stdout
return raster, out
# Bug 1: the last band of a page is dropped when it holds fewer than 8 rows.
raster, out = run("epson9", "60x72dpi")
order = ">" if raster[:4] in (b"RaS2", b"RaS3") else "<"
height = struct.unpack_from(order + "I", raster, 4 + 376)[0]
images, i = [], 0
while (i := out.find(b"\x1b*", i)) >= 0: # ESC * m nL nH data
n = out[i + 3] | out[i + 4] << 8
images.append(out[i + 5 : i + 5 + n])
i += 5 + n
print(f"raster rows: {height} = {height // 8} bands of 8 + {height % 8} rows")
print(f"bit images sent: {len(images)}")
print(f"dots in the last image: {sorted(set(images[-1]))[:4]} (0xFF is all 8 pins)")
print(f"rows printed: {8 * len(images)}, rows lost: {height - 8 * len(images)}")
# Bug 2: the Oki driver never selects Epson emulation.
_, oki = run("okidata9", "120x72dpi")
_, epson = run("epson9", "120x72dpi")
print(f"\nokidata9 output starts: {oki[:6].hex(' ')} (ESC {{ A would be 1b 7b 41)")
print(f"okidata9 output identical to epson9: {oki == epson}")
(The script also reproduces #1843, a separate bug in the same filter.)
Expected behavior
The Oki drivers' output begins with ESC { A, for instance by matching the nickname's "Oki" or by marking the Oki models in sample.drv.
System Information:
- OS: macOS 14.6 (CUPS 2.3.4); the code is unchanged at master
- Lenguaje dominante
- C
- Estrellas
- 1.8k
- Forks
- 373
- Merge medio
- 1 d 11 h
- PR fusionados (30 d)
- 9
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de OpenPrinting/cups
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
OpenPrinting/cups#1843 ·
Los mantenedores suelen responder en 1 día
-
OAuth (bearer) quota check denies every user when the allowed-user list is emptyPosiblemente ocupada @RonitMehta08 la tomó hace 16 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
OpenPrinting/cups#1795 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
cupsdGetPrivateAttrs: @ACL never grants access, and @OWNER is looked up as an operating-system group for non-ownersPosiblemente ocupada @user-Param la tomó hace 23 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
OpenPrinting/cups#1796 ·
Los mantenedores suelen responder en 1 día
-
OAuth/OIDC token-validation gaps: nonce not enforced when absent, at_hash alg, inbound bearer not signature/aud/exp-validated + unverified email used for authzQuizá libre de nuevo @michaelrsweet la tomó hace 161 días y no hay ningún pull request abierto. Abiertoinvestigating
OpenPrinting/cups#1609 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
OpenPrinting/cups#1572 ·
Los mantenedores suelen responder en 1 día
Todos los issues de OpenPrinting/cups
Issues similares
-
CF_CFDP_S_SendFileData computes the file checksum from the SB buffer after CFE_SB_TransmitBufferAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
389ds/389-ds-base#8251 ·
Los mantenedores suelen responder en 1 día
-
bug data-types
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
ClickHouse/clickhouse-cpp#645 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día