HACKER Q&A
📣 justin_oaks

What unexpected behaviors persist in software you use?


I just got bitten by a problem in AWS CLI where S3 files won't sync when you expect them to: https://github.com/aws/aws-cli/issues/3273

This got me thinking. What are the major unexpected behaviors, or "gotchas", exist in the software you use?

Where do you see the "Principle of Least Astonishment" violated? https://en.wikipedia.org/wiki/Principle_of_least_astonishment

I think we may all benefit from sharing with each other. Hopefully it'll save some of us from being bitten by odd software behavior.

I'm referring to tools, programming languages, database and server software, etc. I think it would be really useful to raise awareness of these issues.


  👤 PaulHoule Accepted Answer ✓
Most programs that imitate the Microsoft word interface for setting Bold/Italic/Underscore and similar text attributes behave erratically in some cases. For instance the selection seems to be possessed by the devil and wants to either miss the first letter of a word or include the space on one side around it.

This includes Microsoft Word but is particularly bad with WYSIWYG HTML editors


👤 jjgreen
A Python 3.5 datetime.time of midnight was False, all other times were True.

[edit: was False, fixed in 3.6]


👤 zaphar
I'm not sure if this qualifies but focus stealing by a window is a feature that all operating systems and applications seem to support and it still angers me every single time it happens.

👤 justin_oaks
Off the top of my head:

MySQL:

* group_concat function truncates without error. You usually have to set the group_concat_max_len variable to something long enough that any data you return will never get truncated.

* "Cascaded foreign key actions do not activate triggers". In other words, a delete trigger won't be run if the delete happens from a cascade delete. See https://dev.mysql.com/doc/refman/8.0/en/create-table-foreign...

* (Prior to MySQL 8.0.16) Check constraints were allowed in CREATE TABLE statements but they did nothing. Ideally, specifying a check constraint would trigger an error if it wasn't going to be applied.

Java:

* (This hits beginners mostly) Comparison of String objects with == doesn't compare the contents of the strings.

* SimpleDateFormat is not thread safe, so you can't (or at least shouldn't) assign an instance of it to a static variable.

* The differences in behavior between primitives and Objects. For example, copy-by-value vs copy-by-reference.

Javascript:

* Many implicit type conversions are unexpected. See https://www.destroyallsoftware.com/talks/wat

* The == operator can return true for variables of different types. For example ""==false returns true.

Docker:

* Setting the ENTRYPOINT in your Dockerfile will reset CMD from the parent image. This behavior was implemented in response to https://github.com/moby/moby/issues/5147

* If a container has files where an empty volume is attached, then Docker will copy the data from the container to the volume. This copy doesn't occur for bind mounts, or volumes with data in them. This just seems inconsisent.

Oracle Database:

* Empty strings are indistinguishable from NULL.

Python:

* A datetime.datetime object doesn't include a timezone by default.

NGINX

* Inheritance differs between types of configuration directives. For example, array directives are overwritten instead of merged in lower contexts. This explains it pretty well: https://blog.martinfjordvald.com/understanding-the-nginx-con...

* Behavior of `if` blocks. See https://www.nginx.com/resources/wiki/start/topics/depth/ifis...

Apache HTTPD:

* If you have authorization directives in both Directory and Location sections, you'll need to explicitly specify "AuthMerging And" in Location otherwise the Directory restrictions will be overridden by whatever is in Location. Directory restrictions are sometimes set to ensure that sensitive directories are never accessed. See https://httpd.apache.org/docs/2.4/mod/mod_authz_core.html#au...

(Edit: HN formatting is a pain)