Closed d0n601 closed 3 months ago
From the golang 1.23 os/file.go
// Flags to OpenFile wrapping those of the underlying system. Not all
// flags may be implemented on a given system.
const (
// Exactly one of O_RDONLY, O_WRONLY, or O_RDWR must be specified.
O_RDONLY int = syscall.O_RDONLY // open the file read-only.
O_WRONLY int = syscall.O_WRONLY // open the file write-only.
O_RDWR int = syscall.O_RDWR // open the file read-write.
// The remaining values may be or'ed in to control behavior.
O_APPEND int = syscall.O_APPEND // append data to the file when writing.
O_CREATE int = syscall.O_CREAT // create a new file if none exists.
O_EXCL int = syscall.O_EXCL // used with O_CREATE, file must not exist.
O_SYNC int = syscall.O_SYNC // open for synchronous I/O.
O_TRUNC int = syscall.O_TRUNC // truncate regular writable file when opened.
)
Which makes me think that we might want to call MkdirAll function before creating a file
What happened?
Executing the
create_file
step fails when the path contains a directory or subdirectory that does not exist.Steps to Reproduce
/tmp
that does not exist./tmp/folder_does_not_exist/ttpforge_create_file_GMAdvgIrzT: no such file or directory
.Expected Behavior
createfile_test.go
indicates on Lines 54-60 that this functionality should not fail, and instead should create the necessary subdirectories.Any suggestions for fixing this bug?
This seems like an issue between how Afero works, and how the OS file system is working here.
More TBD
Relevant log output