Re: Patch to allow pg_filedump to support reading of pg_filenode.map

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Richard Yen <richyen3(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, myon(at)debian(dot)org
Subject: Re: Patch to allow pg_filedump to support reading of pg_filenode.map
Date: 2021-04-29 04:42:31
Message-ID: 20210429044231.GH27406@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

This is separate from the postgresql server repo.
https://git.postgresql.org/gitweb/?p=pg_filedump.git

+#define RELMAPPER_FILEMAGIC 0x592717
+char magic_buffer[8];

...

+ if ( (int) magic_buffer & RELMAPPER_FILEMAGIC ) {

This is doing bitwise arithmetic on a pointer, which seems badly wrong.
I think it breaks normal use of pg_filedump - unless you happen to get a
magic_buffer without those bits set. The segfault seems to confirm that, as
does gcc:

pg_filedump.c:2041:8: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
2041 | if ( (int) magic_buffer & RELMAPPER_FILEMAGIC ) {

I think it probably means to do memcmp, instead ??

--
Justin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2021-04-29 05:06:05 Re: pg_hba.conf.sample wording improvement
Previous Message Thomas Munro 2021-04-29 04:27:36 Re: WIP: WAL prefetch (another approach)