Skip to content
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

Use /compat/linux/proc in SpawnNewInstance on FreeBSD #2162

Merged
merged 2 commits into from Mar 8, 2019
Merged

Use /compat/linux/proc in SpawnNewInstance on FreeBSD #2162

merged 2 commits into from Mar 8, 2019

Conversation

ghost
Copy link

@ghost ghost commented Mar 8, 2019

This fixes opening a new instance in the shell's current working
directory. The code currently assumes that there is a Linux
compatible procfs mounted on /proc which is not the case on FreeBSD.
However linprocfs(5) is often mounted on /compat/linux/proc so we
can use that here for the time being.

A proper solution would look up the kern.proc.cwd. sysctl
instead, but that is not currently easily doable due to missing
KERN_PROC_CWD and struct kinfo_file definitions in the libc crate.

@chrisduerr
Copy link
Member

How commonly is this filesystem actually mounted? I'd assume that this has to be explicitly done by the user?

This seems like a pretty cheap workaround that could make it work for some people at least, but if it's never mounted but just exists in theory there's obviously not much benefit to it.

@ghost
Copy link
Author

ghost commented Mar 8, 2019

Yes, it has to be mounted explicitly by users. Anyone who uses linux(4) to run some Linux applications on FreeBSD already has to do it. Some ported applications are also patched to look in /compat/linux/proc. It's probably mounted commonly enough.

Copy link
Member

@chrisduerr chrisduerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the info regarding usage of this system. I think it should be fine to include it, thanks for the PR.

Is this a thing on other BSD systems too? In that case it would be possible to make it work under OpenBSD/...?

This still needs a change log entry before it can be merged.

This fixes opening a new instance in the shell's current working
directory.  The code currently assumes that there is a Linux
compatible procfs mounted on /proc which is not the case on FreeBSD.
However linprocfs(5) is often mounted on /compat/linux/proc so we
can use that here for the time being.

A proper solution would look up the kern.proc.cwd.<pid> sysctl
instead, but that is not currently easily doable due to missing
KERN_PROC_CWD and struct kinfo_file definitions in the libc crate.

Signed-off-by: Tobias Kortkamp <t@tobik.me>
@ghost
Copy link
Author

ghost commented Mar 8, 2019

Is this a thing on other BSD systems too? In that case it would be possible to make it work under OpenBSD/...?

I don't know. I'm unfamiliar with the other BSDs.

This still needs a change log entry before it can be merged.

Added.

Copy link
Member

@chrisduerr chrisduerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me now! Just waiting for CI to finish now.

@chrisduerr chrisduerr merged commit 0ec4bd2 into alacritty:master Mar 8, 2019
@ghost
Copy link
Author

ghost commented Mar 8, 2019

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant