dentangle,
@dentangle@chaos.social avatar

What a frustrating little bug! 🐞 Fine on Linux, FreeBSD and OpenBSD - failing on NetBSD only.

I was convinced it was some weird memory ordering bug or perhaps something to do with NetBSD using gcc instead of clang. After digging through the asm and finding nothing I was tearing my beard out.

The actual problem? A usleep() in a test.

On the argument to usleep() must be less than 1,000,000µs. It was, in fact, exactly 1,000,000 == 1sec.

Argh!

#C

riastradh,
@riastradh@mastodon.sdf.org avatar

@dentangle Before it was removed from POSIX, the specification in 2004 explicitly forbid arguments >=1e6:

> The useconds argument shall be less than one million.

And listed EINVAL for this case:

> [EINVAL]
> The time interval specified one million or more microseconds.

https://pubs.opengroup.org/onlinepubs/009696899/functions/usleep.html

sqlite3 had this bug too: https://www.sqlite.org/src/info/1f5ed852f25515bb.

But maybe at this point it's not worth keeping that persnickety quirk in NetBSD. So I filed a PR to reconsider it: https://gnats.NetBSD.org/58184

jspath55,
@jspath55@chaos.social avatar

@riastradh @dentangle "nobody expects the Spanish usleepition"‐-nice one.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • programming
  • DreamBathrooms
  • thenastyranch
  • ngwrru68w68
  • magazineikmin
  • khanakhh
  • rosin
  • mdbf
  • Youngstown
  • slotface
  • everett
  • cubers
  • kavyap
  • ethstaker
  • InstantRegret
  • JUstTest
  • Durango
  • tester
  • osvaldo12
  • cisconetworking
  • tacticalgear
  • anitta
  • GTA5RPClips
  • modclub
  • normalnudes
  • provamag3
  • megavids
  • Leos
  • lostlight
  • All magazines