Better HN
topnewbestaskshowjobs
Log inSign up

begriffs

3,039 karma · joined Aug 10, 2011 (15y ago) · 383 submissions

Submissions

comment 7y ago · link · parent

Rather: don't presume anything, read the language specification for the version you are writing (C89, C99, etc).

"Measuring" is exactly the wrong thing to do because often it is indicative of only your specific architecture/compiler.

comment 7y ago · link · parent

Your article mentions:

> Unicode is pretty established, some use it with the wchar_t API in POSIX, some more as non-POSIX via external non-standardized utf-8 libraries

Just wanted to note that wchar_t is not POSIX per se, but comes from the C standard. It also suffers from various problems, see

https://begriffs.com/posts/2019-01-19-inside-c-standard-lib....

comment 7y ago · link · parent

As it says in the article:

> The examples in this article conform to the C89 standard, but we specify C99 in the Makefile because the ICU header files use C99-style (//) comments.

64.

Unicode Programming in Depth(begriffs.com ↗)

1 points · by begriffs · 7y ago · discuss

65.

How Unicode Works (With Examples)(begriffs.com ↗)

3 points · by begriffs · 7y ago · discuss

66.

Unicode Programming, with Examples(begriffs.com ↗)

1 points · by begriffs · 7y ago · discuss

comment 7y ago · link · parent

Good point, there are URIs for other protocols (like FTP, Gopher etc).

comment 7y ago · link · parent

Every email message has a unique identifier called the Message-Id, but SMTP does not host messages with an HTTP URI.

Serving public URIs for messages must be done by separate web servers like a webmail client, or a mail archiving tool such as Pipermail.

comment 7y ago · link · parent

> The promise of AMP for Email is that it’ll turn basic messages into a surface for actually getting things done.

Oh god no, please don't turn email into a "surface."

> That means you’ll be able to do [x, y, z] right from the message, all without leaving your web-based email client.

Quit. Gmail.

Why are so many technical users still on this gross platform that is turning the earliest, most successful decentralized internet protocol into a walled surveillance advertiser garden?

If you use gmail, go register a domain and point your MX records at an honest mail provider like Fastmail, Posteo, or Kolabnow. Or run your own mail server. This way your mail provider is hidden behind your domain and you can change it in the future if desired.

Seriously, stop reading hacker news for a second and make today the day you start migrating away from Google.

70.

Trusting Unicode strings like SSH fingerprints(github.com ↗)

2 points · by begriffs · 7y ago · discuss

71.

Show HN: Unicode Trust on First Use(github.com ↗)

6 points · by begriffs · 7y ago · discuss

comment 7y ago · link · parent

In a real scenario gitftp would be run remotely. If you're hosting your own git server then you could host the ftp interface too. It won't work with e.g. Github.

comment 7y ago · link · parent

You have strong opinions about this, which makes me think maybe you can tell me details I didn't know about FTP.

> It's an archaic protocol built around the limitations of early-1980s systems.

What were the limitations, and how did they shape the protocol?

> protocol "feature" of having server responses be human-readable (and not machine-parseable)

The responses are successfully parsed by quite a few clients, no? The fact that I as a person can easily read the output would seem in and of itself to be a positive quality.

> control and data connections ... caused something like 2 decades of security problems, also makes it a nightmare to provision in modern networks

I know little about configuring network security, can you tell me more here? The idea is that in passive mode the server has to pick and listen on a bunch of random ports and so the firewall can't unconditionally block them?

Also you mention "modern networks" -- did it used to be easier to provision networks in the past and something has changed recently?

comment 7y ago · link · parent

(Author here)

Thanks for reporting this. It looks ok for me in Safari 12.0.3, what version are you on?

The bulk of the work is done by Video.js 5.0.2. Perhaps your browser or plugins are blocking the script?

Can you send me an email with a screenshot? I do try to make the videos work on every browser if possible.

comment 7y ago · link · parent

Yeah, in this server's case it would respond "502 Unimplemented"

comment 7y ago · link · parent

One factor that mitigates this a little is the "SYST" command. When a client sends it to gitftp, I have it reply with "215 UNIX" to give them a clue about the format.

I also browsed a few of the FTP mirrors for OpenBSD and took note of how they formatted their response, and tried to make my format match what I observed to be the most common response. It's worked with all the clients I've tried so far: ncftp on mac, ftp on openbsd, Firefox, mac's ftp-finder integration, and Filezilla.

So while there is admittedly ambiguity in FTP servers on the whole, I think my server in particular should work OK. Keeping an open mind though if you know about a problem I haven't foreseen.

comment 7y ago · link · parent

Author here. I did aim to write the code carefully, for instance doing bounded reads like `fgets(cmd, CLIENT_BUFSZ, conn)` to prevent overflowing my buffer. Also ran the program in Valgrind and exercised different code paths to detect memory leaks and management errors such as use-after-free or double-freeing. Because libgit2 and its memory conventions were new to me, I did actually make mistakes and Valgrind helped me find them. The fix for those mistakes is in commit 59bb39b if you're curious to check it out.

Writing in C requires care, but the modern day "rewrite it in rust" crusade does feel overblown. C programs are nice -- small and fast.

Anyway, I don't mean to be cocky. A code review is welcome, I'd be curious if I did indeed overlook a security issue.

78.

Show HN: Git via FTP Interface(begriffs.com ↗)

3 points · by begriffs · 7y ago · discuss

79.

Show HN: Browsing a Remote Git Repo(begriffs.com ↗)

9 points · by begriffs · 7y ago · 1 comment

80.

Demo of using Haskell in a C project(github.com ↗)

3 points · by begriffs · 7y ago · discuss

comment 7y ago · link · parent

> until you mentioned it here there was no indication in the document that you were aware of it

Good point, and thanks for pointing it out. People can't read my mind and the example might give people the wrong idea. I'll add a note to the example.

comment 7y ago · link · parent

You mean where I'm comparing whether the character is between 'a' and 'z'? Yeah I'm aware that's an ASCII thing, and that the standard was designed to accommodate other encodings such as EBCDIC. My `isalpha` example was more about showing how such a macro ought to be careful to not evaluate its argument more than once.

Did you read the rest of that section? I have arguments about why ctype appears to be insufficient.

comment 7y ago · link · parent

Thanks for pointing this out.

Can you give an example of the strncpy problem?

Also is there a precaution programs can take to use memset more safely?

84.

C Portability Lessons from Weird Machines(begriffs.com ↗)

270 points · by begriffs · 8y ago · 117 comments

comment 8y ago · link · parent

> a huge headache to set up

OK, but "huge headache" is somewhat exaggerated. For many clients, gmail connection settings are a preset option, where you enter a username and application password. It's a one-time configuration.

> outlook

My condolences.

> my 6+ separate computers

You are perhaps an outlier? But I can see how it's a hassle in your particular case.

comment 8y ago · link · parent

Why not use a desktop/mobile mail client of your choice to access gmail over open protocols? Then they can clown up the web UI all they want and it won't matter to you.

comment 8y ago · link · parent

I had a variation of that mini phone you linked to (the internals get repackaged by various manufacturers). Mine was exactly the height and width of a credit card, and not very thick. It was lovely in my pocket, so unobtrusive. Everyone thought it was a calculator. :) Had to give it up after a while because the battery was really bad. One serious call and it was toast, and the battery got worse with age. If they made a model with a swappable battery it would be more tolerable because I could take some spares with me.
12345
13