std: migrate all fs APIs to Io #30232
No reviewers
Labels
No labels
abi/f32
abi/ilp32
abi/n32
abi/sf
abi/x32
accepted
arch/1750a
arch/21k
arch/6502
arch/a29k
arch/aarch64
arch/alpha
arch/amdgcn
arch/arc
arch/arc32
arch/arc64
arch/arm
arch/avr
arch/avr32
arch/bfin
arch/bpf
arch/clipper
arch/colossus
arch/cr16
arch/cris
arch/csky
arch/dlx
arch/dsp16xx
arch/elxsi
arch/epiphany
arch/fr30
arch/frv
arch/h8300
arch/h8500
arch/hexagon
arch/hppa
arch/hppa64
arch/i370
arch/i860
arch/i960
arch/ia64
arch/ip2k
arch/kalimba
arch/kvx
arch/lanai
arch/lm32
arch/loongarch32
arch/loongarch64
arch/m32r
arch/m68k
arch/m88k
arch/maxq
arch/mcore
arch/metag
arch/microblaze
arch/mips
arch/mips64
arch/mmix
arch/mn10200
arch/mn10300
arch/moxie
arch/mrisc32
arch/msp430
arch/nds32
arch/nios2
arch/ns32k
arch/nvptx
arch/or1k
arch/pdp10
arch/pdp11
arch/pj
arch/powerpc
arch/powerpc64
arch/propeller
arch/riscv32
arch/riscv64
arch/rl78
arch/rx
arch/s390
arch/s390x
arch/sh
arch/sh64
arch/sparc
arch/sparc64
arch/spirv
arch/spu
arch/st200
arch/starcore
arch/tilegx
arch/tilepro
arch/tricore
arch/ts
arch/ubicom8
arch/v850
arch/vax
arch/vc4
arch/ve
arch/wasm
arch/we32k
arch/x86
arch/x86_64
arch/xcore
arch/xgate
arch/xstormy16
arch/xtensa
autodoc
backend/c
backend/llvm
backend/self-hosted
binutils
breaking
build system
debug info
docs
error message
frontend
fuzzing
incremental
lib/c
lib/compiler-rt
lib/cxx
lib/std
lib/tsan
lib/ubsan-rt
lib/unwind
linking
miscompilation
os/aix
os/android
os/bridgeos
os/contiki
os/dragonfly
os/driverkit
os/emscripten
os/freebsd
os/fuchsia
os/haiku
os/hermit
os/hurd
os/illumos
os/ios
os/kfreebsd
os/linux
os/maccatalyst
os/macos
os/managarm
os/netbsd
os/ohos
os/openbsd
os/plan9
os/redox
os/rtems
os/serenity
os/solaris
os/tvos
os/uefi
os/visionos
os/wali
os/wasi
os/watchos
os/windows
os/zos
proposal
release notes
testing
tier system
zig cc
zig fmt
bounty
bug
contributor-friendly
downstream
enhancement
infra
optimization
question
regression
upstream
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ziglang/zig!30232
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "std.Io-fs"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This branch deletes
std.fs.Filein favor ofstd.Io.Fileandstd.fs.Dirin favor ofstd.Io.Dir, as well as moving almost allstd.fsAPI intostd.Io.Dir.The main purpose is to integrate file system I/O with the
std.Iointerface, which is a major part of #30150.I also took advantage of the breakage to rename a number of file system APIs for consistency.
Upgrade Guide
Although it's a lot of breaking changes, unlike "writergate", this changeset is expected to be generally easy for Zig programmers to manage, because it does not require much critical thinking. For example, typical upgrade path will look something like this:
Although your upgrade diff might be large, it will be quite simple to understand what needs to be done.
Added:
std.Io.Dir.hardLinkstd.Io.Dir.Readerstd.Io.Dir.setFilePermissionsstd.Io.Dir.setFileOwnerstd.Io.File.NLinkRemoved with no replacement:
std.fs.realpathZstd.fs.realpathWstd.fs.realpathW2std.fs.makeDirAbsoluteZstd.fs.deleteDirAbsoluteZstd.fs.openDirAbsoluteZstd.fs.renameAbsoluteZstd.fs.renameZstd.fs.deleteTreeAbsolutestd.fs.symLinkAbsoluteWstd.fs.Dir.realpathZstd.fs.Dir.realpathWstd.fs.Dir.realpathW2std.fs.Dir.deleteFileZstd.fs.Dir.deleteFileWstd.fs.Dir.deleteDirZstd.fs.Dir.deleteDirWstd.fs.Dir.renameZstd.fs.Dir.renameWstd.fs.Dir.symLinkWasistd.fs.Dir.symLinkZstd.fs.Dir.symLinkWstd.fs.Dir.readLinkWasistd.fs.Dir.readLinkZstd.fs.Dir.readLinkWstd.fs.Dir.adaptToNewApistd.fs.Dir.adaptFromNewApistd.fs.File.isCygwinPtystd.fs.File.adaptToNewApistd.fs.File.adaptFromNewApiChanged:
Many functions now have a
std.Ioparameter.std.fs.copyFileAbsolute->std.Io.Dir.copyFileAbsolutestd.fs.makeDirAbsolute->std.Io.Dir.createDirAbsolutestd.fs.deleteDirAbsolute->std.Io.Dir.deleteDirAbsolutestd.fs.openDirAbsolute->std.Io.Dir.openDirAbsolutestd.fs.openFileAbsolute->std.Io.Dir.openFileAbsolutestd.fs.accessAbsolute->std.Io.Dir.accessAbsolutestd.fs.createFileAbsolute->std.Io.Dir.createFileAbsolutestd.fs.deleteFileAbsolute->std.Io.Dir.deleteFileAbsolutestd.fs.renameAbsolute->std.Io.Dir.renameAbsolutestd.fs.readLinkAbsolute->std.Io.Dir.readLinkAbsolutestd.fs.symLinkAbsolute->std.Io.Dir.symLinkAbsolutestd.fs.has_executable_bit->std.Io.File.Permissions.has_executable_bitstd.fs.realpath->std.Io.Dir.realPathFileAbsolutestd.fs.rename->std.Io.Dir.renamestd.fs.cwd->std.Io.Dir.cwdstd.fs.defaultWasiCwd->std.os.defaultWasiCwdstd.fs.realpathAlloc->std.Io.Dir.realPathFileAbsoluteAllocstd.fs.openSelfExe->std.process.openExecutablestd.fs.selfExePathAlloc->std.process.executablePathAllocstd.fs.selfExePath->std.process.executablePathstd.fs.selfExeDirPath->std.process.executableDirPathstd.fs.selfExeDirPathAlloc->std.process.executableDirPathAllocstd.fs.Dir.setAsCwd->std.process.setCurrentDirstd.fs.Dir.realpath->std.Io.Dir.realPathFilestd.fs.Dir.realpathAlloc->std.Io.Dir.realPathFileAllocstd.fs.Dir->std.Io.Dirstd.fs.File->std.Io.Filestd.fs.Dir.makeDir->std.Io.Dir.createDirstd.fs.Dir.makePath->std.Io.Dir.createDirPathstd.fs.Dir.makeOpenDir->std.Io.Dir.createDirPathOpenstd.fs.Dir.rename: now accepts twoDirparameters (plusIo)std.fs.Dir.atomicSymLink->std.Io.Dir.symLinkAtomicstd.fs.Dir.chmod->std.Io.Dir.setPermissionsstd.fs.Dir.chown->std.Io.Dir.setOwnerstd.fs.File.Mode->std.Io.File.Permissionsstd.fs.File.PermissionsWindows->std.Io.File.Permissionsstd.fs.File.PermissionsUnix->std.Io.File.Permissionsstd.fs.File.default_mode->std.Io.File.Permissions.default_filestd.fs.File.getOrEnableAnsiEscapeSupport->std.Io.File.enableAnsiEscapeCodesstd.fs.File.setEndPos->std.Io.File.setLengthstd.fs.File.getEndPos->std.Io.File.lengthstd.fs.File.seekTo,std.fs.File.seekBy,std.fs.File.seekFromEnd->std.Io.File.Reader.seekTo,std.Io.File.Reader.seekBy,std.Io.File.Writer.seekTostd.fs.File.getPos->std.Io.File.Reader.logicalPos,std.Io.Writer.logicalPosstd.fs.File.mode()->std.Io.File.stat().permissions.toModestd.fs.File.chmod->std.Io.File.setPermissionsstd.fs.File.chown->std.Io.File.setOwnerstd.fs.File.updateTimes->std.Io.File.setTimestamps,std.Io.File.setTimestampsNowstd.fs.File.read->std.Io.File.readStreamingstd.fs.File.readv->std.Io.File.readStreamingstd.fs.File.pread->std.Io.File.readPositionalstd.fs.File.preadv->std.Io.File.readPositionalstd.fs.File.preadAll->std.Io.File.readPositionalAllstd.fs.File.write->std.Io.File.writeStreamingstd.fs.File.writev->std.Io.File.writeStreamingstd.fs.File.pwrite->std.Io.File.writePositionalstd.fs.File.pwritev->std.Io.File.writePositionalstd.fs.File.writeAll->std.Io.File.writeStreamingAllstd.fs.File.pwriteAll->std.Io.File.writePositionalAllstd.fs.File.copyRange,std.fs.File.copyRangeAll->std.Io.File.writerDeprecated:
std.fs.path->std.Io.Dir.pathstd.fs.max_path_bytes->std.Io.Dir.max_path_bytesstd.fs.max_name_bytes->std.Io.Dir.max_name_bytesstd.ProgressNoteAfter updating your application that uses
std.Progress:Make sure you have
defer root_progress_node.end();there. Before, if control flow got to the end of main(), start code would exit all threads, including thestd.Progressthread. Now, it is not a thread but a task, and you likely havedefer threaded.deinit();above there, which will wait until all tasks are finished. If your application hangs, double check that yourstd.Progress.starthave a matchingnode.end().Followup Tasks
closes https://github.com/ziglang/zig/issues/25738
closes #30131
closes #30189
closes #30593
e5c5b78399a8554912fb57390e70cbe8153cfd0aLots of these:
@jacobly shall I disable the test coverage, or do you want to land a fix prior to merging?
75e3903a70c9a609a61astd.Io.Threadedshould usefutexon OpenBSD #30063Another one:
I'm going to fully disable aarch64 backend tests for now.
27510854ced8460910b4f2ab220bdc60a1ba0a8fstd.posix.UnexpectedErrorreading certain symlinks on Windows #30164The
getLengthfunction doesn't exist instd.Io.File, however, I am able thelengthfunction for this functionality.Is there a typo here or should I create a PR renaming
lengthtogetLength?Thank you, it is a typo here
Just to have it documented here (for release notes): This breaks stack walking on freestanding by making things like
captureStackTraceimplicitly depend onstd.Options.debug_io.There, we, on freestanding, need to set
root.std_options_debug_ioto somestd.Iointerface that:debug.SelfInfo.can_unwind == true(iirc) and ourunwind_framefunction actually uses any function from the std.Io interfaceioparameter and only gives it tounwindFrame).Option 2 ("does not need to work") could be #30691.
This is a closed issue, could you make an open issue to track that problem, please?
fstest cases from otherwise obsoleted PRs #31437