Re: [HACKERS] acl problem in NetBSD/m68k

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] acl problem in NetBSD/m68k
Дата
Msg-id 19251.930631563@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] acl problem in NetBSD/m68k  (Tatsuo Ishii <t-ishii@sra.co.jp>)
Ответы Re: [HACKERS] acl problem in NetBSD/m68k  (Bruce Momjian <maillist@candle.pha.pa.us>)
Список pgsql-hackers
Tatsuo Ishii <t-ishii@sra.co.jp> writes:
>> I do not like this patch at *all*.  Why is sizeof(AclItem) not the
>> correct thing to use?

> In NetBSD/m68k sizeof(AclItem) = 6, not 8.

Oh, I see: the struct contains int32, uint8, uint8, and so it will
be padded to a multiple of int32's alignment requirement --- which
is 4 most places but only 2 on m68k.

>> Perhaps the real problem is that the AclItem struct definition needs
>> modification?  Or maybe we need a way to put a machine-dependent size
>> into the pg_type entry for type aclitem?  The latter seems like a
>> good thing to be able to do on general principles.
>
> Glad to hear you have better idea. Anyway, NetBSD/m68k users need some 
> way to fix the problem now, since the problem seems very serious.

There are two ways we could attack this: (1) put a "pad" field into
struct AclItem (prolly two uint8s) to try to ensure that compilers
would think it is 8 bytes long, or (2) make the size field for aclitem
in pg_type.h read "sizeof(AclItem)".  I think the latter is a better
long-term solution, because it eliminates having to try to guess
what a compiler will do with a struct declaration.  But there are
several possible counterarguments:

* It might require patching the scripts that read pg_type.h --- I
am not sure if they'd work unmodified.

* We'd either need to #include acl.h into pg_type.h or push the
declarations for AclItem into some more-widely-used header.

* In theory this would represent an initdb change and couldn't
be applied before 6.6.  In practice, Postgres isn't working right
now on any platform where sizeof(AclItem) != 8, so initdb would
*not* be needed for any working installation.

I don't think any of these counterarguments is a big deal, but
maybe someone else will have a different opinion.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] 6.5.1 status
Следующее
От: Tatsuo Ishii
Дата:
Сообщение: Re: [HACKERS] acl problem in NetBSD/m68k