Page MenuHomeFreeBSD

flua: add posix.unistd.dup2()
ClosedPublic

Authored by ifreund_freebsdfoundation.org on May 5 2025, 8:48 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 6, 4:43 AM
Unknown Object (File)
Fri, Oct 3, 1:52 AM
Unknown Object (File)
Mon, Sep 22, 12:02 PM
Unknown Object (File)
Sep 9 2025, 11:26 AM
Unknown Object (File)
Sep 3 2025, 5:50 PM
Unknown Object (File)
Sep 3 2025, 1:50 AM
Unknown Object (File)
Sep 2 2025, 6:26 PM
Unknown Object (File)
Sep 2 2025, 11:22 AM
Subscribers

Details

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

libexec/flua/modules/lposix.c
175

why doesn't this require a goto err too?

libexec/flua/modules/lposix.c
175

This function raises a lua error on failure and does not return.

Internally it longjmps away to somewhere else in the lua VM and either invokes an error handler if in a pcall() context or prints a stack trace and exits.

The luaL_checkinteger calls below behave the same.

emaste added inline comments.
libexec/flua/modules/lposix.c
174

We seem to have a number of different styles for the arg and extramsg args of luaL_argcheck

  • _exit narg == 1, 1
  • basename narg > 0, 1
  • chmod n == 2, n > 2 ? 3 : n
  • chown n > 1, n

some include the function (close takes exactly one argument (fd)) while some do not (at least one argument required).

Independent of this change we could do a pass to rationalize these

This revision is now accepted and ready to land.May 6 2025, 3:06 PM
libexec/flua/modules/lposix.c
174

I opened D50273 to clean this up.

This revision now requires review to proceed.May 11 2025, 3:27 PM
This revision is now accepted and ready to land.May 11 2025, 3:30 PM

As an aside while MFCing some flua work I (re)discovered 1f31e00e19f9e24d4c891a24973e08a027c4f71c

As an aside while MFCing some flua work I (re)discovered 1f31e00e19f9e24d4c891a24973e08a027c4f71c

Interesting, I wasn't aware of fbsd.exec. Unfortunately it doesn't look flexible enough to support the bsddialog use-case as it lacks a way to capture stderr output.

This revision was automatically updated to reflect the committed changes.