Releases: magicant/yash-rs
Releases · magicant/yash-rs
yash-cli-0.2.0
[0.2.0] - 2024-12-14
Added
- A case branch now can be terminated with
;&
or;|
instead of;;
to fall
through to the next branch or to resume pattern matching from the next branch,
respectively.;&
is a POSIX.1-2024 feature, and;|
is an extension. For
compatibility with other shells,;;&
is also accepted as an alias for;|
. - Dollar-single-quotes are now supported as a form of quoting where backslash
escapes are recognized.- Currently, octal and hexadecimal escapes that expand to a value greater
than 127 are translated to a UTF-8 sequence for the corresponding Unicode
scalar value. This behavior does not conform to POSIX.1-2024 and is
subject to change. - As an extension to POSIX.1-2024, the shell also recognizes the
\u
and
\U
escapes for Unicode scalar values, and the\E
escape as a synonym
for\e
.
- Currently, octal and hexadecimal escapes that expand to a value greater
Changed
- The shell's syntax now allows
esac
as the first pattern of a case branch
as incase esac in (esac|case) echo ok; esac
. Previously, it was a syntax
error, but POSIX.1-2024 allows it. - The
bg
built-in now updates the!
special parameter to the process ID of
the background job, as required by POSIX.1-2024. - The
exec
built-in no longer exits the shell when the specified command is
not found in an interactive shell, as required by POSIX.1-2024.
Fixed
- The interactive shell now discards the entire line when a syntax error occurs
in the middle of a command line. Previously, it would continue parsing the
rest of the line, which could lead to confusing behavior.
yash-cli-0.1.0
[0.1.0] - 2024-09-29
This is the first non-beta release of yash-rs. This version implements most interactive shell features required by POSIX, except for command history and line editing.
Added
- The shell now runs the initialization file specified by the
ENV
environment
variable if it is set and the shell is interactive.
Changed
- The shell now rejects an invalid parameter as a syntax error. Specifically,
if a parameter starts with a digit but is not a valid number, the shell now
reports a syntax error instead of treating it as a variable. For example,
${1abc}
and${0_1}
are now syntax errors. - Improved error messages for some parameter expansion errors.
- Interactive shells now report updates to job status before showing the prompt.
- Interactive shells no longer exit on shell errors such as syntax errors.
- Interactive shells now ignore the
noexec
option. - Interactive shells now support the
ignoreeof
option. - Interactive shells now allow modifying the trap for signals that were ignored
on the shell startup.
Fixed
- When the shell cannot open a script specified by the command-line argument,
it now returns the exit status of 126 or 127 as required by POSIX. Previously,
it returned the exit status of 2.
yash-syntax-0.11.0
[0.11.0] - 2024-08-22
Added
- The following functions are now
const
:parser::lex::is_portable_name_char
parser::lex::is_special_parameter_char
- The
parser::lex::is_single_char_name
const function is added. - A new
syntax::Param
struct is introduced to represent a parameter in
parameter expansions (syntax::TextUnit::RawParam
andsyntax::BracedParam
).
New enum typessyntax::SpecialParam
andsyntax::ParamType
are added to
represent the details of the parameter. Note that the formersyntax::Param
struct is renamed tosyntax::BracedParam
. - The
parser::SyntaxError::InvalidParam
variant is added, which is returned
when a parameter expansion has an invalid name. - The
source::Source
enum is extended with new variantsVariableValue
,
InitFile
, andOther
.
Changed
syntax::Param
has been renamed tosyntax::BracedParam
.- The
syntax::TextUnit::RawParam
variant now has aparam: syntax::Param
field instead of aname: String
field. - The
syntax::BracedParam
struct (formerlysyntax::Param
) now has a
param: syntax::Param
field instead of aname: String
field. source::Source::label
now returns"<arithmetic_expansion>"
for
Source::Arith
. Previously, it returned"<arith>"
.- The
parser::lex::WordLexer::braced_param
method now returns
parser::SyntaxError::InvalidParam
if the parameter starts with a digit but
contains a non-digit character. - External dependency versions:
- Rust 1.77.0 → 1.79.0
yash-env-0.3.0
[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
, andSigmaskOp
types in thesystem
module - The
System
trait now has theofd_access
,get_and_set_nonblocking
,
getuid
,geteuid
,getgid
, andgetegid
methods. Mode
has been moved fromsystem::virtual
tosystem
and now has constants
with more human-friendly names, e.g.,USER_READ
andGROUP_WRITE
.- The
system::virtual::Inode
struct now has thestat
method. - The
system::virtual::FileBody
struct now has thetype
andsize
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
, andset_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 ofjob::Pid
. - The
stack::Frame
enum now has theInitFile
variant. - The crate now re-exports
unix_path
aspath
andunix_str
asstr
. - 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 ofnix::fcntl::FdFlag
.system::Mode
is no longer a re-export ofnix::sys::stat::Mode
.- All APIs that handle
std::path::Path
,std::path::PathBuf
,std::ffi::OsStr
,
andstd::ffi::OsString
now usepath::Path
,path::PathBuf
,str::OsStr
,
andstr::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 tosystem::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, theset_signal_handling
method has been
renamed toset_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
andfstatat
methods ofsystem::System
now return aStat
instead of anix::sys::stat::FileStat
. - The
system::System::fstatat
method now takes afollow_symlinks: bool
parameter instead of anAtFlags
parameter. - The
system::System::open
method has been redefined to takeOfdAccess
and
OpenFlag
parameters instead ofnix::fcntl::OFlag
. - The
system::System::isatty
method now returns abool
instead of a
system::Result<bool>
. - The
system::System::umask
method now takes and returns a value of the new
system::Mode
type. - The
system::System::sigmask
method now takes aSigmaskOp
parameter instead
of anix::sys::signal::SigmaskHow
parameter. - The
system::System::select
method now takesVec<io::Fd>
parameters instead
offd_set::FdSet
parameters. It also takes aDuration
instead of a
nix::sys::time::TimeSpec
for the optional timeout parameter. - The
dup
,fcntl_getfl
, andfcntl_setfl
methods ofsystem::System
now
operate on anEnumSet<FdFlag>
parameter instead of annix::fcntl::FdFlag
parameter. - The
getrlimit
andsetrlimit
methods ofsystem::System
now returns an
error of typesystem::Errno
instead ofstd::io::Error
. - In the
system::resource
module:- The
rlim_t
type has been renamed toLimit
. - The
RLIM_INFINITY
constant has been renamed toINFINITY
.
- The
- The
flags: enumset::EnumSet<FdFlag>
field of
yash_env::system::virtual::FdBody
has replaced
theflag: nix::fcntl::FdFlag
field. - The
system::virtual::INode
struct has been renamed toInode
. - The
system::virtual::OpenFileDescription::i_node
method has been renamed to
inode
and now returns a reference toRc<RefCell<Inode>>
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 inreaders
but not readable, or inwriters
but not writable. Previously, the method returned anEBADF
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 ofsystem::Mode
Removed
- The
system
module no longer reexportsnix::fcntl::AtFlags
,
nix::fcntl::OFlag
,nix::sys::stat::FileStat
,nix::sys::stat::SFlag
,
nix::sys::signal::SigmaskHow
, andnix::sys::time::TimeSpec
. - The
fcntl_getfl
andfcntl_setfl
methods from theSystem
trait - The
system::Errno
struct'slast
andclear
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<semantics::ExitStatus> for nix::sys::signal::Signal
impl From<job::Pid> for nix::unistd::Pid
impl From<nix::unistd::Pid> for job::Pid
impl From<system::resource::LimitPair> for nix::libc::rlimit
impl From<nix::libc::rlimit> for system::resource::LimitPair
- External dependencies:
- nix 0.27.0 (now an internal dependency with the "fs", "signal" and "user"
features enabled)
- nix 0.27.0 (now an internal dependency with the "fs", "signal" and "user"
yash-syntax-0.10.0
[0.10.0] - 2024-07-12
Added
source::Code::line_number
- This new method returns the line number of a particular character in the
code.
- This new method returns the line number of a particular character in the
alias::Glossary
- This new trait is now used as an interface to provide the parser with
alias definitions.
- This new trait is now used as an interface to provide the parser with
impl<T> input::Input for T where T: DerefMut<Target: input::Input>
- This new trait implementation allows more types to be used as input
sources, especially when it is used with a decorator that requires
another input source.
- This new trait implementation allows more types to be used as input
input::Context::is_first_line
- This new method allows changing the behavior of the input function
depending on whether the current line is the first line of the input. - The corresponding setter method
set_is_first_line
is also added.
- This new method allows changing the behavior of the input function
Changed
- External dependency versions:
- Rust 1.70.0 → 1.77.0
- annotate-snippets 0.10.0 → 0.11.4
source::Code::source
is nowRc<Source>
instead ofSource
.- This change is made to avoid cloning the
Source
object when theLexer
flushes its buffer and creates a newCode
object sharing the same
Source
. - The lexer constructor
Lexer::new
now takesRc<Source>
instead of
Source
. - The lexer constructor
Lexer::from_memory
now takes a generic parameter
that can be converted toRc<Source>
.
- This change is made to avoid cloning the
- The second argument of
parser::Parser::new
is now&dyn alias::Glossary
instead of&alias::AliasSet
.
Fixed
- Small performance improvements
yash-semantics-0.3.0
[0.3.0] - 2024-07-13
Added
read_eval_loop
- This function replaces the
ReadEvalLoop
struct and its methods.
It supports theyash_env::input::Echo
decorator by taking a
&RefCell<&mut Env>
.
- This function replaces the
ReadEvalLoop
now has themust_use
attribute.
Changed
- External dependency versions:
- Rust 1.75.0 → 1.77.0
- yash-syntax 0.9.0 → 0.10.0
Deprecated
ReadEvalLoop::set_verbose
in favor ofyash_env::input::Echo
Removed
- Internal dependencies:
- futures-util 0.3.28
Fixed
- Small performance improvements
yash-prompt-0.1.0
[0.1.0] - 2024-07-13
Added
- Initial implementation of the
yash-prompt
crate
yash-env-test-helper-0.1.0
[0.1.0] - 2024-07-12
Added
- Initial implementation of the
yash-env-test-helper
crate
yash-env-0.2.1
[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.
- This is a decorator of
input::FdReader
is now marked#[must_use]
.variable::VariableSet::get_scalar
- This is a convenience method that returns a scalar variable as a
Cow<str>
.
- This is a convenience method that returns a scalar variable as a
- 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
andimpl trap::SignalSystem for &SharedSystem
- This allows
SharedSystem
to be used as a system behind a non-mutable reference.
- This allows
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 ofinput::Echo
Fixed
stack::Stack::loop_count
no longer counts loops below aFrame::Trap(_)
frame.- Possible undefined behavior in
RealSystem::times
yash-cli-0.1.0-beta.2
[0.1.0-beta.2] - 2024-07-13
Added
- Internal dependencies:
- yash-prompt 0.1.0
Changed
- External dependency versions:
- Rust 1.75.0 → 1.77.0
- Internal dependency versions:
- yash-builtin 0.2.0 → 0.3.0
- yash-semantics 0.2.0 → 0.3.0
- yash-syntax 0.9.0 → 0.10.0
- The shell now shows the prompt before reading the input in the interactive mode.
To achieve this, thestartup::prepare_input
function now applies the
yash_prompt::Prompter
decorator to the returned source input. - The first argument to
startup::prepare_input
is nowenv: &'a RefCell<&mut Env>
instead ofsystem: &mut SharedSystem
. This change is to allow the function to
constructyash_env::input::Echo
for the returned source input.
Removed
startup::SourceInput::verbose
- The caller of
startup::prepare_input
is no longer responsible for setting
theverbose
flag of the read-eval loop. The behavior of the verbose option
is now implemented inyash_env::input::Echo
, which is included in
thestartup::SourceInput::input
field.
- The caller of
Fixed
- The break and continue built-ins no longer allow exiting a trap.
- The read built-in now shows a prompt when reading a continued line.
- The source built-in now echoes the input when the verbose shell option is set.
- The set built-in no longer sets the
SIGTTIN
,SIGTTOU
, andSIGTSTP
signals
to be ignored when invoked with the-m
option in a subshell of an
interactive shell.