Package: libsynctex2
Version: 2026.20260303.78225+ds-5
Severity: normal

Dear Maintainer,

The SyncTeX parser library writes the diagnostic message "Negative width"
directly to stdout when parsing certain valid SyncTeX files.

This breaks applications that use stdout for communication, notably the
epdfinfo server used by Emacs pdf-tools.

Observed behaviour:
-------------------

When performing inverse search (Ctrl+left mouse button) in Emacs pdf-tools,
the operation fails with:

pdf-info-query: epdfinfo: Invalid server response

The pdf-tools communication log shows numerous "Negative width" messages
instead of the expected server response.

The problem can also be reproduced independently of Emacs:

synctex edit -o 3:200:500:testfile.pdf

This prints 61 lines containing "Negative width" before returning valid
SyncTeX results.

The same behaviour occurs with an older, unchanged PDF/SyncTeX pair generated
in April 2025 (64 messages).

The independent PDF viewer Atril also produces the messages. Both Atril and
epdfinfo link against Debian's libsynctex.so.2.

Redirecting stdout and stderr separately confirms that all 61 messages appear
on stdout, none on stderr.

Tracing epdfinfo with strace confirms:

write(1, "Negative width\nNegative width\n...", 1056) = 1056

Cause:
------

The diagnostic output originates from:

texk/web2c/synctexdir/synctex_parser.c

At approximately line 5479:

if (_synctex_data_width(ns.node)<0) {
    printf("Negative width\n");
}

This occurs after _synctex_parse_new_void_hbox(scanner) succeeds.

Negative box widths are not necessarily invalid. The parser continues
processing the nodes normally after printing this message.

Tested fix:
-----------

I removed the three lines containing the conditional diagnostic output,
leaving the actual node processing unchanged.

I compiled a replacement libsynctex.so.2 from the Debian source package and
tested it with the affected documents.

Results:
--------

Atril no longer prints the "Negative width" messages.

Emacs pdf-tools inverse search works again, including the correct source
location.

No changes to the LaTeX source documents or the pdf-tools implementation were
necessary.

The change is therefore limited to suppressing this diagnostic output.

I suggest removing the debugging statement or, at minimum, redirecting
diagnostic messages to stderr rather than stdout.

The same issue is present in the standalone SyncTeX utility distributed with
upstream TeX Live 2026, so this may also need to be forwarded upstream.

Kind regards


-- System Information:
Debian Release: forky/sid
  APT prefers stable-security
  APT policy: (950, 'stable-security'), (900, 'testing'), (500, 
'stable-updates'), (500, 'stable'), (50, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 7.2.15+deb14-amd64 (SMP w/4 CPU threads; PREEMPT)
Kernel taint flags: TAINT_WARN
Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8), 
LANGUAGE=de_DE.utf8
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libsynctex2 depends on:
ii  libc6   2.43-7
ii  zlib1g  1:1.3.dfsg+really1.3.2-4

libsynctex2 recommends no packages.

libsynctex2 suggests no packages.

-- no debconf information
--- a/texk/web2c/synctexdir/synctex_parser.c
+++ b/texk/web2c/synctexdir/synctex_parser.c
@@ -5476,9 +5476,6 @@
 #   endif
             ns = _synctex_parse_new_void_hbox(scanner);
             if (ns.status == SYNCTEX_STATUS_OK) {
-                if (_synctex_data_width(ns.node)<0) {
-                    printf("Negative width\n");
-                }
                 if (child) {
                     _synctex_node_set_sibling(child,ns.node);
                 } else {

Reply via email to