| Age | Commit message (Collapse) | Author |
|
The shim's filesystem entry points took `&str` even though each one resolves
to a local path through `std::fs` or a syscall, so callers holding a `PathBuf`
had to stringify it at the call site. They now take `impl AsRef<Path>`, the
form `file_exists`, `is_dir`, `unlink` and the rest of the already-converted
set use.
`Phar`, `PharData` and `ZipArchive` keep their archive path as a `PathBuf`.
`PharData::compress` names the compressed sibling by appending the suffix to
the file name rather than formatting the path into a `String`.
Arguments PHP resolves through a stream wrapper (`fopen`, `file_put_contents`,
`include`) still take `&str`, as do the byte-string operations (`dirname`,
`basename`, `pathinfo`) and archive-internal entry names, which are `/`-joined
logical names rather than OS paths.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
Retag every Shirabe-authored TODO comment to one of the fixed tags:
phase-c, phase-d, plugin, php-runtime, phase-e.
Upstream-authored TODO comments from Composer/Symfony are left
untouched to preserve the ported code shape.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
Several shim functions were left as todo!() because the standard library
exposes no equivalent and no syscall crate was available. Adding nix
unblocks them:
- proc_open now wires descriptors beyond stderr, creating the pipe itself
and installing the child end with dup2(2) from pre_exec
- proc_terminate and posix_kill deliver arbitrary signals via kill(2)
- get_current_user reports the owner of the running executable
- php_uname answers every mode from uname(2) instead of only "s" and "r"
It also closes gaps that were previously approximated:
- fstat stats the stdio streams and pipes rather than reporting failure
- touch stamps mtime/atime on an existing path, including directories
- is_writable/is_executable use access(2) instead of permission bits
- umask falls back to the read-modify-write umask(2) off Linux
The hand-written repr(C) structs and extern "C" declarations for getpwuid,
utime, statvfs, fcntl and select are replaced by their nix wrappers, which
in turn lets disk_free_space drop its Linux-only cfg.
cli_set_process_title, setproctitle and the pcntl_signal pair stay as
todo!(): the first two need access to the process's own argv block, and
the latter two depend on the signal-handling subsystem rather than on
sigaction(2) itself.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
The audit in .ken/php-shim-copying.md judged 14 functions in
shirabe-php-shim (plus php_wordwrap in shirabe-external-packages) to be
line-by-line transcriptions or structural imitations of php-src. PHP's
relicensing to 3-clause BSD makes keeping them legal, but the boundary
between BSD-derived and MIT code was invisible in the source tree.
Moving them into their own crate puts the license into the build
metadata (so NOTICE generation follows the binary), makes a reverse
dependency a compile error, and encodes the origin in the module path,
which mirrors php-src's ext tree. Each function records its origin in a
fixed-format doc comment, and a new php_src_derivation_boundary linter
fails if `php-src` appears in any Rust source outside the crate.
Public paths under shirabe_php_shim:: are unchanged: functions that are
themselves derived are re-exported with `pub use`, and the wrappers that
only validate arguments stay on the MIT side.
This also resolves the duplicate wordwrap implementation.
shirabe_php_shim::wordwrap was todo!(), so SymfonyStyle::block panicked,
while shirabe-external-packages carried its own copy. Both now go
through the single port, verified against real PHP on 13 cases covering
multi-character breaks and cut.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
Since Process is php-native with no Rust-fidelity obligation (see
plugin-class-classification.md), this port only needs to cover what
Rust-ported Composer code actually calls. Made the pipes/process_utils
modules pub(crate) (nothing outside symfony/process used them) and
rebuilt with `--force-warn dead_code` (normally allowed workspace-wide)
to find genuinely unreachable methods: Process lost 17 methods, 5
constants, and a private clone helper; ExecutableFinder lost two unused
suffix setters; AbstractPipes lost handle_error, whose only caller (a
stream_select error-handler registration) was never wired up.
Removing several of those setters (set_pty, set_idle_timeout,
disable_output/enable_output, set_options) then left the fields they
used to write with no remaining writer, so they hold one constant value
on every reachable path: pty always false, idle_timeout always None,
output_disabled always false, options always {suppress_errors,
bypass_shell}. Audited by value (not just call-graph reachability) and
removed everything that depended on the now-constant value:
- pty: is_pty(), is_pty_supported(), the PTY descriptor branch in
UnixPipes::get_descriptors(), and the now-unconstructed
Descriptor::Pty variant in shirabe-php-shim (plus its proc_open
match arm).
- idle_timeout: get_idle_timeout() and check_timeout()'s idle branch;
ProcessTimedOutException collapses to the single reachable timeout
type (dropped timeout_type/TYPE_GENERAL/TYPE_IDLE/is_general_timeout/
is_idle_timeout/get_exceeded_timeout).
- output_disabled: is_output_disabled(), build_callback()'s disabled
variant, get_descriptors()'s output_disabled term, and the
always-false guard in read_pipes_for_output()/ProcessFailedException
(its output section is now unconditional).
- options: Drop::drop()'s create_new_console branch can never fire
(that key can no longer exist), so it always just stops the process.
- has_callback/last_output_time: left write-only once their only
readers (the branches above) were gone.
- have_read_support: constant true once output_disabled collapsed, so
removed from PipesInterface, UnixPipes (incl. its /dev/null
null-stream branch), WindowsPipes, and Process::wait()'s dead guard.
No behavior change: every removed item/branch had zero callers, or was
constant on every reachable call site.
|
|
Extends no_banned_use to cover std::any::Any, std::io::Read/Write, and
std::process::Command, and teaches the linter to allow `as _` imports
so trait methods can still be brought into scope without binding the
banned name. Fully qualifies all existing usages across the codebase.
|
|
|
|
The stashed binary_installer port was blocked on posix_getpwuid (reached via
Platform::is_virtual_box_guest); implement it via getpwuid(3) extern "C". The
4 install-and-exec tests now pass with the stream I/O and Process cwd fixes.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Port autoload_generator (24), bitbucket (14), suggested_packages (11),
git_driver (6), archive_manager (3), and a bump command test. Fix the
ApplicationTester output-capture root cause (php://memory streams must be
readable regardless of fopen mode). Implement posix_getuid/geteuid, the PCRE
'A' anchored modifier, php_strip_whitespace, stream_get_wrappers, is_callable
scalars; fix preg_quote angle-bracket escaping and class-map parser regexes.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
proc_open/proc_close/proc_get_status/proc_terminate represented the
process handle as a PhpMixed, which cannot hold a live child process or
its pipes, so they were stubs or todo!(). Model the handle as a new
PhpResource::Process variant and child pipes as a StreamBacking::Pipe,
with a native Descriptor enum for descriptorspec; proc_open now returns
io::Result and fills pipes as IndexMap<i64, PhpResource>.
Rewire the Symfony Process pipes and the Console terminal/cursor onto
the new types, removing the "PhpMixed cannot carry a PhpResource"
todo!()s. The remaining todo!()s are genuine syscall leaves
(proc_terminate signal delivery, stream_select, stream_set_blocking,
posix_kill, pty, fd>=3) left unimplemented since no syscall crate is
introduced.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Redesign PhpResource into a real stream handle (File/Memory backing with
tracked position, eof, closed state) and unify the whole fopen family
(fopen/fwrite/fread/fgets/fgetc/feof/fclose/ftell/fseek/rewind/fstat/
ftruncate/fflush and stream_get_contents/stream_copy_to_stream) on
&PhpResource, replacing the split PhpMixed/PhpResource APIs and their
todo!() stubs. fopen now returns Result; read functions stay String for
now (TODO(phase-e) to move to byte strings).
Propagate the signatures through callers: Process stdout/stderr, Cursor
input, curl header/body handles (extracted into typed maps keyed by job
id), Filesystem copy/safe_copy/files_are_equal, BufferIO, error_handler,
platform, perforce, zip. The proc_open pipe paths cannot carry a
PhpResource in a PhpMixed list, so they are left as todo!() with notes.
|
|
Run exec()/shell_exec()/system() through /bin/sh -c with PHP-faithful
line handling and return values. Port escapeshellcmd() (Unix branch,
including paired-quote handling) and escapeshellarg(). Implement
posix_isatty() via std::io::IsTerminal.
uid/signal/process-title helpers and proc_open-dependent status calls
remain TODO(phase-d): they need a libc/syscall crate or the deferred
process/signal subsystems.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
|