Voelker, Bernhard wrote:
> Jim Meyering wrote
>> I'm beginning to think there's a fundamental problem with your system.
>> Here's the comparable part of truss output on a working Solaris 10
> system:
> ...
>> Remember, you did not compile with gcc.
>>
>> Unless someone can suggest an alternative explanation,
>> I'll have to assume this is not a problem with coreutils.
>
> I got one last input for this case:
>
> CC ginstall-install.o
> "install.c", line 191: warning: initializer does not fit or is out of
> range: -61952
>
> Code:
>
> 187 /* Return true for mode with non-permission bits. */
> 188 static bool
> 189 extra_mode (mode_t input)
> 190 {
> 191 const mode_t mask = ~S_IRWXUGO & ~S_IFMT;
> 192 return input & mask;
> 193 }
>
> This line is expanded to this code by the preprocessor:
>
> const mode_t mask = ~ ( 00700 | 00070 | 00007 ) & ~ 0xF000 ;
>
> mode_t is unsigned long on my system.
>
> I added this test print:
>
> fprintf(stderr, "extra_mode(%ld) -> %ld\n", input, input & mask);
>
> which leads to
>
> $ ./ginstall -Cv -m$mode3 a b
> extra_mode(1517) -> 1024
> extra_mode(1517) -> 1024
> extra_mode(33184) -> 0
> extra_mode(34285) -> 1024
>
> Can this be the reason?
Thanks.
Those details have helped me see the light.
I suspect this patch works around your compiler's
inadequate "bool" support:
diff --git a/src/install.c b/src/install.c
index 73b3981..19efb1d 100644
--- a/src/install.c
+++ b/src/install.c
@@ -189,7 +189,7 @@ static bool
extra_mode (mode_t input)
{
const mode_t mask = ~S_IRWXUGO & ~S_IFMT;
- return input & mask;
+ return !! (input & mask);
}
/* Return true if copy of file SRC_NAME to file DEST_NAME is necessary. */