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

Re: [MiNT] STAT bits - Ouch!



On Wed, 2010-12-08 at 19:12 +0100, Konrad Kokoszkiewicz wrote:
> >> Could you give an example, why a program must stick to fixed values and
> >> cannot use the defined masks, like S_IFDIR, and macros, like S_ISDIR()?
> >
> > Look at the python code, and git is the examples. There are applications
> > out there that assume the values are consistent, and ignore the macros.
> 
> Since this assumption is wrong, then it looks like a bug in python, which 
> should be reported to the python developers or fixed and committed to the 
> main source. Same with the other program you mention.
> 
> The bug (if it is a bug) doesn't show up because other unixoids use pretty 
> the same values, but still it is a bug.

Oh, and the other nice thing is this in our own code for ext2....

# if EXT2_IFSOCK != S_IFSOCK
                if (EXT2_ISSOCK (mode))
                {
                        ptr->mode &= ~EXT2_IFSOCK;
                        ptr->mode |= S_IFSOCK;
                }
# endif

The above is because if you bring in a filesystem from another Linux
machine that uses EXT2 we have to do conversion. Yuck.

It makes sense to move to this "defacto" standard.

Alan.