Skip to content

Commit

Permalink
Merge pull request #373 from mutagen-io/v0152-backports
Browse files Browse the repository at this point in the history
all: v0.15.2 backports
  • Loading branch information
xenoscopic authored Aug 22, 2022
2 parents 53146a0 + 3b6e23a commit 40be189
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 11 deletions.
2 changes: 2 additions & 0 deletions pkg/agent/transport/ssh/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ func (t *sshTransport) ClassifyError(processState *os.ProcessState, errorOutput
return true, false, nil
} else if process.IsPOSIXShellCommandNotFound(processState) {
return true, false, nil
} else if process.OutputIsPOSIXCommandNotFound(errorOutput) {
return true, false, nil
} else if process.OutputIsWindowsInvalidCommand(errorOutput) {
// A Windows invalid command error doesn't necessarily indicate that
// the agent isn't installed, but instead usually indicates that we were
Expand Down
6 changes: 3 additions & 3 deletions pkg/api/models/forwarding/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ type Session struct {
Labels map[string]string `json:"labels,omitempty"`
// Paused indicates whether or not the session is paused.
Paused bool `json:"paused"`
// Status is the session status.
Status forwarding.Status `json:"status"`
// SessionState stores state fields relevant to running sessions. It is
// non-nil if and only if the session is unpaused.
*SessionState
}

// SessionState encodes fields relevant to unpaused sessions.
type SessionState struct {
// Status is the session status.
Status forwarding.Status `json:"status"`
// LastError is the last forwarding error to occur.
LastError string `json:"lastError,omitempty"`
// OpenConnections is the number of connections currently open and being
Expand Down Expand Up @@ -69,6 +69,7 @@ func (s *Session) loadFromInternal(state *forwarding.State) {
s.Name = state.Session.Name
s.Labels = state.Session.Labels
s.Paused = state.Session.Paused
s.Status = state.Status

// Propagate endpoint information.
s.Source.loadFromInternal(
Expand All @@ -90,7 +91,6 @@ func (s *Session) loadFromInternal(state *forwarding.State) {
s.SessionState = nil
} else {
s.SessionState = &SessionState{
Status: state.Status,
LastError: state.LastError,
OpenConnections: state.OpenConnections,
TotalConnections: state.TotalConnections,
Expand Down
6 changes: 3 additions & 3 deletions pkg/api/models/synchronization/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ type Session struct {
Labels map[string]string `json:"labels,omitempty"`
// Paused indicates whether or not the session is paused.
Paused bool `json:"paused"`
// Status is the session status.
Status synchronization.Status `json:"status"`
// SessionState stores state fields relevant to running sessions. It is
// non-nil if and only if the session is unpaused.
*SessionState
}

// SessionState encodes fields relevant to unpaused sessions.
type SessionState struct {
// Status is the session status.
Status synchronization.Status `json:"status"`
// LastError is the last synchronization error to occur.
LastError string `json:"lastError,omitempty"`
// SuccessfulCycles is the number of successful synchronization cycles to
Expand Down Expand Up @@ -68,6 +68,7 @@ func (s *Session) loadFromInternal(state *synchronization.State) {
s.Name = state.Session.Name
s.Labels = state.Session.Labels
s.Paused = state.Session.Paused
s.Status = state.Status

// Propagate endpoint information.
s.Alpha.loadFromInternal(
Expand All @@ -89,7 +90,6 @@ func (s *Session) loadFromInternal(state *synchronization.State) {
s.SessionState = nil
} else {
s.SessionState = &SessionState{
Status: state.Status,
LastError: state.LastError,
SuccessfulCycles: state.SuccessfulCycles,
Conflicts: exportConflicts(state.Conflicts),
Expand Down
2 changes: 1 addition & 1 deletion pkg/forwarding/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func (s Status) Description() string {
switch s {
case Status_Disconnected:
return "Waiting to connect"
return "Disconnected"
case Status_ConnectingSource:
return "Connecting to source"
case Status_ConnectingDestination:
Expand Down
2 changes: 1 addition & 1 deletion pkg/mutagen/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const (
// VersionMinor represents the current minor version of Mutagen.
VersionMinor = 15
// VersionPatch represents the current patch version of Mutagen.
VersionPatch = 1
VersionPatch = 2
// VersionTag represents a tag to be appended to the Mutagen version string.
// It must not contain spaces. If empty, no tag is appended to the version
// string.
Expand Down
17 changes: 16 additions & 1 deletion pkg/process/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,25 @@ import (
)

const (
windowsInvalidCommandFragment = "is not recognized as an internal or external command"
// posixCommandNotFoundFragment is a fragment of the error output returned
// on some POSIX shells when a command is not found. The capitalization of
// the word "command" is inconsistent between shells, so only part of the
// word is used.
posixCommandNotFoundFragment = "ommand not found"
// windowsInvalidCommandFragment is a fragment of the error output returned
// on Windows systems when a command is not recognized.
windowsInvalidCommandFragment = "is not recognized as an internal or external command"
// windowsCommandNotFoundFragment is a fragment of the error output returned
// on Windows systems when a command cannot be found.
windowsCommandNotFoundFragment = "The system cannot find the path specified"
)

// OutputIsPOSIXCommandNotFound returns whether or not a process' error output
// represents a command not found error on POSIX systems.
func OutputIsPOSIXCommandNotFound(output string) bool {
return strings.Contains(output, posixCommandNotFoundFragment)
}

// OutputIsWindowsInvalidCommand returns whether or not a process' error output
// represents an invalid command error on Windows.
func OutputIsWindowsInvalidCommand(output string) bool {
Expand Down
2 changes: 1 addition & 1 deletion pkg/synchronization/core/transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ func (t *transitioner) createSymbolicLink(parent *filesystem.Directory, name, pa
// seems to be something that Linux doesn't support in general (though it
// does support symbolic link ownership). Thus, we zero-out the mode bits on
// Linux to skip permission setting (while retaining ownership setting).
mode := markExecutableForReaders(t.defaultDirectoryPermissionMode)
mode := markExecutableForReaders(t.defaultFilePermissionMode)
if runtime.GOOS == "linux" {
mode = 0
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/synchronization/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func (s Status) Description() string {
switch s {
case Status_Disconnected:
return "Waiting to connect"
return "Disconnected"
case Status_HaltedOnRootEmptied:
return "Halted due to one-sided root emptying"
case Status_HaltedOnRootDeletion:
Expand Down

0 comments on commit 40be189

Please sign in to comment.