pkg / term

Package term manages POSIX terminals.
BSD 2-Clause "Simplified" License
393 stars 64 forks source link

Fix build on Solaris with recent golang.org/x/sys/unix #41

Closed AttilaFueloep closed 5 years ago

AttilaFueloep commented 5 years ago

Fixes https://github.com/pkg/term/issues/40.

Term fails to build with recent golang.org/x/sys/unix versions if GOOS == solaris. This is due to two commits:

  1. https://github.com/golang/sys/commit/a55a76086885b80f79961eacb876ebd8caf3868d changed Ioctl{Get,Set}Int(int, int, int) to Ioctl{Get,Set}Int(int, uint, int). (@jperkin This obviously is a "linuxism".)
  2. https://github.com/golang/sys/commit/6035cb031ffa600cb6dc48685f04236a802173ac changed the "signature" of unix.Termios, making type conversions to/from syscall.Termios fail.

The fix for 1. is trivial.

To fix 2. I copied the struct where conversions would apply. Copying was chosen to make the code more robust. This is inline with the explicit type conversions used in the code. (While converting to unsafe.Pointer() would work too, possible future changes to the x/sys/unix.Termios struct may break the code, so I took the overhead of copying.)

dewi-ny-je commented 5 years ago

I have the same issue on Solaris. Could someone approve the patch, please? thanks!

AttilaFueloep commented 5 years ago

I would really appreciate any feedback on this PR, as influxdb fails to build on Solaris due to this issue. Is there anything else I should do to get this forward? Thanks a lot.

dewi-ny-je commented 5 years ago

The issue with IOCTL on Solaris may be deeper, but every fix will help. See https://github.com/golang/go/issues/29581

AttilaFueloep commented 5 years ago

Thanks a lot Dave!

AttilaFueloep commented 5 years ago

That should've read "thank you very much". I didn't intend any sarcastic connotation, sorry if it appeared that way.

davecheney commented 5 years ago

Don't mention it. Sorry for taking so long to merge this.

On Thu, 10 Jan 2019 at 08:45, Attila Fülöp notifications@github.com wrote:

That should've read "thank you very much". I didn't intend any sarcastic connotation, sorry if it appeared that way.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/pkg/term/pull/41#issuecomment-452879075, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAcAz9nYL9IG-ePs7kWEK2k6KAGeOpvks5vBmLsgaJpZM4ZiBGf .

AttilaFueloep commented 5 years ago

Don't worry, the holidays were in-between.

AttilaFueloep commented 5 years ago

@dewi-ny-je Please see https://github.com/Bowery/prompt/pull/8 for SYS_IOCTL.

davecheney commented 5 years ago

This PR is now closed, please take the discussion elsewhere.