[PATCH] umount: always use umount2 syscall with specified flags

Jody Bruchon jody at jodybruchon.com
Tue Oct 13 11:00:53 UTC 2015


I agree. There is no good reason for doing this at all. It looks like someone has intentionally obfuscated the code. If it's for throwing an error on invalid configurations, other constructs exist that are much more clear and are better supported.

This is arguably a prime example of a poor coding practice (being clever is almost always a future maintainability nightmare) and should not be accepted into BusyBox without being rewritten in a maintainable way, including detailed comments explaining why and how it does what it does.

Jody Bruchon

On October 13, 2015 6:23:46 AM EST, walter harms <wharms at bfs.de> wrote:
>maybe that is a clever solution,
>but it causes the code to be unreadable.
>(read:no chance to understand before unterstanding
> this typedef and its consequences)
>
>
>just my 2 cents,
>
>re,
> wh
>
>Am 05.10.2015 19:04, schrieb Denys Vlasenko:
>> On Sat, Oct 3, 2015 at 12:58 PM, Xabier Oneca  --  xOneca
>> <xoneca at gmail.com> wrote:
>>> Hello,
>>>
>>> Excuse my ignorance, but what does this typedef do?
>>>
>>> ------------------
>>>     {
>>>         typedef char bug[
>>>             (OPT_FORCE != MNT_FORCE || OPT_LAZY != MNT_DETACH) ? -1
>: 1
>>>         ];
>>>     }
>>> ------------------
>>>
>>> My understanding is that this snippet catches when those two
>constants
>>> are not equal and then trigger a compiler error by defining a
>char[-1]
>>> type. Am I correct? If so, why isn't used the preprocessor #errror
>>> with a less cryptic error description?
>> 
>> Constants like MNT_FORCE may be enums, not literals.
>> Preprocessor can't evaluate enums.
>> _______________________________________________
>> busybox mailing list
>> busybox at busybox.net
>> http://lists.busybox.net/mailman/listinfo/busybox
>> 
>_______________________________________________
>busybox mailing list
>busybox at busybox.net
>http://lists.busybox.net/mailman/listinfo/busybox

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.


More information about the busybox mailing list