Skip to content

Commit

Permalink
Switch to using fuse3 instead of fuse2 (#379)
Browse files Browse the repository at this point in the history
* switch to using fuse3 instead of fuse2

* fix ci tests

* update go-fuse to allow using fuse3
  • Loading branch information
jstaf authored Jan 22, 2024
1 parent 7fee74c commit de0e0dd
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

- uses: actions/setup-go@v2
with:
go-version: "1.17"
go-version: "1.18"

- name: Install apt dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ test: onedriver onedriver-launcher dmel.fa
# will literally purge everything: all built artifacts, all logs, all tests,
# all files tests depend on, all auth tokens... EVERYTHING
clean:
fusermount -uz mount/ || true
fusermount3 -uz mount/ || true
rm -f *.db *.rpm *.deb *.dsc *.changes *.build* *.upload *.xz filelist.txt .commit
rm -f *.log *.fa *.gz *.test vgcore.* onedriver onedriver-headless onedriver-launcher .auth_tokens.json
rm -rf util-linux-*/ onedriver-*/ vendor/ build/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ mkdir mount
ls -l mount

# unmount the filesystem
fusermount -uz mount
fusermount3 -uz mount
# you can also just "ctrl-c" onedriver to unmount it
```

Expand Down Expand Up @@ -239,7 +239,7 @@ filesystem" indicates that your computer is currently offline.)

If the filesystem appears to hang or "freeze" indefinitely, its possible the
fileystem has crashed. To resolve this, just restart the program by unmounting
and remounting things via the GUI or by running `fusermount -uz $MOUNTPOINT` on
and remounting things via the GUI or by running `fusermount3 -uz $MOUNTPOINT` on
the command-line.

If you really want to go back to a clean slate, onedriver can be completely
Expand Down
2 changes: 1 addition & 1 deletion cmd/onedriver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func main() {
})
if err != nil {
log.Fatal().Err(err).Msgf("Mount failed. Is the mountpoint already in use? "+
"(Try running \"fusermount -uz %s\")\n", mountpoint)
"(Try running \"fusermount3 -uz %s\")\n", mountpoint)
}

// setup signal handler for graceful unmount on signals like sigint
Expand Down
4 changes: 2 additions & 2 deletions fs/offline/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestMain(m *testing.M) {

// attempt to unmount regardless of what happens (in case previous tests
// failed and didn't clean themselves up)
exec.Command("fusermount", "-uz", mountLoc).Run()
exec.Command("fusermount3", "-uz", mountLoc).Run()
os.Mkdir(mountLoc, 0755)

auth = graph.Authenticate(graph.AuthConfig{}, ".auth_tokens.json", false)
Expand Down Expand Up @@ -76,7 +76,7 @@ func TestMain(m *testing.M) {

if server.Unmount() != nil {
log.Error().Msg("Failed to unmount test fuse server, attempting lazy unmount")
exec.Command("fusermount", "-zu", "mount").Run()
exec.Command("fusermount3", "-zu", "mount").Run()
}
fmt.Println("Successfully unmounted fuse server!")
os.Exit(code)
Expand Down
4 changes: 2 additions & 2 deletions fs/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestMain(m *testing.M) {
os.Chdir("..")
// attempt to unmount regardless of what happens (in case previous tests
// failed and didn't clean themselves up)
exec.Command("fusermount", "-uz", mountLoc).Run()
exec.Command("fusermount3", "-uz", mountLoc).Run()
os.Mkdir(mountLoc, 0755)
// wipe all cached data from previous tests
os.RemoveAll(testDBLoc)
Expand Down Expand Up @@ -116,7 +116,7 @@ func TestMain(m *testing.M) {
// unmount
if server.Unmount() != nil {
log.Error().Msg("Failed to unmount test fuse server, attempting lazy unmount")
exec.Command("fusermount", "-zu", "mount").Run()
exec.Command("fusermount3", "-zu", "mount").Run()
}
fmt.Println("Successfully unmounted fuse server!")
os.Exit(code)
Expand Down
2 changes: 1 addition & 1 deletion fs/signal_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func UnmountHandler(signal <-chan os.Signal, server *fuse.Server) {
err := server.Unmount()
if err != nil {
log.Error().Err(err).Msg("Failed to unmount filesystem cleanly! " +
"Run \"fusermount -uz /MOUNTPOINT/GOES/HERE\" to unmount.")
"Run \"fusermount3 -uz /MOUNTPOINT/GOES/HERE\" to unmount.")
}

os.Exit(128)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require (
github.com/coreos/go-systemd/v22 v22.3.2
github.com/godbus/dbus/v5 v5.0.6
github.com/gotk3/gotk3 v0.6.1
github.com/hanwen/go-fuse/v2 v2.1.0
github.com/hanwen/go-fuse/v2 v2.4.2
github.com/imdario/mergo v0.3.13
github.com/rs/zerolog v1.26.1
github.com/spf13/pflag v1.0.5
Expand Down
13 changes: 6 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ github.com/godbus/dbus/v5 v5.0.6 h1:mkgN1ofwASrYnJ5W6U/BxG15eXXXjirgZc7CLqkcaro=
github.com/godbus/dbus/v5 v5.0.6/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gotk3/gotk3 v0.6.1 h1:GJ400a0ecEEWrzjBvzBzH+pB/esEMIGdB9zPSmBdoeo=
github.com/gotk3/gotk3 v0.6.1/go.mod h1:/hqFpkNa9T3JgNAE2fLvCdov7c5bw//FHNZrZ3Uv9/Q=
github.com/hanwen/go-fuse v1.0.0 h1:GxS9Zrn6c35/BnfiVsZVWmsG803xwE7eVRDvcf/BEVc=
github.com/hanwen/go-fuse v1.0.0/go.mod h1:unqXarDXqzAk0rt98O2tVndEPIpUgLD9+rwFisZH3Ok=
github.com/hanwen/go-fuse/v2 v2.1.0 h1:+32ffteETaLYClUj0a3aHjZ1hOPxxaNEHiZiujuDaek=
github.com/hanwen/go-fuse/v2 v2.1.0/go.mod h1:oRyA5eK+pvJyv5otpO/DgccS8y/RvYMaO00GgRLGryc=
github.com/hanwen/go-fuse/v2 v2.4.2 h1:ujevavwvGMg4s1TTSGWqid0q7WHk0XC8EOzHtygnt9E=
github.com/hanwen/go-fuse/v2 v2.4.2/go.mod h1:xKwi1cF7nXAOBCXujD5ie0ZKsxc8GGSA1rlMJc+8IJs=
github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk=
github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
github.com/moby/sys/mountinfo v0.6.2 h1:BzJjoreD5BMFNmD9Rus6gdd1pLuecOFPt8wC+Vygl78=
github.com/moby/sys/mountinfo v0.6.2/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand All @@ -39,14 +39,14 @@ golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e h1:WUoyKPm6nCo1BnNUvPGnFG3T5DUVem42yDJZZ4CNxMA=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
Expand All @@ -59,7 +59,6 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
Expand Down
2 changes: 1 addition & 1 deletion onedriver.spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ BuildRequires: git
BuildRequires: gcc
BuildRequires: pkg-config
BuildRequires: webkit2gtk3-devel
Requires: fuse
Requires: fuse3

%description
Onedriver is a native Linux filesystem for Microsoft Onedrive. Files and
Expand Down
5 changes: 2 additions & 3 deletions pkg/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ Source: onedriver
Section: utils
Priority: optional
Maintainer: Jeff Stafford <jeff.stafford@protonmail.com>
Build-Depends:
golang (>= 1.15), gcc, pkg-config, libwebkit2gtk-4.0-dev, git, debhelper
Build-Depends: golang (>= 1.15), gcc, pkg-config, libwebkit2gtk-4.0-dev, git, debhelper
Standards-Version: 4.4.1
Homepage: https://github.com/jstaf/onedriver
#Vcs-Browser: https://github.com/jstaf/onedriver
#Vcs-Git: https://github.com/jstaf/onedriver.git

Package: onedriver
Architecture: any
Depends: libwebkit2gtk-4.0-37, fuse
Depends: libwebkit2gtk-4.0-37, fuse3
Suggests: systemd
Description:
A native Linux filesystem for Microsoft Onedrive Onedriver is a native Linux
Expand Down
2 changes: 1 addition & 1 deletion pkg/resources/onedriver.1
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ It's possible that there may be a deadlock or segfault that I haven't caught in
my tests. If this happens, the onedriver filesystem and subsequent ops may hang
indefinitely (ops will hang while the kernel waits for the dead onedriver
process to respond). When this happens, you can cleanly unmount the filesystem
with: \fBfusermount -uz $MOUNTPOINT\fR
with: \fBfusermount3 -uz $MOUNTPOINT\fR


In the event that you want to reset onedriver completely (wipe all local state)
Expand Down
2 changes: 1 addition & 1 deletion pkg/resources/onedriver@.service
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Description=onedriver

[Service]
ExecStart=/usr/bin/onedriver %f
ExecStopPost=/usr/bin/fusermount -uz /%I
ExecStopPost=/usr/bin/fusermount3 -uz /%I
Restart=on-abnormal
RestartSec=3
RestartForceExitStatus=2
Expand Down

0 comments on commit de0e0dd

Please sign in to comment.