[Scons-dev] Contribution to SCons development.

Gary Oberbrunner garyo at oberbrunner.com
Sat Dec 6 07:28:34 EST 2014


On Sat, Dec 6, 2014 at 4:35 AM, Shreedhar Manek <shreedharmanek at gmail.com>
wrote:

>
>>> I change the integer the equivalent string in chmod.py (eg. 0444
>>> to S_IRWXU and S_IRWXG and S_IRWXO) but there is problem ahead into the
>>> program and the test fails at this point -
>>>
>>
>> Watch out, 0444 is not the same as  S_IRWXU and S_IRWXG and S_IRWXO,
>> which would be 0000 because of the "and"s. 0444 is S_IRUSR or S_IRGRP or
>> S_IROTH.
>>
>>>
>>>
> Ah, of course. Thanks!
>
>
>
>> s = S_IMODE(os.stat(test.workpath('f1'))[ST_MODE])
>>> test.fail_test(s != 0444)
>>>
>>> What do I do about this?
>>>
>>
>> How does it fail?  What is the value of s at that point?
>>
>
> The value of s at that point in decimal is 256. I cannot figure why
> though, as the only change that I've made is switching 0444 by S_IRUSR or
> S_IRGRP or S_IROTH.
>
> 256 is octal 0400, so it looks like it's only getting the S_IRUSR part.
And that's because I steered you wrong; these are bitmasks, so you have to
use bitwise OR:  S_IRUSR | S_IRGRP | S_IROTH

-- 
Gary
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/scons-dev/attachments/20141206/55b7df55/attachment.html>


More information about the Scons-dev mailing list