Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
name: Build and Test with Code Coverage
strategy:
matrix:
go: ["1.25"]
go: ["1.26"]
job_name: ["linux-fuse3", "linux-fuse2"]

include:
Expand Down Expand Up @@ -1058,7 +1058,7 @@ jobs:
name: Build and Test with Code Coverage on Windows
strategy:
matrix:
go: ["1.25"]
go: ["1.26"]
job_name: ["windows"]

include:
Expand Down Expand Up @@ -1983,7 +1983,7 @@ jobs:
name: Cleanup Test Accounts
strategy:
matrix:
go: ["1.25"]
go: ["1.26"]
job_name: ["linux"]

include:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
if: matrix.language == 'go'
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
with:
go-version: "1.25"
go-version: "1.26"
check-latest: true

- name: Cache Go build cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fuzz-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
timeout-minutes: 30

env:
go: "1.25"
go: "1.26"

steps:
- name: Checkout code
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
name: Create Windows Installer
runs-on: windows-latest
env:
go: "1.25"
go: "1.26"
cgo: "0"
winfsp: winfsp-2.1.25156.msi
steps:
Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:
needs: create-installer
runs-on: ubuntu-latest
env:
go: "1.25"
go: "1.26"
zig: 0.15.2
permissions:
contents: write # Needed to create releases
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:

env:
cgo: "1"
go: "1.25"
go: "1.26"
zig: 0.15.2
containerName: "test-cnt-ubn"

Expand Down Expand Up @@ -232,7 +232,7 @@ jobs:
runs-on: ${{ matrix.os }}
timeout-minutes: 15
env:
go: "1.25"
go: "1.26"
cgo: "0"
containerName: "test-cnt-win"

Expand Down Expand Up @@ -267,7 +267,7 @@ jobs:
name: Lint
runs-on: ubuntu-latest
env:
go: "1.25"
go: "1.26"
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Expand Down
3 changes: 3 additions & 0 deletions .github/zizmor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ rules:
ignore:
- unit-test.yml:47
- unit-test.yml:55
template-injection:
ignore:
- publish-release.yml:97
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-docstring-first
- id: check-executables-have-shebangs
Expand All @@ -16,11 +16,11 @@ repos:
args: [--markdown-linebreak-ext=md]

- repo: https://github.com/rhysd/actionlint
rev: v1.7.7
rev: v1.7.10
hooks:
- id: actionlint

- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.5.2
rev: v1.22.0
hooks:
- id: zizmor
2 changes: 1 addition & 1 deletion cmd/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ var mountCmd = &cobra.Command{
if !disableVersionCheck {
err := VersionCheck()
if err != nil {
log.Err(err.Error())
log.Err("%s", err.Error())
}
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/mount_all.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func processCommand(out io.Writer, errOut io.Writer) error {
if !disableVersionCheck {
err := VersionCheck()
if err != nil {
log.Err(err.Error())
log.Err("%s", err.Error())
}
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/mount_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ func (suite *mountListTestSuite) TestMountListNoMounts() {
output, err := executeCommandC(rootCmd, "mount", "list")
suite.assert.NoError(err)
// Either no mounts or lists some mounts - both are valid
suite.assert.True(
len(output) > 0,
suite.assert.NotEmpty(
output,
"Expected output from mount list command",
)
}
Expand Down
19 changes: 13 additions & 6 deletions cmd/mount_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@ import (

// Create dummy function so that mount.go code can compile
// This function is used only on Linux, so it creates an empty context here
func createDaemon(pipeline *internal.Pipeline, ctx context.Context, pidFileName string, pidFilePerm os.FileMode, umask int, fname string) error {
func createDaemon(
pipeline *internal.Pipeline,
ctx context.Context,
pidFileName string,
pidFilePerm os.FileMode,
umask int,
fname string,
) error {
return nil
}

Expand Down Expand Up @@ -103,7 +110,10 @@ func readPassphraseFromPipe(pipeName string, timeout time.Duration) (string, err
// We will retry until the timeout expires.
if err == windows.ERROR_PIPE_BUSY {
if time.Now().After(deadline) {
return "", fmt.Errorf("timed out waiting for pipe '%s' to become available", pipeName)
return "", fmt.Errorf(
"timed out waiting for pipe '%s' to become available",
pipeName,
)
}
time.Sleep(50 * time.Millisecond)
continue
Expand Down Expand Up @@ -132,10 +142,7 @@ func readPassphraseFromPipe(pipeName string, timeout time.Duration) (string, err
}

// Wait for the read operation to complete or timeout.
readTimeout := time.Until(deadline)
if readTimeout < 0 {
readTimeout = 0
}
readTimeout := max(time.Until(deadline), 0)
eventState, err := windows.WaitForSingleObject(event, uint32(readTimeout.Milliseconds()))
if err != nil {
return "", fmt.Errorf("ReadFile WaitForSingleObject failed: %w", err)
Expand Down
104 changes: 91 additions & 13 deletions cmd/mount_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,24 @@ func (suite *mountTestSuite) TestForegroundMountDirDoesExist() {
tempDir := filepath.Join(mntDir, "tempdir")
err = os.MkdirAll(tempDir, 0777)

op, err := executeCommandC(rootCmd, "mount", tempDir, fmt.Sprintf("--config-file=%s", confFileMntTest), "--foreground=true")
op, err := executeCommandC(
rootCmd,
"mount",
tempDir,
fmt.Sprintf("--config-file=%s", confFileMntTest),
"--foreground=true",
)
suite.assert.NotNil(err)
suite.assert.Contains(op, "mount directory already exists")

op, err = executeCommandC(rootCmd, "mount", "all", tempDir, fmt.Sprintf("--config-file=%s", confFileMntTest), "--foreground=true")
op, err = executeCommandC(
rootCmd,
"mount",
"all",
tempDir,
fmt.Sprintf("--config-file=%s", confFileMntTest),
"--foreground=true",
)
suite.assert.NotNil(err)
suite.assert.Contains(op, "mount directory already exists")
}
Expand All @@ -124,11 +137,25 @@ func (suite *mountTestSuite) TestForegroundMountDirNotEmpty() {
suite.assert.Nil(err)
defer os.RemoveAll(mntDir)

op, err := executeCommandC(rootCmd, "mount", mntDir, fmt.Sprintf("--config-file=%s", confFileMntTest), "--foreground=true")
op, err := executeCommandC(
rootCmd,
"mount",
mntDir,
fmt.Sprintf("--config-file=%s", confFileMntTest),
"--foreground=true",
)
suite.assert.NotNil(err)
suite.assert.Contains(op, "mount directory already exists")

op, err = executeCommandC(rootCmd, "mount", mntDir, fmt.Sprintf("--config-file=%s", confFileMntTest), "-o", "nonempty", "--foreground=true")
op, err = executeCommandC(
rootCmd,
"mount",
mntDir,
fmt.Sprintf("--config-file=%s", confFileMntTest),
"-o",
"nonempty",
"--foreground=true",
)
suite.assert.NotNil(err)
suite.assert.Contains(op, "mount directory already exists")
}
Expand All @@ -137,11 +164,24 @@ func (suite *mountTestSuite) TestForegroundMountDirNotEmpty() {
func (suite *mountTestSuite) TestForegroundMountPathNotProvided() {
defer suite.cleanupTest()

op, err := executeCommandC(rootCmd, "mount", "", fmt.Sprintf("--config-file=%s", confFileMntTest), "--foreground=true")
op, err := executeCommandC(
rootCmd,
"mount",
"",
fmt.Sprintf("--config-file=%s", confFileMntTest),
"--foreground=true",
)
suite.assert.NotNil(err)
suite.assert.Contains(op, "mount path not provided")

op, err = executeCommandC(rootCmd, "mount", "all", "", fmt.Sprintf("--config-file=%s", confFileMntTest), "--foreground=true")
op, err = executeCommandC(
rootCmd,
"mount",
"all",
"",
fmt.Sprintf("--config-file=%s", confFileMntTest),
"--foreground=true",
)
suite.assert.NotNil(err)
suite.assert.Contains(op, "mount path not provided")
}
Expand All @@ -163,7 +203,13 @@ func (suite *mountTestSuite) TestForegroundConfigFileTypeUnsupported() {

mntDir := "mntdir"

op, err := executeCommandC(rootCmd, "mount", mntDir, "--config-file=cfgInvalid.yam", "--foreground=true")
op, err := executeCommandC(
rootCmd,
"mount",
mntDir,
"--config-file=cfgInvalid.yam",
"--foreground=true",
)
suite.assert.NotNil(err)
suite.assert.Contains(op, "invalid config file")
suite.assert.Contains(op, "Unsupported Config Type")
Expand All @@ -175,12 +221,25 @@ func (suite *mountTestSuite) TestForegroundConfigFileNotFound() {

mntDir := "mntdir"

op, err := executeCommandC(rootCmd, "mount", mntDir, "--config-file=cfgNotFound.yaml", "--foreground=true")
op, err := executeCommandC(
rootCmd,
"mount",
mntDir,
"--config-file=cfgNotFound.yaml",
"--foreground=true",
)
suite.assert.NotNil(err)
suite.assert.Contains(op, "invalid config file")
suite.assert.Contains(op, "cannot find the file specified")

op, err = executeCommandC(rootCmd, "mount", "all", mntDir, "--config-file=cfgNotFound.yaml", "--foreground=true")
op, err = executeCommandC(
rootCmd,
"mount",
"all",
mntDir,
"--config-file=cfgNotFound.yaml",
"--foreground=true",
)
suite.assert.NotNil(err)
suite.assert.Contains(op, "invalid config file")
suite.assert.Contains(op, "cannot find the file specified")
Expand Down Expand Up @@ -233,7 +292,14 @@ func (suite *mountTestSuite) TestForegroundInvalidLogLevel() {

mntDir := "mntdir"

op, err := executeCommandC(rootCmd, "mount", mntDir, fmt.Sprintf("--config-file=%s", confFileMntTest), "--log-level=debug", "--foreground=true")
op, err := executeCommandC(
rootCmd,
"mount",
mntDir,
fmt.Sprintf("--config-file=%s", confFileMntTest),
"--log-level=debug",
"--foreground=true",
)
suite.assert.NotNil(err)
suite.assert.Contains(op, "invalid log level")
}
Expand All @@ -245,9 +311,21 @@ func (suite *mountTestSuite) TestForegroundInvalidUmaskValue() {
mntDir := "mntdir"

// incorrect umask value
op, err := executeCommandC(rootCmd, "mount", mntDir, fmt.Sprintf("--config-file=%s", confFileMntTest), "--foreground=true",
"-o allow_other", "-o attr_timeout=120", "-o entry_timeout=120", "-o negative_timeout=120",
"-o ro", "-o allow_root", "-o default_permissions", "-o umask=abcd")
op, err := executeCommandC(
rootCmd,
"mount",
mntDir,
fmt.Sprintf("--config-file=%s", confFileMntTest),
"--foreground=true",
"-o allow_other",
"-o attr_timeout=120",
"-o entry_timeout=120",
"-o negative_timeout=120",
"-o ro",
"-o allow_root",
"-o default_permissions",
"-o umask=abcd",
)
suite.assert.NotNil(err)
suite.assert.Contains(op, "failed to parse umask")
}
Expand Down
Loading
Loading