Skip to content

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

Open
skrashevich wants to merge 1 commit into
sevlyar:masterfrom
skrashevich:230521-fix-credentials
Open

Add Credential struct to daemon_stub.go and daemon_unix.go#92
skrashevich wants to merge 1 commit into
sevlyar:masterfrom
skrashevich:230521-fix-credentials

Conversation

@skrashevich

Copy link
Copy Markdown

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

@NorseGaud

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

sevlyar commented Apr 14, 2024

Copy link
Copy Markdown
Owner

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

@skrashevich

skrashevich commented Apr 14, 2024

Copy link
Copy Markdown
Author

@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 thread daemon_unix.go
Comment on lines +111 to +114
Uid: d.Credential.Uid,
Gid: d.Credential.Gid,
Groups: d.Credential.Groups,
NoSetGroups: d.Credential.NoSetGroups,

Copy link
Copy Markdown
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

sevlyar commented Apr 15, 2024

Copy link
Copy Markdown
Owner

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