Skip to content

Use x/term on Unix systems, deduplicate tscreen_*.go #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: legacy
Choose a base branch
from

Conversation

niten94
Copy link

@niten94 niten94 commented Jan 18, 2025

Reasons why syscall.Syscall6(syscall.SYS_IOCTL, ...) has to be replaced are written below:

  • Syscall(...) and Go 1.23 or newer has to be used with SYS_IOCTL since syscall(2) is removed in OpenBSD 7.5
  • unsafe.Pointer has to be converted to uintptr in arguments like written in 4th pattern in documentation

There may be changes in any platform where using syscall.Syscall* will not work, so calls are replaced with functions in x/sys and x/term instead.

Micro started up properly when I tested using an OpenIndiana and OpenBSD 7.6 VM. I do not have a MacOS machine so I cannot test if there are no bugs on MacOS. The changes may not be tested and thought well enough.

Fixes zyedidia/micro#3557

@JoeKar
Copy link
Member

JoeKar commented Mar 22, 2025

Unfortunately I've no MacOS for tests too.

@niten94 niten94 force-pushed the legacy/syscall-ptrconv branch from e0961ee to e701458 Compare March 24, 2025 15:09
@niten94
Copy link
Author

niten94 commented Mar 24, 2025

I have split the changes into different commits since not all are similar.

Unfortunately I've no MacOS for tests too.

Would it be possible if Zachary could test if bugs don't occur when running shell commands in Micro with this pull request, and if they do on the commit before e701458 (1482264)?

I remember seeing old comments in issues where he seemed to have MacOS, but I'll re-add tscreen_darwin.go or use poller in tscreen_unix.go if no one could test or bugs are introduced.

@niten94
Copy link
Author

niten94 commented Mar 26, 2025

Sorry, I realized that there were files I did not add so I added them now.

@niten94 niten94 force-pushed the legacy/syscall-ptrconv branch from 60065f3 to 731bc08 Compare April 22, 2025 12:37
@niten94
Copy link
Author

niten94 commented Apr 22, 2025

I realized that it isn't easy to modify the fork to use the same workaround on Mac OS as upstream, even if someone can test. I should have realized this months ago and submitted the current changes while tscreen_darwin.go is retained as a duplicate file, but I have readded the file now.

It's also not much needed to remove small amount of duplicated code, and the workaround on Mac OS doesn't need to be changed for now since there seems to be no bugs reported.

niten94 added 2 commits April 22, 2025 21:01
Use Linux screen implementation on all Unix systems and remove other
files except tscreen_darwin.go. The method to operate files on Mac OS
used in the fork cannot be changed, due to lack of clear information
and opportunity to test related issues.
@niten94 niten94 force-pushed the legacy/syscall-ptrconv branch from 731bc08 to 57a2541 Compare April 22, 2025 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants