🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Bug#1152243: graphviz: gvpr incorrect iteration for arrays indexed by double

#2331
From: Trevor Stone
Date: Tue, 27 Oct 2026 03:40
92 lines
4751 bytes
Package: graphviz
Version: 2.42.4-3
Severity: normal
X-Debbugs-Cc: debian@trevorstone.org

Dear Maintainer,

The gvpr(1) graphviz scripting language treats arrays as a key-value
data structure.  The for loop iterates over an array's indices in
numeric order, while the forr loop iterates in lexicographic order.
The man page says "This can be used for sorting."

When iterating through an array with double indices, Debian trixie's
gvpr can skip entries and pair mismatched keys and values.
This script should print the first five US presidents in order:

    #!/usr/bin/env -S gvpr -f
    BEGIN {
      string presidents[double];
      presidents[1.1] = "Washington";
      presidents[2.1] = "Adams";
      presidents[3.1] = "Jefferson";
      presidents[4.1] = "Madison";
      presidents[5.1] = "Monroe";
      double i;
      for (presidents[i]) {
        printf("President %f was %s\n", i, presidents[i]);
      }
    }

Instead, it prints only three keys, out of order.  Further, it prints
key 4.1 with the fifth value (Monroe instead of Madison) and key 2.1
with the third value (Jefferson instead of Adams):

    President 4.100000 was Monroe
    President 1.100000 was Washington
    President 2.100000 was Jefferson

If the keys are changed to 1.0, 2.0, 3.0, 4.0, and 5.0 then it only
prints one row, with the wrong key-value pair:

    President 1.000000 was Monroe

The output is the same if the variables are declared "float" rather than
"double".  It's possible this is related to incorrect handling of 64-bit
integers in bug #1152240.

The program produces the expected output in Ubuntu 24.04 grapvis version
2.42.2-9ubuntu0.1.  I didn't run this program before upgrading from
bookworm, but I do have a program which now gets incorrect array
iteration for double indexes:
https://github.com/flwyd/adventofcode/blob/main/2025/day8/day8.gv
Run as 2025/day8/day8.gv -v 2025/day8/input.example.txt

-- System Information:
Debian Release: 13.7
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.6.143-09589-gf9e106250941 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages graphviz depends on:
ii  libann0          1.1.2+doc-9+b1
ii  libc6            2.41-12+deb13u4
ii  libcdt5          2.42.4-3
ii  libcgraph6       2.42.4-3
ii  libexpat1        2.8.3-1~deb13u1
ii  libgcc-s1        14.2.0-19
ii  libgd3           2.3.3-14~deb13u1
ii  libglib2.0-0t64  2.84.4-3~deb13u5
ii  libgts-0.7-5t64  0.7.6+darcs121130-5.2+b1
ii  libgvc6          2.42.4-3
ii  libgvpr2         2.42.4-3
ii  liblab-gamut1    2.42.4-3
ii  libstdc++6       14.2.0-19
ii  libx11-6         2:1.8.12-1
ii  libxaw7          2:1.0.16-1
ii  libxmu6          2:1.1.3-3+b4
ii  libxt6t64        1:1.2.1-1.2+b2

Versions of packages graphviz recommends:
ii  fonts-liberation  1:2.1.5-3

Versions of packages graphviz suggests:
ii  graphviz-doc  2.42.4-3
pn  gsfonts       <none>

-- no debconf information
Technical Details
Message-ID: <NSGcx-885y-1@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.corradoroberto.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!news.corradoroberto.it!bofh.it!news.nic.it!robomod
From: Trevor Stone <debian@trevorstone.org>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1152243: graphviz: gvpr incorrect iteration for arrays indexed by double
Date: Tue, 27 Oct 2026 04:40:01 +0100
Message-ID: <NSGcx-885y-1@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  Tue Oct 27 03:33:08 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -1.65
Reply-To: Trevor Stone <debian@trevorstone.org>, 1152243@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: debian@trevorstone.org, gcs@debian.org
X-Debian-Pr-Message: report 1152243
X-Debian-Pr-Package: graphviz
X-Debian-Pr-Source: graphviz
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Mailer: reportbug 13.2.0
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/1999127
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 92
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Mon, 26 Oct 2026 21:30:50 -0600
X-Original-Message-ID: <179307185003.128714.5360764818866831884.reportbug@localhost>