# Changelog All notable changes to `yash-env` will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [0.4.0] - 2024-09-29 ### Added - `job::fmt::Accumulator` - This is a utility for formatting status reports of multiple jobs. - `input::Reporter` - This `Input` decorator reports job status changes to the user. - `input::IgnoreEof` - This `Input` decorator implements the behavior of the `ignoreeof` shell option. - `system::virtual::FileBody::Terminal` - This is a new variant of `FileBody` that represents a terminal device. - Internal dependencies: - yash-executor 1.0.0 ### Changed - The child process created by `system::real::RealSystem::new_child_process` now uses a new executor instead of reusing the executor inherited from the parent process. - `system::ChildProcessStarter` has been redefined as `Box Pid>`. The function now directly returns the PID of the child process instead of a future that resolves to the PID. - `system::virtual::FileBody` is now `non_exhaustive`. - `system::virtual::VirtualSystem::isatty` now returns true for a file descriptor associated with `FileBody::Terminal`. - `impl yash_syntax::input::Input` for `input::FdReader`, `input::Echo`, `input::IgnoreEof`, and `input::Reporter` now conforms to the new definition of the `next_line` method. - External dependency versions: - yash-syntax 0.11.0 → 0.12.0 ### Removed - The type parameter constraint `T: 'a` is removed from the declarations of `input::Echo<'a, 'b, T>` and `input::Reporter<'a, 'b, T>`. - The redundant lifetime constraint `T: 'a` is removed from the implementations of `yash_syntax::input::Input` for `input::Echo<'a, 'b, T>` and `input::Reporter<'a, 'b, T>`. - Internal dependencies: - async-trait 0.1.73 ## [0.3.0] - 2024-08-22 ### Added - This crate now builds on non-Unix platforms. However, `system::real::RealSystem` is only available on Unix platforms. - The `OfdAccess`, `OpenFlag`, `FdFlag`, `Mode`, `RawMode`, `Uid`, `RawUid`, `Gid`, `RawGid`, `FileType`, `Stat`, and `SigmaskOp` types in the `system` module - The `System` trait now has the `ofd_access`, `get_and_set_nonblocking`, `getuid`, `geteuid`, `getgid`, and `getegid` methods. - `Mode` has been moved from `system::virtual` to `system` and now has constants with more human-friendly names, e.g., `USER_READ` and `GROUP_WRITE`. - The `system::virtual::Inode` struct now has the `stat` method. - The `system::virtual::FileBody` struct now has the `type` and `size` methods. - The `system::virtual::Process` struct now has the getters/setters for the real/effective user/group IDs: `uid`, `set_uid`, `euid`, `set_euid`, `gid`, `set_gid`, `egid`, and `set_egid`. - `system::virtual::VirtualSystem::open` now applies the process's umask to the mode argument. - The `job::RawPid` type has been added to represent the contents of `job::Pid`. - The `stack::Frame` enum now has the `InitFile` variant. - The crate now re-exports `unix_path` as `path` and `unix_str` as `str`. - External dependencies: - enumset 1.1.2 (previously an internal dependency) - unix_path 1.0.1 - unix_str 1.0.0 - Internal dependencies: - bitflags 2.6.0 - nix 0.29.0 (with the "fs", "signal", and "user" features enabled) ### Changed - `system::FdFlag` is no longer a re-export of `nix::fcntl::FdFlag`. - `system::Mode` is no longer a re-export of `nix::sys::stat::Mode`. - All APIs that handle `std::path::Path`, `std::path::PathBuf`, `std::ffi::OsStr`, and `std::ffi::OsString` now use `path::Path`, `path::PathBuf`, `str::OsStr`, and `str::OsString` instead. - `system::DirEntry::name` - `system::System::confstr_path` - `system::System::getcwd` - `system::System::getpwnam_dir` - `system::System::open_tmpfile` - `system::virtual::FileBody::Directory::files` - `system::virtual::FileBody::Symlink::target` - `system::virtual::FileSystem::get` - `system::virtual::FileSystem::save` - `system::virtual::Process::chdir` - `system::virtual::SystemState::home_dirs` - `system::virtual::SystemState::path` - `system::virtual::VirtualDir::new` - `system::SignalHandling` has been renamed to `system::Disposition`. - In the `system::virtual::Process` struct, the following methods have been renamed: - `signal_handling` → `disposition` - `set_signal_handling` → `set_disposition` - In the `trap::SignalSystem` trait, the `set_signal_handling` method has been renamed to `set_disposition`. - In the `trap::TrapSet` struct, the following methods have been renamed: - `enable_sigchld_handler` → `enable_internal_disposition_for_sigchld` - `enable_terminator_handlers` → `enable_internal_dispositions_for_terminators` - `enable_stopper_handlers` → `enable_internal_dispositions_for_stoppers` - `disable_terminator_handlers` → `disable_internal_dispositions_for_terminators` - `disable_stopper_handlers` → `disable_internal_dispositions_for_stoppers` - `disable_internal_handlers` → `disable_internal_dispositions` - The `fstat` and `fstatat` methods of `system::System` now return a `Stat` instead of a `nix::sys::stat::FileStat`. - The `system::System::fstatat` method now takes a `follow_symlinks: bool` parameter instead of an `AtFlags` parameter. - The `system::System::open` method has been redefined to take `OfdAccess` and `OpenFlag` parameters instead of `nix::fcntl::OFlag`. - The `system::System::isatty` method now returns a `bool` instead of a `system::Result`. - The `system::System::umask` method now takes and returns a value of the new `system::Mode` type. - The `system::System::sigmask` method now takes a `SigmaskOp` parameter instead of a `nix::sys::signal::SigmaskHow` parameter. - The `system::System::select` method now takes `Vec` parameters instead of `fd_set::FdSet` parameters. It also takes a `Duration` instead of a `nix::sys::time::TimeSpec` for the optional timeout parameter. - The `dup`, `fcntl_getfl`, and `fcntl_setfl` methods of `system::System` now operate on an `EnumSet` parameter instead of an `nix::fcntl::FdFlag` parameter. - The `getrlimit` and `setrlimit` methods of `system::System` now returns an error of type `system::Errno` instead of `std::io::Error`. - In the `system::resource` module: - The `rlim_t` type has been renamed to `Limit`. - The `RLIM_INFINITY` constant has been renamed to `INFINITY`. - The `flags: enumset::EnumSet` field of `yash_env::system::virtual::FdBody` has replaced the `flag: nix::fcntl::FdFlag` field. - The `system::virtual::INode` struct has been renamed to `Inode`. - The `system::virtual::OpenFileDescription::i_node` method has been renamed to `inode` and now returns a reference to `Rc>` rather than a clone of it. - The `system::virtual::OpenFileDescription::seek` method now takes a `std::io::SeekFrom` parameter instead of an offset and whence pair. - The `system::virtual::VirtualSystem::select` method now treats as ready file descriptors that are contained in `readers` but not readable, or in `writers` but not writable. Previously, the method returned an `EBADF` error in these cases. - External dependency versions: - Rust 1.77.0 → 1.79.0 - yash-syntax 0.10.0 → 0.11.0 ### Deprecated - `system::virtual::Mode` in favor of `system::Mode` ### Removed - The `system` module no longer reexports `nix::fcntl::AtFlags`, `nix::fcntl::OFlag`, `nix::sys::stat::FileStat`, `nix::sys::stat::SFlag`, `nix::sys::signal::SigmaskHow`, and `nix::sys::time::TimeSpec`. - The `fcntl_getfl` and `fcntl_setfl` methods from the `System` trait - The `system::Errno` struct's `last` and `clear` methods are no longer public. - The `system::resource::Resource::as_raw_type` method is no longer public. - All the fields of the `system::virtual::OpenFileDescription` struct are now private. - The `system::fd_set` module - `impl TryFrom for nix::sys::signal::Signal` - `impl From for nix::unistd::Pid` - `impl From for job::Pid` - `impl From for nix::libc::rlimit` - `impl From for system::resource::LimitPair` - External dependencies: - nix 0.27.0 (now an internal dependency with the "fs", "signal" and "user" features enabled) ## [0.2.1] - 2024-07-12 ### Added - `Env::is_interactive` - `impl yash_system::alias::Glossary for Env` - `input::Echo` - This is a decorator of `Input` that implements the behavior of the verbose shell option. - `input::FdReader` is now marked `#[must_use]`. - `variable::VariableSet::get_scalar` - This is a convenience method that returns a scalar variable as a `Cow`. - Variable name constants in the `variable` module: `CDPATH`, `ENV`, `HOME`, `IFS`, `LINENO`, `OLDPWD`, `OPTARG`, `OPTIND`, `PATH`, `PPID`, `PS1`, `PS2`, `PS4`, `PWD` - Variable initial value constants in the `variable` module: `IFS_INITIAL_VALUE`, `OPTIND_INITIAL_VALUE`, `PS1_INITIAL_VALUE_NON_ROOT`, `PS1_INITIAL_VALUE_ROOT`, `PS2_INITIAL_VALUE`, `PS4_INITIAL_VALUE` - `impl System for &SharedSystem` and `impl trap::SignalSystem for &SharedSystem` - This allows `SharedSystem` to be used as a system behind a non-mutable reference. ### Changed - External dependency versions: - Rust 1.70.0 → 1.77.0 - yash-syntax 0.9.0 → 0.10.0 - Internal dependency versions: - annotate-snippets 0.10.0 → 0.11.4 - All inherent methods of `SharedSystem` now take `&self` instead of `&mut self`: - `SharedSystem::read_async` - `SharedSystem::write_all` - `SharedSystem::print_error` ### Deprecated - `input::FdReader::set_echo` in favor of `input::Echo` ### Fixed - `stack::Stack::loop_count` no longer counts loops below a `Frame::Trap(_)` frame. - Possible undefined behavior in `RealSystem::times` ## [0.2.0] - 2024-06-09 ### Added - `Env::errexit_is_applicable` - `System::shell_path` - `System::{validate_signal, signal_number_from_name}` - `SystemEx::signal_name_from_number` - `SystemEx::fd_is_pipe` - `SystemEx::set_blocking` - `job::ProcessResult` - `job::ProcessResult::{exited, is_stopped}` - `impl From for ExitStatus` - `job::ProcessState::Halted` - `job::ProcessState::{stopped, exited, is_stopped}` - `impl Hash for job::fmt::Marker` - `job::fmt::State` - `impl From for stack::Frame` - `signal::{Number, RawNumber, Name, NameIter, UnknownNameError}` - `trap::SignalSystem::signal_name_from_number` - `trap::SignalSystem::signal_number_from_name` - `ExitStatus::to_signal_number` ### Changed - External dependency versions - yash-syntax 0.8.0 → 0.9.0 - `stack::Frame` is now `non_exhaustive`. - `job::fmt::Report` has been totally rewritten. - `system::virtual::FileSystem::get` now fails with `EACCES` when search permission is denied for any directory component of the path. - `job::ProcessResult::{Stopped, Signaled}` now have associated values of type `signal::Number` instead of `trap::Signal`. - The following methods now operate on `signal::Number` instead of `trap::Signal`: - `Env::wait_for_signal` - `Env::wait_for_signals` - `job::ProcessState::stopped` - `system::System::caught_signals` - `system::System::kill` - `system::System::sigaction` - `system::System::sigmask` - `system::System::select` - `system::virtual::Process::blocked_signals` - `system::virtual::Process::pending_signals` - `system::virtual::Process::block_signals` - `system::virtual::Process::signal_handling` - `system::virtual::Process::set_signal_handling` - `trap::TrapSet::catch_signal` - `trap::TrapSet::take_caught_signal` - `trap::TrapSet::take_signal_if_caught` - `system::System::sigmask` now takes three parameters: 1. `&mut self,` 2. `op: Option<(SigmaskHow, &[signal::Number])>,` 3. `old_mask: Option<&mut Vec>,` - `system::virtual::SignalEffect::of` now takes a `signal::Number` parameter instead of a `trap::Signal`. This function is now `const`. - The type parameter constraint for `subshell::Subshell` is now `F: for<'a> FnOnce(&'a mut Env, Option) -> Pin + 'a>> + 'static`. The `Output` type of the returned future has been changed from `semantics::Result` to `()`. ### Removed - `job::ProcessState::{Exited, Signaled, Stopped}` in favor of `job::ProcessResult` - `job::ProcessState::{from_wait_status, to_wait_status}` - `impl std::fmt::Display for job::ProcessResult` - `impl std::fmt::Display for job::ProcessState` - `impl From for ExitStatus` - `semantics::apply_errexit` - `trap::Signal` - `trap::ParseConditionError` ### Fixed - `RealSystem::open_tmpfile` no longer returns a file descriptor with the `O_CLOEXEC` flag set. - `::is_executable_file` now uses `faccessat` with `AT_EACCESS` instead of `access` to check execute permission (except on Redox). ## [0.1.0] - 2024-04-13 ### Added - Initial implementation of the `yash-env` crate [0.4.0]: https://github.com/magicant/yash-rs/releases/tag/yash-env-0.4.0 [0.3.0]: https://github.com/magicant/yash-rs/releases/tag/yash-env-0.3.0 [0.2.1]: https://github.com/magicant/yash-rs/releases/tag/yash-env-0.2.1 [0.2.0]: https://github.com/magicant/yash-rs/releases/tag/yash-env-0.2.0 [0.1.0]: https://github.com/magicant/yash-rs/releases/tag/yash-env-0.1.0