3 ms·
> Yesterday's post about "pipefail" also involved some systems which treated an empty file as a valid file. This turns out to be surprisingly common. I don't u
by Wowfunhappy 5y ago
> Yesterday's post about "pipefail" also involved some systems which treated an empty file as a valid file. This turns out to be surprisingly common.
I don't understand why this is surprising. Of course an empty file is a valid file, just like an empty piece of paper is a valid piece of paper.
I mean, yes, a piece of paper is also different. Paper is a physical object with volume and weight; a file is a sequence of bytes representing information. But, step out of your programmer mindset for a moment. Almost every user interface represents files as objects containing information, not information itself.
- dataflow 5y agoI think she meant "an empty file is a valid file to some programs that should ostensibly expect otherwise", but worded in a way that ends up being confusing.
- wvenable 5y agoI think the implication isn't merely "valid file" but rather it's "valid file of a particular type". The example given is that an empty file is a valid executable. It might also be a valid CSV file but not a valid Excel file.
- Wowfunhappy 5y agoThanks, yes, that makes much more sense!
- floodle 5y agoI know what you mean, I also took a double-take when I read that sentence. But when I read a bit further I decided it was just poor phrasing initially.
- AnimalMuppet 5y agoOK, but this is about an empty file being a valid program file (though the title doesn't make that clear). I mean, an empty sheet of paper is also a valid list of instructions, but that's at least slightly weirder than it being a valid sheet of paper.
- anyfoo 5y agoYeah, and an empty sheet of paper is not a valid diploma for example, or a valid banknote. Pretty clear from context.
- RhysU 5y agoZero is a valuable concept. It's a diploma for no degree from nowhere or a banknote worth no value. You can spot a lot of mistakes by asking code to compute with a 0-by-0 matrix or to write zero rows of data. For example, the matrix case was fixed in the GSL in 2017: https://git.savannah.gnu.org/cgit/gsl.git/tree/matrix/ChangeLog https://git.savannah.gnu.org/cgit/gsl.git/tree/matrix/Change.... In $DAYJOB I have seen multiple generations of systems get the no rows edge case wrong in the API design. Zero goes back fewer millenia than one might think: https://en.wikipedia.org/wiki/0 https://en.wikipedia.org/wiki/0
- anyfoo 5y agoYes, I know of the value of zero (and not just because I studied theory/math heavy fields in uni). Does not change that this does not always apply. Having no piece of paper is valid as "no PhD", but an empty piece of paper is not a valid PhD. In the same sense, an empty piece of paper is also not a "$0 banknote", it's not a banknote, period. It is true that in many cases, empty files are valid for their context (e.g. CSV, plain text files, shell scripts), in many other cases, they are not (e.g. any file format at all that requires a magic number in a header or footer, which is many many file formats). Try to open these in those contexts, and you would usually get an error, for example: "You told me this was supposed to be a JPEG, but this file does not start with ff d8 ff e0 [Trivially true for an empty file! No, files are not equivalent to sets in the Zermelo-Fraenkel sense!] What is wrong with you?" I don't get the discussion here. This is all obvious, and it was obvious in the original sentence from context.
- lmkg 5y agoI mean, if we want to run with the man analogies... The empty set is a valid set. Perfectly reasonable, and completely necessary in many cases. But the empty Group is not a valid Group. A Group requires an identity element, which means non-empty. The smallest valid Group, the Trivial Group, still requires an element. I would argue a diploma or a banknote resemble a Group more than a Set. There are required elements, such as an issuing institution.