Archive:
Subtopics:
Comments disabled |
Wed, 23 Sep 2020
The mystery of the malformed command-line flags
Today a user came to tell me that their command
failed, saying:
This is surprising. The command looks correct. The branch name is
required. The The
But it still didn't work:
I dug in to the script and discovered the problem, which was not actually a programming error. The crappy shell script was behaving correctly! I had written up release notes for the In an earlier draft of the release notes, when they were displayed as an HTML page, there would be bad line breaks:
or:
No problem, I can fix it! I just changed the pair of hyphens ( But then this hapless user clipboard-copied the option string out of
the release notes, including its U+2011 characters. The parser in the
script was (correctly) looking for U+002D characters, and didn't
recognize One lesson learned: people will copy-paste stuff out of documentation, and I should be prepared for that. There are several places to address this. I made the error message more transparent; formerly it would complain only about the first argument, which was confusing because it was the one argument that wasn't superfluous. Now it will say something like
which is more descriptive of what it actually doesn't like. I could change the nonbreaking hyphens in the release notes back to regular hyphens and just accept the bad line breaks. But I don't want to. Typography is important. One idea I'm toying with is to have the shell script silently replace all nonbreaking hyphens with regular ones before any further processing. It's a hack, but it seems like it might be a harmless one. So many weird things can go wrong. This computer stuff is really complicated. I don't know how anyone get anything done. [ Addendum: A reader suggests that I could have fixed the line breaks with CSS. But the release notes were being presented as a Slack “Post”, which is essentially a WYSIWYG editor for creating shared documents. It presents the document in a canned HTML style, and as far as I know there's no way to change the CSS it uses. Similarly, there's no way to insert raw HTML elements, so no way to change the style per-element. ] [Other articles in category /prog/bug] permanent link |