<feed xmlns='http://www.w3.org/2005/Atom'>
<title>newos4/modules/test/test-fs-mv-cp-guard.js, branch main</title>
<subtitle>newOS4 - the browser terminal that runs WebX11 user spaces</subtitle>
<id>https://newos.webx11.duckdns.org/newos4/atom?h=main</id>
<link rel='self' href='https://newos.webx11.duckdns.org/newos4/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://newos.webx11.duckdns.org/newos4/'/>
<updated>2026-10-27T11:32:37+00:00</updated>
<entry>
<title>fix(newos4): never overwrite a directory node; ls honours a path after its flags</title>
<updated>2026-10-27T11:32:37+00:00</updated>
<author>
<name>Agando</name>
<email>roduccomm@gmail.com</email>
</author>
<published>2026-10-27T11:32:37+00:00</published>
<link rel='alternate' type='text/html' href='https://newos.webx11.duckdns.org/newos4/commit/?id=669b66591b3efbb8fc8642d25a67c55d93cfe4e9'/>
<id>urn:sha1:669b66591b3efbb8fc8642d25a67c55d93cfe4e9</id>
<content type='text'>
MAINT-010 and MAINT-016, the two high items the review left open. Both were re-probed
before the change and the new test is red on HEAD (5 passed, 7 FAILED).

- virtual-fs.js rename()/copy(): they assigned dst.dir.content[dst.name] with no destination
  type check, so `mv file /docs` replaced the /docs node and every child vanished while the
  command printed "Moved: …". Refuse when the destination is a real directory node (the
  virtual /sys entry is exempt). rename() also erased the file on `mv a a`, because assigning
  and then deleting the same key removes it; that path is now an explicit no-op.
- module-fs.js mv/cp: a refusal used to surface as "No such file or directory", which sent
  the operator looking for a missing source. The destination is now inspected first and the
  message says "is a directory — refusing to overwrite it".
- module-fs.js ls: the path was only read from argv[0], so `ls -l /work` listed the cwd.
  The first non-flag argument is now the target; the path-first form is unchanged.

Tests: modules/test/test-fs-mv-cp-guard.js (12 asserts) — RED on HEAD (A1-A3, B1, B2, C2, E1),
GREEN now; maintain --fix reports "node tests 7/7 pass". Browser on v4.6.104:
"mv: /vtest: is a directory — refusing to overwrite it", child and source intact,
"ls -l /vtest" lists /vtest (keep.txt), not the cwd.
</content>
</entry>
</feed>
