PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: threefoldtech/zos (go)

Issue:
provisiond: ZDB provision is broken
```
{
    "level": "error",
    "error": "failed to create 0-db container: failed to create container: OCI runtime create failed: container_linux.go:345: starting container process caused \"process_linux.go:430: container init caused \\\"rootfs_linux.go:58: mounting \\\\\\\"proc\\\\\\\" to rootfs \\\\\\\"/var/cache/modules/flistd/mountpoint/278a0299f935ebc5a1ed219e45e67274bf84c50283bb53e439e6629dd5bc775b\\\\\\\" at \\\\\\\"/proc\\\\\\\" caused \\\\\\\"mkdir /var/cache/modules/flistd/mountpoint/278a0299f935ebc5a1ed219e45e67274bf84c50283bb53e439e6629dd5bc775b/proc: read-only file system\\\\\\\"\\\"\": unknown",
    "time": "2019-11-22T08:00:03Z",
    "message": "failed to provision reservation 97-1"
}
```
I'm suspecting this is because we do a read-only mount of the flist now for ZDB container.

Pull request:
don't mount the root zdb flist as read only
fixes #394

Patch:
diff --git a/pkg/provision/zdb.go b/pkg/provision/zdb.go
index 58c267a3..a87cfb30 100644
--- a/pkg/provision/zdb.go
+++ b/pkg/provision/zdb.go
@@ -220,7 +220,10 @@ func createZdbContainer(ctx context.Context, name string, mode pkg.ZDBMode, volu
 	)
 
 	slog.Debug().Str("flist", zdbFlistURL).Msg("mounting flist")
-	rootFS, err := flist.Mount(zdbFlistURL, "", pkg.ReadOnlyMountOptions)
+	rootFS, err := flist.Mount(zdbFlistURL, "", pkg.MountOptions{
+		Limit:    10,
+		ReadOnly: false,
+	})
 	if err != nil {
 		return nil, err
 	}


Test patch:
diff --git a/pkg/provision/zdb_test.go b/pkg/provision/zdb_test.go
index 7401ef1e..20e9e745 100644
--- a/pkg/provision/zdb_test.go
+++ b/pkg/provision/zdb_test.go
@@ -166,7 +166,10 @@ func TestZDBProvisionNoMappingContainerDoesNotExists(t *testing.T) {
 	client.On("Request", "flist", zbus.ObjectID{Name: "flist", Version: "0.0.1"},
 		"Mount",
 		"https://hub.grid.tf/tf-autobuilder/threefoldtech-0-db-development.flist",
-		"", pkg.ReadOnlyMountOptions).Return("/path/to/volume", nil)
+		"", pkg.MountOptions{
+			Limit:    10,
+			ReadOnly: false,
+		}).Return("/path/to/volume", nil)
 
 	client.On("Request", "network", zbus.ObjectID{Name: "network", Version: "0.0.1"},
 		"ZDBPrepare").Return("net-ns", nil)
Repository: helm/helm (go)

Issue:
 Extra newline being added when using "range .Files.Lines <filename>"
Exactly as in #3617. Templates generated with `range .Files.Lines <filename>` pretend like there is an empty line at the end of the file, but there isn't. For example:

paths.list:
```
/api/v1
/api/v2
```
with template
```
{{- range .Files.Lines "paths.list" }}
- path: {{ . }}
  pathType: ImplementationSpecific
{{- end }}
```
produces
```
- path: /api/v1
  pathType: ImplementationSpecific
- path: /api/v2
  pathType: ImplementationSpecific
- path: 
  pathType: ImplementationSpecific
```

Output of `helm version`: `version.BuildInfo{Version:"v3.7.2", GitCommit:"663a896f4a815053445eec4153677ddc24a0a361", GitTreeState:"clean", GoVersion:"go1.16.10"}`


Pull request:
strip trailing newline from Files.Lines
**What this PR does / why we need it**:
A trailing newline in a file would produce an extra empty list entry when using Files.Lines

**Special notes for your reviewer**:

**If applicable**:
- [ ] this PR contains documentation
- [x] this PR contains unit tests
- [ ] this PR has been tested for backwards compatibility

Fixes #10561 

Patch:
diff --git a/pkg/engine/files.go b/pkg/engine/files.go
index f29b0ab7c..f2cfdb3f3 100644
--- a/pkg/engine/files.go
+++ b/pkg/engine/files.go
@@ -131,7 +131,7 @@ func (f files) AsConfig() string {
 //
 //	data:
 //
-// {{ .Files.Glob("secrets/*").AsSecrets() }}
+// {{ .Files.Glob("secrets/*").AsSecrets() | indent 4 }}
 func (f files) AsSecrets() string {
 	if f == nil {
 		return ""
@@ -157,6 +157,9 @@ func (f files) Lines(path string) []string {
 	if f == nil || f[path] == nil {
 		return []string{}
 	}
-
-	return strings.Split(string(f[path]), "\n")
+	s := string(f[path])
+	if s[len(s)-1] == '\n' {
+		s = s[:len(s)-1]
+	}
+	return strings.Split(s, "\n")
 }


Test patch:
diff --git a/pkg/engine/files_test.go b/pkg/engine/files_test.go
index 4b37724f9..e53263c76 100644
--- a/pkg/engine/files_test.go
+++ b/pkg/engine/files_test.go
@@ -28,7 +28,8 @@ var cases = []struct {
 	{"ship/stowaway.txt", "Legatt"},
 	{"story/name.txt", "The Secret Sharer"},
 	{"story/author.txt", "Joseph Conrad"},
-	{"multiline/test.txt", "bar\nfoo"},
+	{"multiline/test.txt", "bar\nfoo\n"},
+	{"multiline/test_with_blank_lines.txt", "bar\nfoo\n\n\n"},
 }
 
 func getTestFiles() files {
@@ -96,3 +97,15 @@ func TestLines(t *testing.T) {
 
 	as.Equal("bar", out[0])
 }
+
+func TestBlankLines(t *testing.T) {
+	as := assert.New(t)
+
+	f := getTestFiles()
+
+	out := f.Lines("multiline/test_with_blank_lines.txt")
+	as.Len(out, 4)
+
+	as.Equal("bar", out[0])
+	as.Equal("", out[3])
+}