reva icon indicating copy to clipboard operation
reva copied to clipboard

Fix building on FreeBSD

Open zaynetro opened this issue 3 years ago • 17 comments

Closes https://github.com/owncloud/ocis/issues/1217

  • Extracted common error methods to errtypes package
  • Fixed type error on Bavail ( https://golang.org/src/syscall/ztypes_freebsd_arm64.go#L125 )
  • Alias ENODATA to ENOATTR

Still pending:

  • I am not sure how to implement error methods on Windows
  • Wait for https://github.com/c-bata/go-prompt to depend on not-yet-released 1.2.0 version of https://github.com/pkg/term
    • term fixed the build issues recently https://github.com/pkg/term/issues/57

How to test this on Linux:

export GOOS=freebsd
make

UPD: go-prompt patched https://github.com/c-bata/go-prompt/pull/224 (waiting for a release)

zaynetro avatar Feb 25 '21 11:02 zaynetro

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

update-docs[bot] avatar Feb 25 '21 11:02 update-docs[bot]

Hmm,

pkg/storage/fs/ocis/ocis_unix.go:31:18: unnecessary conversion (unconvert)
    bavail := uint64(stat.Bavail) // stat.Bavail is int64 on FreeBSD

will be nice to somehow enable -all flag on unconvert linter (ref: https://github.com/mdempsky/unconvert )

Using the -all flag, unconvert will analyze the Go packages under all possible GOOS/GOARCH combinations, and only identify conversions that are unnecessary in all cases.

E.g., syscall.Timespec's Sec and Nsec fields are int64 under linux/amd64 but int32 under linux/386. An int64(ts.Sec) conversion that appears in a linux/amd64-only file will be identified as unnecessary, but it will be preserved if it occurs in a file that's compiled for both linux/amd64 and linux/386.

golang-ci uses a fork https://github.com/golangci/unconvert

zaynetro avatar Feb 25 '21 14:02 zaynetro

OK. Now only need to figure out how to resolve unconvert lint issue https://github.com/golangci/golangci-lint/issues/1809

Let me know if you have some ideas.

zaynetro avatar Mar 05 '21 18:03 zaynetro

Hi @zaynetro, thanks for the PR, the changes look good! We can wait for you to implement the changes in unconvert or golangci-lint. If that takes long to merge, we can also have separate the implementations for ocis_unix and ocis_freebsd.

ishank011 avatar Mar 09 '21 10:03 ishank011

Seems like it will take a while to update golangci-lint so I split into more freebsd specific files as you suggested.

zaynetro avatar Mar 20 '21 07:03 zaynetro

@ishank011 How can we continue with these changes?

zaynetro avatar Mar 27 '21 08:03 zaynetro

zerrors_windows.go has a comment above defined contants.

// Invented values to support what package os and others expects.

Also syscall package is deprecated

Deprecated: this package is locked down. Callers should use the corresponding package in the golang.org/x/sys repository instead.

I am not sure that Windows has exact same errors as unix systems. golang.org/x/sys/windows defines completely different error types. Do you still want me to implement XattrIsNoData method on Windows using syscall.ENODATA constant? I am not familiar with file systems but to me it seems that ENODATA will never happen on Windows since there is no such thing there.

zaynetro avatar Apr 04 '21 16:04 zaynetro

@zaynetro ah okay, we can let it be then. Can you rebase?

ishank011 avatar Apr 12 '21 16:04 ishank011

Done.

zaynetro avatar Apr 12 '21 17:04 zaynetro

@zaynetro could you rebase? I think @ishank011 would like to get this in.

butonic avatar Jul 29 '21 10:07 butonic

Rebased.

zaynetro avatar Aug 19 '21 10:08 zaynetro

@micbar you had a look at the ENOATTR ENODATA and sent an upstream PR https://github.com/pkg/xattr/pull/63/files @C0rby don't you have a bsd variant running?

I know this PR bitrotted a bit, still @zaynetro could you retarget this PR against the edge branch? It might be easier to get it in there.

butonic avatar Apr 28 '22 18:04 butonic

Is there any update on this bug? OCIS still does not build on FreeBSD due to this bug.

Lars-Cleemann avatar Nov 07 '22 21:11 Lars-Cleemann

oCIS is now building on the edge branch which means it uses reva 2.x releases.

This fix would need to go to the edge branch.

micbar avatar Dec 15 '22 08:12 micbar

Is there any update on this bug? OCIS still does not build on FreeBSD due to this bug.

I've just attempted to build oCIS v2.0.0 (their stable release) on FreeBSD today and can confirm this bug is still present in reva, preventing a successful compilation.. What can I do to help speed this up?

joramkruijer avatar Jan 29 '23 20:01 joramkruijer

@joramkruijer please try the latest master.

micbar avatar Jan 30 '23 08:01 micbar

@joramkruijer please try the latest master.

Thanks, that resolves the compilation issue! There's an issue preventing ocis from running due to a bug in reva, for which I've opened a pull request (#3650).

joramkruijer avatar Feb 12 '23 17:02 joramkruijer