main's failed-install roll back (#10544) read one object for each family
and handle, while this branch keeps one for each branch of the family.
The install now records the class and prototype of each of those objects
and the roll back puts each one back, so the merged tree builds again.
- move, remove() and zOrder throw "Only Image Trace can make a tracing",
with nothing changed, when they would leave an image at the bottom of
an ordinary group named Image Trace: a path moved out of the group or
to its top, Send to Back or Send Backward on the image, and Bring to
Front or Bring Forward on the object below it.
- releaseTracing() throws "Cannot release a tracing containing added
artwork", with nothing changed, when the tracing holds an object its
trace did not make. imageTrace.release keeps only the source image, so
the added object would be deleted.
- The TracingOptions members with no setting and TracingObject.areaCount
are left out of hasOwnProperty and reflect. Reading them still throws.
Docs: docs/mcp.md.
- A path written as a folder (`draft.svg/`, `draft.svg/.`) is refused
instead of saving `draft.svg`.
- The second check uses the name the file is stored under, so on a
volume that ignores letter case a grant for `Report.svg` allows a save
to `report.svg`.
- Where the rename is refused, the copy of the old content is made
beside the temporary file through the open folder, and in the system's
temporary folder only when the folder takes no new file.
- The copy of the old content is read from the file that is then
overwritten: when another file is at the name by then, nothing is
overwritten and the new content stays in the temporary file.
- On Apple platforms the folder is opened with `O_SEARCH`, so a folder
that can be written and searched but not listed takes the file.
- On Linux the replaced file's ACL is read through an `O_PATH` handle,
so a file its owner can write but not read keeps its ACL.
- The moved-folder test expects the original folder in the message on
FreeBSD, which does not report where an open folder is now.
The test caught any panic from its closure, so a failed set_permissions
would also pass it while the file was still writable. It now asserts
the file is read-only before its panic and checks the caught payload is
that panic's message.
The second check of a checked write passed the open folder's path as
text and looked it up again. A path that was not valid UTF-8 was refused,
and a folder on that path replaced by a link into an allowed folder
between the two lookups could let a place outside pass.
check_write_real compares the open folder's real path with the write
roots and the script's grants as it is, without looking it up again.
- The folder is opened with O_PATH on Linux, Android and FreeBSD, so a
folder that can be written and searched but not listed takes the file.
The folder flush opens it for reading, and an error there still
reports the completed write.
- The replaced file's permissions are read after the new content is
written, as write_atomic_with reads them, so permissions taken away
meanwhile stay taken away. Its ACL is read only from the same file.
- A folder that changed while it was opened is no longer reported as a
read-only location.
- Errors name the kept temporary file where its folder is now, after
the folder moved.
- A file already at the name the old content is copied to is left as it
is: only a copy this save made and could not finish is removed.
Realm::define_host_classes registered each class, and defined its global
constructor, before it checked the next one. A batch whose second class
named an unknown parent or a member twice failed with the first class
already installed, so a retry failed with "defined twice". A failed
instance did the same, and could leave an object scripts held with a
class the realm no longer had.
Every class's name, parent and members are now checked before any class
is added, so a child must still follow its parent in the batch. A
failure after that point removes the classes added, puts back each
global the call replaced and the class of each object an instance moved
to a new class. The replaced globals stay rooted until the call ends, so
a collection during the call does not free them.
a_script_gate_does_not_write_over_a_read_only_file created its
ReadOnlyFixture guard after two assertions, so a failure in either left
the test folder behind. The guard is now created right after the file
path is made, before the file is written.
folder() in tests/script_save_open.rs returned a PathBuf, and each test
removed its folder only on its last line, so a failed assertion or a
panicking script left the folder in the system's temporary folder. It now
returns a Workspace guard, as tests/script_print.rs does, which removes
the folder when it is dropped and clears read-only flags first when the
first removal fails (Windows does not delete a read-only file).
a_script_gate_does_not_write_over_a_read_only_file in file_access.rs made
its file writable again and removed its folder only after its last
assertion; a guard now does both when the test ends.
While automation roots or a script's file grants are in force, a save,
export or print to a file checked its path and then wrote it by name: the
temporary file was created beside the target by name and renamed over it
by name. A folder on the path replaced by a link between the check and
the rename sent the file outside the allowed folders.
vectorcraft_format::write_atomic_checked opens the target's folder once,
checks the path that open folder has with the caller's check, and makes
the temporary file, the rename, the copy over the file where the folder
refuses the rename, and the folder flush through that open folder
(openat, renameat, fsync). A folder replaced before it is opened fails
the check; one replaced after it is opened does not receive the file. A
link put at the final name after the check is replaced, not followed.
The replaced file's permissions, group and ACL are copied through the
open handles.
write_file, write_file_with and write_save_file_with use it while writes
are checked, and keep write_atomic_with otherwise. Outside Unix the check
runs on the path and the write is unchanged.
When the new printer listed the chosen paper at a size within half a
point of one of the dialog's own papers, the Size row kept the
`printer:<keyword>` choice, but the new Size list offers that paper
under the built-in id instead. The row then held a choice the list did
not contain, and the list was rebuilt and repainted on every frame. The
row now switches to the built-in paper the list offers.
A new IllustratorSaveOptions left compatibility unset, so a script that
read it before setting it got undefined. It now starts at
Compatibility.ILLUSTRATOR19, the documented default, which saveAs already
accepts without changing what it writes.
graph_column_params_are_checked_and_designs_too_big_are_drawn_plain checked
only the plain column's height, so an ellipse of the same height passed. It
now also checks that the column's path is the rectangle of its bounds.
While the newly chosen printer's driver has not answered, the Size list
keeps the previous printer's sizes, so a printer paper stays chosen at its
size. It becomes Custom only when the answer lists it at another size or
not at all.
A preset created in the same pass as a printer paper is chosen now saves
that paper's Width and Height, the size the dialog shows, instead of the
size before it.
Setting width, height, left, top or position on an item in a document in
the back measured the item before its document was made active. Making a
document active measures its type again where it is not measured yet or
where a composite font of the same name changed, so the scale ratio or the
move distance applied to bounds that no longer held, and the item ended
at a different size or place than the one asked for.
The measurement now runs inside the edit, after the switch, through a new
edit_item_with that edit_item also uses.