Re: Escape output of pg_amcheck test

Mark Dilger <hornschnorter@gmail.com>

From: Mark Dilger <hornschnorter@gmail.com>
To: Peter Eisentraut <peter@eisentraut.org>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2024-01-08T13:41:02Z
Lists: pgsql-hackers

On 1/7/24 23:27, Peter Eisentraut wrote:
> The pg_amcheck reports a skip message if the layout of the index does 
> not match expectations.  That message includes the bytes that were 
> expected and the ones that were found.  But the found ones are arbitrary 
> bytes, which can have funny effects on the terminal when they are 
> printed.  To avoid that, escape non-word characters before printing.

> +			# escape non-word characters to avoid confusing the terminal
> +			$b =~ s{(\W)}{ sprintf '\x%02x', ord($1) }aegr);

The /r modifier defeats the purpose of the patch, at least for my perl 
version, perl 5, version 28, subversion 1 (v5.28.1).  With just the /aeg 
modifier, it works fine.

-- 
Mark Dilger



Commits

  1. Escape output of pg_amcheck test