Skip to content

Commit

Permalink
Merge branch 'main' into cras
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Jan 18, 2025
2 parents ad95f5f + 0813f99 commit d8797ef
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ orbs:
parameters:
go-version:
type: string
default: '1.23.4'
default: '1.23.5'

executors:
node:
Expand Down
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ _**NOTE:** if you are updating Go from a older version, make sure you remove
`/usr/local/go` before reinstalling it._

```sh
export VERSION=1.23.4 OS=linux ARCH=amd64 # change this as you need
export VERSION=1.23.5 OS=linux ARCH=amd64 # change this as you need

wget -O /tmp/go${VERSION}.${OS}-${ARCH}.tar.gz \
https://dl.google.com/go/go${VERSION}.${OS}-${ARCH}.tar.gz
Expand Down
28 changes: 17 additions & 11 deletions internal/pkg/util/fs/files/passwd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
package files

import (
"fmt"
"os"
"os/user"
"path/filepath"
"strings"
"testing"

"github.com/sylabs/singularity/v4/internal/pkg/test"
"gotest.tools/v3/golden"
)

func TestPasswd(t *testing.T) {
Expand All @@ -26,29 +28,33 @@ func TestPasswd(t *testing.T) {
t.Errorf("should have failed with bad passwd file")
}

// Test how Passwd() works with an empty file
// Adding current user to an empty file
f, err := os.CreateTemp("", "empty-passwd-")
if err != nil {
t.Error(err)
t.Fatal(err)
}
emptyPasswd := f.Name()
defer os.Remove(emptyPasswd)
f.Close()

_, err = Passwd(emptyPasswd, "/home", uid, nil)
if err != nil {
t.Error(err)
t.Fatalf("Unexpected error in Passwd() when adding uid %d: %v", uid, err)
}

// Modifying root user in test file
inputPasswdFilePath := filepath.Join(".", "testdata", "passwd.in")
testUID := 0
testHomeDir := "/tmp"
testGoldenFile := "passwd.root.customhome.golden"
bytes, err := Passwd(inputPasswdFilePath, testHomeDir, testUID, nil)
outputPasswd, err := Passwd(inputPasswdFilePath, "/tmp", 0, nil)
if err != nil {
t.Errorf("Unexpected error encountered calling Passwd(): %v", err)
return
t.Fatalf("Unexpected error in Passwd() when modifying root entry: %v", err)
}

golden.Assert(t, string(bytes), testGoldenFile, "mismatch in Passwd() invocation (uid: %d; requested homeDir: %#v)", testUID, testHomeDir)
rootUser, err := user.Lookup("root")
if err != nil {
t.Fatal(err)
}
expectRootEntry := fmt.Sprintf("root:x:0:0:%s:/tmp:/bin/ash\n", rootUser.Name)
if !strings.HasPrefix(string(outputPasswd), expectRootEntry) {
t.Errorf("Expected root entry %q, not found in:\n%s", expectRootEntry, string(outputPasswd))
}
}
29 changes: 0 additions & 29 deletions internal/pkg/util/fs/files/testdata/passwd.root.customhome.golden

This file was deleted.

2 changes: 1 addition & 1 deletion third_party/conmon
2 changes: 1 addition & 1 deletion third_party/squashfuse

0 comments on commit d8797ef

Please sign in to comment.