Progress? We're not making any progress! or Are We There Yet? A common need in programs is the need to display the progress of an operation. Displaying progress can tell the user: the program is still alive; what percentage done the program is; when the activity might complete. Another type of report commonly, but incorrectly, called "progress" is the spinning wheel. A similar one is the "Cylon" activity bar. Such indicators would more properly be called "activity indicators". These are not covered in this post. Progress can be defined: "forward or onward movement toward a destination". An activity indicator does not, and cannot, indicate progress, because it does not indicate that "forward" or "onward" movement is being made! Thus, for a file transfer, a beep every second doesn't indicate progress, but a beep every 1024 bytes of data transferred would indicate progress (although po...
The #IAmRoot flaw The recent "I Am Root" bug in MacOS (#1) brings to mind two of my favorite topics: functional results, and function naming. (Although this post is C-oriented, the concepts apply to any programming language.) The bug: In some circumstances, perhaps a few less than many news report implied, a non-privileged user could obtain root access on Macs running the HighSierra version of macOS. An analysis from http://www.theregister.co.uk/2017/11/29/apple_macos_high_sierra_root_bug_patch reads, in part: ... the security daemon opendirectoryd calls an internal function called odm_RecordVerifyPassword . ... Seeing as that shadow hash lookup failed, opendirectoryd next tries to retrieve and check a crypt password for the account using od_verify_crypt_password . Weirdly, that function returns the value 0x1, signaling it was successful, and rather than bail out and deny access, the code falls through to function calls that upgrade th...