🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.bugs.dist
Article #3898

Bug#1153520: libsynctex2: Debug output "Negative width" on stdout breaks pdf-tools inverse search

#3898
From: Sven Kockrick
Date: Mon, 09 Nov 2026 13:40
145 lines
6017 bytes
This is a multi-part MIME message sent by reportbug.


--===============7043957976364495843==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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

--===============7043957976364495843==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="remove-negative-width-debug.patch"

--- 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 {

--===============7043957976364495843==--
Technical Details
Message-ID: <NXxLj-aP1f-7@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!3.eu.feeder.erje.net!feeder.erje.net!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!3.eu.feeder.erje.net!feeder.erje.net!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
From: Sven Kockrick <sven.kockrick@posteo.de>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1153520: libsynctex2: Debug output "Negative width" on stdout breaks pdf-tools inverse search
Date: Mon, 09 Nov 2026 14:40:01 +0100
Message-ID: <NXxLj-aP1f-7@gated-at.bofh.it>
X-Original-To: Debian Bug Tracking System <submit@bugs.debian.org>
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Mon Nov  9 13:39:09 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -1.45
Reply-To: Sven Kockrick <sven.kockrick@posteo.de>, 1153520@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: debian-tex-maint@lists.debian.org
X-Debian-Pr-Message: report 1153520
X-Debian-Pr-Package: libsynctex2
X-Debian-Pr-Source: texlive-bin
Content-Type: multipart/mixed; boundary="===============7043957976364495843=="
MIME-Version: 1.0
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2001666
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 145
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Mon, 09 Nov 2026 13:37:43 +0000
X-Original-Message-ID: <179423146281.1482923.2451969184026895243.reportbug@remy.irrsal-und-wirrsal.de>