3 ms·
One hour ago, while looking casually at a package.json, I saw this and was horrified: rm -rf pkg/snippets & rmdir pkg\\snippets /s /q & wasm-pack build --tar
by rixed 4mo ago
One hour ago, while looking casually at a package.json, I saw this and was horrified:
rm -rf pkg/snippets & rmdir pkg\\snippets /s /q & wasm-pack build --target bundler && node prepare-web.js
Looked like a strange mix of unix shell and msdos batch that would, on my box, try to rmdir "/s" and "/q". I asked Claude about this, and he replied something like "Yes that's a standard and clever hack to delete a directory that works both on linux and windows!".
Poor Claude has been trained on so much awful human code that it required several prompts for it to admit that there was indeed a problem.
The industry is the process by which convenient crap like this gets standardized.
- lokar 4mo agoYikes. I would never approve a PR with that in it.
- lionkor 4mo agoYour agent might!
- PunchyHamster 4mo ago> Poor Claude has been trained on so much awful human code that it required several prompts for it to admit that there was indeed a problem. Claude probably birthed this abomination in the first place
- cozzyd 4mo agoI hope the "standard" part is as much of a hallucination as "clever" is
- tremon 4mo agoTo meekly defend the indefensible here: it's not like rmdir on Linux (I won't speak for all Unixen) can cause loss of data, since it only removes empty directories.
- MattSteelblade 4mo agoIn this case, the rm -rf before that does. The rmdir is the Windows command in this example and with /s /q, it will quietly delete everything.
- rixed 4mo agoYep, but that could still cause issues (those entries could be used as signals, or be mount points for currently unmounted partitions, etc). rmdir anything that start with "/" should be an absolute no-go. To say nothing about running a sequence of shell commands without the -e option.