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

Add Credential struct to daemon_stub.go and daemon_unix.go #92

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

skrashevich
Copy link

..for ability to compile the same code for windows and *nix systems

@NorseGaud
Copy link
Contributor

Doesn't work on macos

❯ go run examples/cmd/gd-signal-handling/signal-handling.go
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x1003f80a0]

goroutine 1 [running]:
github.com/norsegaud/go-daemon.(*Context).parent(0x14000116c30)
        /Users/nathanpierce/go-daemon/daemon_unix.go:111 +0x1f0
github.com/norsegaud/go-daemon.(*Context).reborn(0x1400005cec0?)
        /Users/nathanpierce/go-daemon/daemon_unix.go:69 +0x58
github.com/norsegaud/go-daemon.(*Context).Reborn(...)
        /Users/nathanpierce/go-daemon/daemon.go:31
main.main()
        /Users/nathanpierce/go-daemon/examples/cmd/gd-signal-handling/signal-handling.go:51 +0x67c
exit status 2

@skrashevich
Copy link
Author

Doesn't work on macos

❯ go run examples/cmd/gd-signal-handling/signal-handling.go
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x1003f80a0]

goroutine 1 [running]:
github.com/norsegaud/go-daemon.(*Context).parent(0x14000116c30)
        /Users/nathanpierce/go-daemon/daemon_unix.go:111 +0x1f0
github.com/norsegaud/go-daemon.(*Context).reborn(0x1400005cec0?)
        /Users/nathanpierce/go-daemon/daemon_unix.go:69 +0x58
github.com/norsegaud/go-daemon.(*Context).Reborn(...)
        /Users/nathanpierce/go-daemon/daemon.go:31
main.main()
        /Users/nathanpierce/go-daemon/examples/cmd/gd-signal-handling/signal-handling.go:51 +0x67c
exit status 2

Do you run it from root?

@NorseGaud
Copy link
Contributor

Doesn't work on macos

❯ go run examples/cmd/gd-signal-handling/signal-handling.go
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x1003f80a0]

goroutine 1 [running]:
github.com/norsegaud/go-daemon.(*Context).parent(0x14000116c30)
        /Users/nathanpierce/go-daemon/daemon_unix.go:111 +0x1f0
github.com/norsegaud/go-daemon.(*Context).reborn(0x1400005cec0?)
        /Users/nathanpierce/go-daemon/daemon_unix.go:69 +0x58
github.com/norsegaud/go-daemon.(*Context).Reborn(...)
        /Users/nathanpierce/go-daemon/daemon.go:31
main.main()
        /Users/nathanpierce/go-daemon/examples/cmd/gd-signal-handling/signal-handling.go:51 +0x67c
exit status 2

Do you run it from root?

No

@sevlyar
Copy link
Owner

sevlyar commented Apr 14, 2024

@skrashevich, i don't understand what purpose of the changes. Could you provide me more context or example?

@skrashevich
Copy link
Author

skrashevich commented Apr 14, 2024

@skrashevich, i don't understand what purpose of the changes. Could you provide me more context or example?

AlexxIT/go2rtc@5c40ba0

because os.syscall package provide Credential type for unix , but doesn't provide it for windows

Comment on lines +111 to +114
Uid: d.Credential.Uid,
Gid: d.Credential.Gid,
Groups: d.Credential.Groups,
NoSetGroups: d.Credential.NoSetGroups,
Copy link
Owner

Choose a reason for hiding this comment

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

Potential nil pointer dereference.

@sevlyar
Copy link
Owner

sevlyar commented Apr 15, 2024

The PR changes public interface of the library and breaks backward compatibility.

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.

4 participants