pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/58717: wm/cde crashes in ttsession during startup on sparc64



I think originally, many Unix systems used long integer for uid_t and
gid_t, however this results in different size on LP64 systems. See
https://docs.oracle.com/cd/E18752_01/html/816-5138/appendixa-1.html

Ideally they should have used fixed width integers, but the original
implementation probably predates that version of C standard. I'm not
aware of any platforms using full 64-bits for uid_t and gid_t. So even
if those are defined as 64-bit integers, they should always contain
values <= UINT32_MAX. So casting this from 64-bit to 32-bit should be
safe and should not result in data loss. Now if this assumption is
wrong, then using sizeof() for each type would be a better solution.

I'm not sure there is a standard definition for uid_t, gid_t and
mode_t. So these could be defined as signed or unsigned. Also I'm not
sure if there is a difference in behavior between xdr_int() and
xdr_u_int(), but it feels that using the unsigned conversion is
probably safer and may avoid sign extension bugs.


Home | Main Index | Thread Index | Old Index