The amount of things allowed by ISO 8601 is even more than what’s allowed by RFC 3339, if you take the time to look at ijmacd.github.io/rfc3339-iso8601/
On the command line, space is what separates each argument. If a path contains a space, you either have to quote the entire path, or use an escape character (e.g. the `` character in most shells, the backtick in Powershell because Microsoft is weird, or the character’s hexadecimal value), otherwise the path will be passed to the command as separate arguments. For example, cat hello world.txt would try to print the files hello and world.txt.
It is a good practice to minimize the character set used by filenames, and best to only use English alphanumeric characters and certain symbols like -, _, and .. Non-printable characters (like the lower half of ASCII), weird diacritics (like ő or ű), ligatures, or any characters that could be misinterpreted by a program should be avoided.
This is why byte-safe encodings, like base64 or percent-encoding, are important. Transmitting data directly as text runs the risk of mangling the characters because some program misinterpreted them.
but what does the command line matter for dates? sure every once in a while you’ll have to pass a date as an argument on the command line but I think usually that kind of data is handled by APIs without human intervention, so once these are set up properly, I don’t see the problem
<span style="color:#323232;">rsync -a "somedir" "somedir_backup_$(date)"
</span>
If the date command returns an RFC-3339-formatted string, the filename will contain a space. If, for example, you want to iterate over the files using for d in $(find…) and forget to set $IFS properly, it can cause issues.
But $(date) does return a string with spaces, at least on every system I’ve ever used. And what’s so bad about the possibility of spaces in filenames? They’re slightly inconvenient in a command line, but I haven’t used a commuter this century that didn’t support spaces in filenames.
Ok, I just reread it. I don’t see what you think I’m missing. You mean an improperly written find command misbehaving? The fact that a different date format could prevent a bug from manifesting doesn’t seem like much of an argument.
Spaces can exist in filenames. The only problem is that they have to be escaped. As the comment that you reread explained, cat hello world.txt would print the files hello and world.txt. If you wanted to print the file “hello world.txt” you’d either need to quote it (cat “hello world.txt”) or escape the space (cat hello world.txt)
Yeah? I once spent an entire week debugging a plaintext database because the software expected the record identifiers to be tokenized a certain way, but the original data source had spaces in those strings.
The software was the ISC DHCP server, the industry standard for decades and only EOL’d a year ago.
Sounds like a weekend that you could have saved if the software was just implemented properly and accepted spaces.
Something being an industry standard does not necessarily mean it’s good. Sometimes it just means it was the cheapest, or sometimes even just because it was used for so long. How long did it take for Torx to somewhat replace philips head screws despite being better in most cases?
I think date strings are made for human and machine readability. Similar to XML or JSON. So, why not improve systems so that we can have more human readable date strings? If you don’t care about human readability and want to make sure there is no confusion with spaces, you can just use epoch timestamps.
I’m not exactly fond of the space either, but man, the T is noisy. They could’ve gone with an underscore or something, so it actually looks like two different sections.
This is about the old argument around how date strings are formatted.
MMDDYYYY vs YYYYMMDD, spaces or hyphens may differ. It’s an old and passionate argument (mostly due to the American approach of starting with the month being insane)
That’s a certain kind of skill I wouldn’t want the need to have. I just copy paste those timestamps into a terminal with date -d @ (and always forget the right syntax for that :D)
ISO standards need to be purchased to be viewed, RFCs are freely available requests for comment. The RFC 3339 format is effectively the same is the ISO format, except RFC 3339 allows for a space between the date and time components whereas the ISO format uses a “T” character to separate date and time components.
If you want to get real weird, RFCs are not standards but rather a request for other participants to comment on the proposal. RFCs tend to be pointed towards as de facto standards though, even before they become a BCP or STD.
What he means is, if you want to download the document from ISO that describes the standard, you have to pay a fee. Here’s their store page: click.
It’s about 190 USD for a 38 page document describing the rules of the standard. There’s another document with extensions for a similar price. Quite pricey for a PDF file obviously, and the RFC is free to download.
On the other hand, no one in the history of time has gone “hmm, I don’t know how ISO-8601 works, let me go buy this document from the ISO store to figure it out.” Most people just call datetime.isoformat() or whatever their library function is called.
Cassandra uses epoch milliseconds for timestamping snapshots. This means that each node will have a different name for the same snapshot. Trivially solved with truncating the timestamp with * wildcard, but just… why?
Add comment