system/tmpfiles: do not fail for smaller files
All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Sandbox (push) Successful in 2m23s
Test / Hpkg (push) Successful in 4m9s
Test / Sandbox (race detector) (push) Successful in 4m31s
Test / Hakurei (race detector) (push) Successful in 5m15s
Test / Hakurei (push) Successful in 2m11s
Test / Flake checks (push) Successful in 1m27s
All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Sandbox (push) Successful in 2m23s
Test / Hpkg (push) Successful in 4m9s
Test / Sandbox (race detector) (push) Successful in 4m31s
Test / Hakurei (race detector) (push) Successful in 5m15s
Test / Hakurei (push) Successful in 2m11s
Test / Flake checks (push) Successful in 1m27s
The limit is meant to be an upper bound. Handle EOF and print verbose message for it instead of failing. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -1,12 +1,20 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/fs"
|
||||
"os"
|
||||
|
||||
"hakurei.app/system/acl"
|
||||
"hakurei.app/system/dbus"
|
||||
)
|
||||
|
||||
type osFile interface {
|
||||
Name() string
|
||||
io.Writer
|
||||
fs.File
|
||||
}
|
||||
|
||||
// syscallDispatcher provides methods that make state-dependent system calls as part of their behaviour.
|
||||
// syscallDispatcher is embedded in [I], so all methods must be unexported.
|
||||
type syscallDispatcher interface {
|
||||
@@ -15,6 +23,10 @@ type syscallDispatcher interface {
|
||||
// just synchronising access is not enough, as this is for test instrumentation.
|
||||
new(f func(k syscallDispatcher))
|
||||
|
||||
// stat provides os.Stat.
|
||||
stat(name string) (os.FileInfo, error)
|
||||
// open provides [os.Open].
|
||||
open(name string) (osFile, error)
|
||||
// mkdir provides os.Mkdir.
|
||||
mkdir(name string, perm os.FileMode) error
|
||||
// chmod provides os.Chmod.
|
||||
@@ -48,6 +60,8 @@ type direct struct{}
|
||||
|
||||
func (k direct) new(f func(k syscallDispatcher)) { go f(k) }
|
||||
|
||||
func (k direct) stat(name string) (os.FileInfo, error) { return os.Stat(name) }
|
||||
func (k direct) open(name string) (osFile, error) { return os.Open(name) }
|
||||
func (k direct) mkdir(name string, perm os.FileMode) error { return os.Mkdir(name, perm) }
|
||||
func (k direct) chmod(name string, mode os.FileMode) error { return os.Chmod(name, mode) }
|
||||
func (k direct) link(oldname, newname string) error { return os.Link(oldname, newname) }
|
||||
|
||||
Reference in New Issue
Block a user