Skip to content

fixes #1564 usr home #1582

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
18 changes: 16 additions & 2 deletions src/cmd/create.go
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ import (
"errors"
"fmt"
"os"
"os/user"
"path/filepath"
"strings"
"time"
@@ -300,13 +301,26 @@ func createContainer(container, image, release, authFile string, showCommandToEn

dbusSystemSocketMountArg := dbusSystemSocket + ":" + dbusSystemSocket

homeDirEvaled, err := filepath.EvalSymlinks(currentUser.HomeDir)
user, err := user.Current()
if err != nil{
logrus.Errorf("Failed to get HOME directory: %v", err)
}
homeDir := user.HomeDir
resolvedPath, err := filepath.EvalSymlinks(HomeDir)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be homeDir, not HomeDir. This is causing:

cmd/create.go:308:2: declared and not used: homeDir
cmd/create.go:309:45: undefined: HomeDir

if err != nil{
logrus.Errorf("Failed to evaluate symlinks for HOME directory: %v", err)
return err
}


/*homeDirEvaled = os.UserHomeDir()
homeDirEvaled, err := filepath.EvalSymlinks(homeDirEvaled)
if err != nil {
return fmt.Errorf("failed to canonicalize %s", currentUser.HomeDir)
}

logrus.Debugf("%s canonicalized to %s", currentUser.HomeDir, homeDirEvaled)
homeDirMountArg := homeDirEvaled + ":" + homeDirEvaled + ":rslave"
homeDirMountArg := homeDirEvaled + ":" + homeDirEvaled + ":rslave"*/

var avahiSocketMount []string

1 change: 1 addition & 0 deletions src/cmd/help.go
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@ import (
"errors"
"fmt"
"os"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: stray newline.


"github.com/containers/toolbox/pkg/utils"
"github.com/spf13/cobra"
1 change: 1 addition & 0 deletions src/cmd/rootMigrationPath.go
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@ import (
"errors"
"fmt"
"os"
"os/user"
"strings"

"github.com/containers/toolbox/pkg/utils"
3 changes: 2 additions & 1 deletion src/cmd/run.go
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ import (
"fmt"
"io"
"os"
"os/user"
"path/filepath"
"strconv"
"strings"
@@ -441,7 +442,7 @@ func runCommandWithFallbacks(container string,

workDir = runFallbackWorkDirs[runFallbackWorkDirsIndex]
if workDir == "" {
workDir = currentUser.HomeDir
workDir = user.Current()
}

fmt.Fprintf(os.Stderr, "Using %s instead.\n", workDir)
1 change: 0 additions & 1 deletion src/cmd/utils.go
Original file line number Diff line number Diff line change
@@ -26,7 +26,6 @@ import (
"io"
"os"
"os/exec"
"os/user"
"path/filepath"
"strings"
"syscall"