mirror of
https://github.com/openai/codex.git
synced 2026-11-05 16:29:31 +00:00
Preserve zsh tied PATH exports in shell snapshots (#34293)
## Why zsh prints tied scalar/array exports such as `PATH` and `path` with `-T` metadata. The snapshot filter rejected that syntax, so commands available only through the configured `PATH` could not be resolved from a restored snapshot. ## What changed - Recognize writable tied exports and retain them in zsh shell snapshots. - Skip readonly exports so restoring a snapshot does not make variables such as `PATH` immutable. ## Testing Added macOS coverage for restoring a tied `PATH`, handling entries with spaces, deduplicating path entries, excluding readonly tied exports, and resolving a command available only through the restored snapshot. GitOrigin-RevId: 297cfae3368230c7f6fe5ef84f0a10b35a2c802c
This commit is contained in:
1 parent
bf3c1972b7
commit
2deed3fb9c
3 files changed
+172
No files matched your search
@@ -342,6 +342,13 @@ export_lines=$(export -p | awk '
|
||||
line=$0
|
||||
name=line
|
||||
sub(/^(export|declare -x|typeset -x) /, "", name)
|
||||
if (name ~ /^-[A-Za-z]*r[A-Za-z]* /) {
|
||||
next
|
||||
}
|
||||
if (name ~ /^-[A-Za-z]*T[A-Za-z]* /) {
|
||||
sub(/^-[A-Za-z]*T[A-Za-z]* /, "", name)
|
||||
sub(/ [A-Za-z_][A-Za-z0-9_]*=.*/, "", name)
|
||||
}
|
||||
sub(/=.*/, "", name)
|
||||
if (name ~ /^(EXCLUDED_EXPORTS)$/) {
|
||||
next
|
||||
|
||||
Reference in new issue
Block a user