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

Storage OpenBSD/adJ #2809

Merged
merged 15 commits into from
Jul 29, 2024
Merged

Storage OpenBSD/adJ #2809

merged 15 commits into from
Jul 29, 2024

Conversation

vtamara
Copy link
Contributor

@vtamara vtamara commented Mar 5, 2024

Why this should be merged

Adds support for OpenBSD/adJ as required by #2782

How this works

Using build constraints and the right field names for syscall.Statfs_t in OpenBSD as described at golang/go#47958

How this was tested

With the following storage_openbsd_test.go:

package storage

import (
    //"fmt"
    "os/exec"
    "strconv"
    "strings"
    "testing"
)


func TestAvalableBytes(t *testing.T) {
	avail1, err := AvailableBytes("/home");
	if avail1 <= 0 || err != nil {
		t.Fatalf(`avail1 = %d, err = %v`, avail1, err.Error())
	}

	stdout, err := exec.Command("/bin/df", "/home").Output()
	// In OpenBSD the df program returns something like:
	// df /home
	// Filesystem  512-blocks      Used     Avail Capacity  Mounted on
	// /dev/sd0g     75663352  64674648   7205540    90%    /home  
	if err != nil {
		t.Fatalf(`err = %v`, err.Error())
	}
	//fmt.Printf("output %s\n", stdout)
	f := strings.Fields(string(stdout));
	bavail2, err := strconv.ParseUint(f[10], 10, 64)
	if err != nil {
		t.Fatalf(`err = %v`, err.Error())
	}
	avail2 := bavail2 * 512;

	if avail1 != avail2 {
		t.Fatalf(`avail1 = %d, avail2 = %d`, avail1, avail2)
	}

}

Sorry, I had to replicate #2803 (my initial fork didn't copy all the branches and tags and later I discovered I needed all of them).

@vtamara
Copy link
Contributor Author

vtamara commented Apr 21, 2024

Blessings, since the effort of porting to OpenBSD has brought improvements in security I wanted you to notice that I applied for funding in the "Avalanche Community Grants Quadratic Funding Round One" to do a deeper audit of the sources of the fundamental tools of Avalanche, complete the porting and test more fully. Could you please vote for the project at: https://explorer.gitcoin.co/#/round/43114/4/28 ?

Copy link

github-actions bot commented Jun 2, 2024

This PR has become stale because it has been open for 30 days with no activity. Adding the lifecycle/frozen label will cause this PR to ignore lifecycle events.

@vtamara
Copy link
Contributor Author

vtamara commented Jun 4, 2024

I'm glad to announce that I received some funding to continue the project of audting and porting avalanchego and other ava-labs tools to OpenBSD/adJ. Please see: https://forum.avax.network/t/announcing-round-1-results/2376

@vtamara vtamara changed the title Storage OpenBSD/adJ Storage OpenBSD/adJ. Closes #2782 Jun 4, 2024
@vtamara vtamara changed the title Storage OpenBSD/adJ. Closes #2782 Storage OpenBSD/adJ Jun 4, 2024
@vtamara vtamara mentioned this pull request Jun 4, 2024
@vtamara
Copy link
Contributor Author

vtamara commented Jul 27, 2024

Thank you @StephenButtolph

@StephenButtolph StephenButtolph merged commit ccf785c into ava-labs:master Jul 29, 2024
20 checks passed
@StephenButtolph StephenButtolph added this to the v1.11.11 milestone Jul 29, 2024
@vtamara
Copy link
Contributor Author

vtamara commented Jul 30, 2024

Great news! Thanks. I would like to send another PR to improve:

  • tests because the option -race for go test doesn't work on OpenBSD/adJ
  • lint because in OpenBSD/adJ instead of grep it should use ggrep

Ok?

@vtamara vtamara deleted the adJ74 branch August 5, 2024 16:31
@vtamara vtamara restored the adJ74 branch August 5, 2024 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants