{"id":501435,"date":"2026-11-03T08:43:27","date_gmt":"2026-11-03T05:43:27","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=501435"},"modified":"2026-11-03T08:43:27","modified_gmt":"2026-11-03T05:43:27","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=501435","title":{"rendered":"\u041a\u0430\u043a \u043d\u0435 \u0441\u0442\u0430\u0442\u044c \u0433\u0435\u0440\u043e\u0435\u043c \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u00ab\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0443\u0434\u0430\u043b\u0438\u043b\u0430 \u043c\u043d\u0435 800 \u0413\u0411\u00bb: \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0435 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432 Bash \u0438 Python"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041d\u0430 \u044d\u0442\u043e\u0439 \u043d\u0435\u0434\u0435\u043b\u0435 \u0432 \u0442\u043e\u043f \u0425\u0430\u0431\u0440\u0430 \u043f\u043e\u043f\u0430\u043b\u0430 \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u043e \u0442\u043e\u043c, \u043a\u0430\u043a Telegram Desktop \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e \u0447\u0438\u0441\u0442\u0438\u043b \u0447\u0443\u0436\u0443\u044e \u043f\u0430\u043f\u043a\u0443 <code>C:\\custom<\/code> \u0438 \u0443\u043d\u0451\u0441 \u043e\u043a\u043e\u043b\u043e 800 \u0413\u0411 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c. \u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043b\u0438\u0441\u044c \u043d\u0430 \u00ab\u043a\u0430\u043a \u0442\u0430\u043a\u043e\u0435 \u0432\u043e\u043e\u0431\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u0443\u0441\u0442\u0438\u0442\u044c\u00bb \u0438 \u00ab\u0443 \u043d\u0430\u0441 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0441\u043a\u0440\u0438\u043f\u0442, \u043f\u0440\u043e\u0441\u0442\u043e \u0435\u043c\u0443 \u043f\u043e\u043a\u0430 \u0432\u0435\u0437\u043b\u043e\u00bb.<\/p>\n<p>\u042f \u043e\u0442\u043d\u043e\u0448\u0443\u0441\u044c \u043a\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435. \u041f\u043e\u0447\u0442\u0438 \u0432 \u043b\u044e\u0431\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0435\u0441\u0442\u044c \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0447\u0442\u043e-\u0442\u043e \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e: \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u043a\u0435\u0448\u0430, \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432, \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u043e\u0432 \u0441\u0431\u043e\u0440\u043a\u0438, \u0441\u0442\u0430\u0440\u044b\u0445 \u0431\u044d\u043a\u0430\u043f\u043e\u0432. \u041f\u0438\u0448\u0435\u0442\u0441\u044f \u043e\u043d \u0437\u0430 \u043f\u044f\u0442\u044c \u043c\u0438\u043d\u0443\u0442, \u0440\u0435\u0432\u044c\u044e\u0438\u0442\u0441\u044f \u043f\u043e \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438, \u0438 \u0433\u043e\u0434\u0430\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u2014 \u0434\u043e \u043f\u0435\u0440\u0432\u043e\u0439 \u043f\u0443\u0441\u0442\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438\u043b\u0438 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0438\u043c\u043b\u0438\u043d\u043a\u0430.<\/p>\n<p>\u041d\u0438\u0436\u0435 \u2014 \u0440\u0430\u0437\u0431\u043e\u0440 \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u0432 \u043d\u043e\u0433\u0443 \u0438 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043a\u043e\u0434 \u043d\u0430 Bash \u0438 Python, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044d\u0442\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442. \u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u044f \u043f\u0440\u043e\u0433\u043d\u0430\u043b \u043d\u0430 Python 3.13 \u0438 GNU coreutils 9.7.<\/p>\n<h3>\u041a\u043b\u0430\u0441\u0441\u0438\u043a\u0430 \u0436\u0430\u043d\u0440\u0430: \u043f\u0443\u0441\u0442\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f<\/h3>\n<p>\u0421\u0430\u043c\u044b\u0439 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u2014 \u0431\u0430\u0433 \u0432 Steam \u0434\u043b\u044f Linux \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 2015 \u0433\u043e\u0434\u0430. \u0412 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0431\u044b\u043b\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0432\u0438\u0434\u0430:<\/p>\n<pre><code class=\"bash\">rm -rf \"$STEAMROOT\/\"*<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper\"><\/span><\/a><\/div><\/pre>\n<p>\u0415\u0441\u043b\u0438 <code>STEAMROOT<\/code> \u043f\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0430\u0441\u044c \u043f\u0443\u0441\u0442\u043e\u0439 (\u0443 \u043f\u043e\u0441\u0442\u0440\u0430\u0434\u0430\u0432\u0448\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0435\u0451 \u00ab\u0441\u043b\u043e\u043c\u0430\u043b\u00bb \u043f\u0435\u0440\u0435\u043d\u043e\u0441 \u043f\u0430\u043f\u043a\u0438 Steam), \u0441\u0442\u0440\u043e\u043a\u0430 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u043b\u0430\u0441\u044c \u0432 <code>rm -rf \"\/\"*<\/code>. \u0414\u0430\u043b\u044c\u0448\u0435 \u2014 \u0432\u0441\u0451, \u043d\u0430 \u0447\u0442\u043e \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0431\u044b\u043b\u0438 \u043f\u0440\u0430\u0432\u0430, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043f\u0440\u0438\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0434\u0438\u0441\u043a \u0441 \u0431\u044d\u043a\u0430\u043f\u0430\u043c\u0438.<\/p>\n<p>\u0415\u0449\u0451 \u0440\u0430\u043d\u044c\u0448\u0435, \u0432 2011-\u043c, \u0431\u044b\u043b Bumblebee \u2014 \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043b\u044f \u0433\u0438\u0431\u0440\u0438\u0434\u043d\u043e\u0439 \u0433\u0440\u0430\u0444\u0438\u043a\u0438 NVIDIA \u043d\u0430 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0430\u0445. \u0412 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u0447\u043d\u043e\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u0437\u0430\u0442\u0435\u0441\u0430\u043b\u0441\u044f \u043b\u0438\u0448\u043d\u0438\u0439 \u043f\u0440\u043e\u0431\u0435\u043b:<\/p>\n<pre><code class=\"bash\">rm -rf \/usr \/lib\/nvidia-current\/xorg\/xorg<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0443\u0442\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0434\u0432\u0430, \u0438 \u043f\u0435\u0440\u0432\u044b\u043c \u0438\u0437 \u043d\u0438\u0445 \u0431\u044b\u043b <code>\/usr<\/code>.<\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u043d\u0438 \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043d\u0435 \u0431\u044b\u043b\u043e \u00ab\u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e\u00bb \u043a\u043e\u0434\u0430. \u041e\u0434\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430, \u043f\u043e\u043d\u044f\u0442\u043d\u0430\u044f \u043b\u044e\u0431\u043e\u043c\u0443 \u0434\u0436\u0443\u043d\u0443.<\/p>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/extt\/a8\/fa\/3e\/a8fa3e04a877ca438006657a04749769.png\" width=\"1600\" height=\"900\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/extt\/a8\/fa\/3e\/a8fa3e04a877ca438006657a04749769.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/extt\/a8\/fa\/3e\/a8fa3e04a877ca438006657a04749769.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<h3>Bash: \u0442\u0440\u0438 \u0441\u0442\u0440\u043e\u0447\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u0435\u0433\u0434\u0430<\/h3>\n<h4>set -euo pipefail<\/h4>\n<pre><code class=\"bash\">#!\/usr\/bin\/env bashset -euo pipefail<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043d\u0430\u0441 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 <code>-u<\/code>: \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u043d\u0435\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u043e\u0439, \u0438 \u0441\u043a\u0440\u0438\u043f\u0442 \u043f\u0430\u0434\u0430\u0435\u0442. \u0412\u0430\u0436\u043d\u0430\u044f \u043e\u0433\u043e\u0432\u043e\u0440\u043a\u0430: <code>-u<\/code> \u043d\u0435 \u0441\u043f\u0430\u0441\u0430\u0435\u0442 \u043e\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f <em>\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430, \u043d\u043e \u043f\u0443\u0441\u0442\u0430<\/em> (<code>CACHE_DIR=\"\"<\/code>). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0434\u043d\u043e\u0433\u043e <code>set -u<\/code> \u043c\u0430\u043b\u043e.<\/p>\n<h4>${VAR:?} \u043f\u0440\u044f\u043c\u043e \u0432 \u043f\u0443\u0442\u0438<\/h4>\n<pre><code class=\"bash\">rm -rf -- \"${CACHE_DIR:?CACHE_DIR \u043d\u0435 \u0437\u0430\u0434\u0430\u043d}\/\"*<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f <code>${VAR:?\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435}<\/code> \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439, \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043d\u0435 \u0437\u0430\u0434\u0430\u043d\u0430 <strong>\u0438\u043b\u0438 \u043f\u0443\u0441\u0442\u0430<\/strong>. \u0414\u0432\u043e\u0435\u0442\u043e\u0447\u0438\u0435 \u0442\u0443\u0442 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u043e: <code>${VAR?}<\/code> \u0431\u0435\u0437 \u043d\u0435\u0433\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442 \u043f\u0443\u0441\u0442\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443.<\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u044e:<\/p>\n<pre><code>$ bash t.sht.sh: line 3: CACHE_DIR: CACHE_DIR \u043d\u0435 \u0437\u0430\u0434\u0430\u043d$ echo $?1<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p><code>rm<\/code> \u0434\u0430\u0436\u0435 \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f.<\/p>\n<h4>&#8212; \u0438 \u043a\u0430\u0432\u044b\u0447\u043a\u0438<\/h4>\n<p>\u0414\u0432\u043e\u0439\u043d\u044b\u0435 \u043a\u0430\u0432\u044b\u0447\u043a\u0438 \u0437\u0430\u0449\u0438\u0449\u0430\u044e\u0442 \u043e\u0442 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u044f \u043f\u0443\u0442\u0438 \u0441 \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c\u0438 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (\u043f\u0440\u0438\u0432\u0435\u0442, Bumblebee). \u0410 <code>--<\/code> \u0433\u043e\u0432\u043e\u0440\u0438\u0442 <code>rm<\/code>, \u0447\u0442\u043e \u0434\u0430\u043b\u044c\u0448\u0435 \u0438\u0434\u0443\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0443\u0442\u0438, \u0430 \u043d\u0435 \u043e\u043f\u0446\u0438\u0438: \u0444\u0430\u0439\u043b \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <code>-rf<\/code> \u0432 \u043f\u0430\u043f\u043a\u0435 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0451\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439.<\/p>\n<details class=\"spoiler\">\n<summary>\u0410 \u043a\u0430\u043a \u0436\u0435 &#8212;preserve-root?<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0412 GNU <code>rm<\/code> \u0437\u0430\u0449\u0438\u0442\u0430 <code>--preserve-root<\/code> \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0438 <code>rm -rf \/<\/code> \u043e\u0442\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u041d\u043e \u043e\u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0440\u0435\u043d\u044c. <code>rm -rf \/*<\/code> \u2014 \u044d\u0442\u043e \u0443\u0436\u0435 \u043d\u0435 \u043a\u043e\u0440\u0435\u043d\u044c, \u0430 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432 \u0432 \u043d\u0451\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0441\u043a\u0440\u044b\u043b\u0430 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430, \u0438 <code>--preserve-root<\/code> \u0442\u0443\u0442 \u043d\u0435 \u043f\u043e\u043c\u043e\u0436\u0435\u0442. \u0420\u043e\u0432\u043d\u043e \u0442\u0430\u043a \u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b \u0441\u043b\u0443\u0447\u0430\u0439 \u0441\u043e Steam.<\/p>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0435\u0441\u0442\u044c <code>--one-file-system<\/code> \u2014 \u043e\u043d \u043d\u0435 \u0434\u0430\u0451\u0442 <code>rm<\/code> \u0443\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u0414\u043b\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u043e\u0447\u0438\u0441\u0442\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0442\u0440\u043e\u0433\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0434\u0438\u0441\u043a\u0438, \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0441\u0442\u0440\u0430\u0445\u043e\u0432\u043a\u0430. \u0418 \u043f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e \u043d\u0430 macOS \u0438 \u0432 BusyBox <code>rm<\/code> \u043d\u0435 GNU, \u0438 \u043d\u0430\u0431\u043e\u0440 \u0444\u043b\u0430\u0433\u043e\u0432 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/div>\n<\/details>\n<h4>\u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d<\/h4>\n<pre><code class=\"bash\">#!\/usr\/bin\/env bashset -euo pipefail: \"${CACHE_DIR:?CACHE_DIR \u043d\u0435 \u0437\u0430\u0434\u0430\u043d}\"# \u041a\u0430\u0442\u0430\u043b\u043e\u0433 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0438 \u0431\u044b\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u043c, \u0430 \u043d\u0435 \u0441\u0438\u043c\u043b\u0438\u043d\u043a\u043e\u043cif [[ ! -d \"$CACHE_DIR\" || -L \"$CACHE_DIR\" ]]; then    echo \"\u0421\u0442\u0440\u0430\u043d\u043d\u044b\u0439 CACHE_DIR: $CACHE_DIR\" &gt;&amp;2    exit 1fireal=$(realpath -- \"$CACHE_DIR\")case \"$real\" in    \/|\/home|\/home\/*\/|\"$HOME\"|\/usr*|\/etc*|\/var)        echo \"\u041e\u0442\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0441\u044c \u0447\u0438\u0441\u0442\u0438\u0442\u044c $real\" &gt;&amp;2        exit 1        ;;esacfind \"$real\" -mindepth 1 -maxdepth 1 -exec rm -rf --one-file-system -- {} +<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p><code>find -mindepth 1<\/code> \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0441\u043a\u0440\u044b\u0442\u044b\u0435 \u0444\u0430\u0439\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 <code>*<\/code> \u0432 Bash \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0435 \u0437\u0430\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u0442, \u2014 \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435 \u0442\u0440\u043e\u0433\u0430\u0435\u0442 \u0441\u0430\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433.<\/p>\n<h3>Python: shutil.rmtree \u043d\u0435 \u0434\u0443\u043c\u0430\u0435\u0442 \u0437\u0430 \u0432\u0430\u0441<\/h3>\n<p>\u0412 Python \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043f\u0438\u0448\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439:<\/p>\n<pre><code class=\"python\">shutil.rmtree(path)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0418 \u0443 \u043d\u0435\u0451 \u0440\u043e\u0432\u043d\u043e \u0442\u0435 \u0436\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. <code>rmtree<\/code> \u0443\u0434\u0430\u043b\u0438\u0442 \u0442\u043e, \u0447\u0442\u043e \u0435\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u043b\u0438, \u2014 \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0434\u043e\u043c\u0430\u0448\u043d\u0438\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043a\u043e\u043d\u0444\u0438\u0433 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u0441\u044f \u043d\u0435 \u0442\u0430\u043a.<\/p>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0442\u0435\u043c\u0430 \u2014 \u0441\u0438\u043c\u043b\u0438\u043d\u043a\u0438. \u0421\u0430\u043c <code>rmtree<\/code> \u043d\u0430 \u0441\u0438\u043c\u043b\u0438\u043d\u043a \u0440\u0443\u0433\u0430\u0435\u0442\u0441\u044f (<code>OSError: Cannot call rmtree on a symbolic link<\/code>), \u0430 \u0441\u0438\u043c\u043b\u0438\u043d\u043a\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u0434\u0435\u0440\u0435\u0432\u0430 \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u043a\u0430\u043a \u0441\u0441\u044b\u043b\u043a\u0438, \u043d\u0435 \u0437\u0430\u0445\u043e\u0434\u044f \u0432 \u043d\u0438\u0445. \u041d\u043e \u0435\u0441\u0442\u044c \u0433\u043e\u043d\u043a\u0430: \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u00ab\u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u00bb \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435\u043c \u0435\u0433\u043e \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0434\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u0441\u0438\u043c\u043b\u0438\u043d\u043a. \u041d\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445, \u0433\u0434\u0435 \u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 <code>openat<\/code>\/<code>unlinkat<\/code>, <code>rmtree<\/code> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u044b \u0438 \u0437\u0430\u0449\u0438\u0449\u0451\u043d \u043e\u0442 \u044d\u0442\u043e\u0439 \u0430\u0442\u0430\u043a\u0438. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c <code>shutil.rmtree.avoids_symlink_attacks<\/code> (\u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0432 Python 3.3). \u041d\u0430 Linux \u043e\u043d <code>True<\/code>, \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c <code>False<\/code>.<\/p>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/extt\/9d\/5e\/ff\/9d5effc73901a089810a72ab237b10c1.png\" width=\"1600\" height=\"900\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/extt\/9d\/5e\/ff\/9d5effc73901a089810a72ab237b10c1.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/extt\/9d\/5e\/ff\/9d5effc73901a089810a72ab237b10c1.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<h4>\u041e\u0431\u0451\u0440\u0442\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u043b\u0438\u0448\u043d\u0435\u0435<\/h4>\n<p>\u0418\u0434\u0435\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f: \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e <strong>\u0432\u043d\u0443\u0442\u0440\u0438<\/strong> \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u043a\u043e\u0440\u043d\u044f \u2014 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u0435\u0448\u0430, \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043f\u0430\u043f\u043a\u0438. \u0412\u0441\u0451 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u2014 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"python\">import shutilimport tempfilefrom pathlib import Pathclass UnsafeDeletion(Exception):    passFORBIDDEN = {Path(\"\/\"), Path.home().resolve()}def safe_rmtree(target, allowed_root, dry_run=False):    if not target or not str(target).strip():        raise UnsafeDeletion(\"\u043f\u0443\u0441\u0442\u043e\u0439 \u043f\u0443\u0442\u044c\")    root = Path(allowed_root).resolve(strict=True)    path = Path(target)    if path.is_symlink():        raise UnsafeDeletion(f\"{path} \u2014 \u0441\u0438\u043c\u043b\u0438\u043d\u043a, \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c\")    real = path.resolve(strict=True)    if real in FORBIDDEN or real == root:        raise UnsafeDeletion(f\"{real} \u2014 \u0437\u0430\u043f\u0440\u0435\u0449\u0451\u043d\u043d\u044b\u0439 \u043f\u0443\u0442\u044c\")    if not real.is_relative_to(root):        raise UnsafeDeletion(f\"{real} \u0432\u043d\u0435 {root}\")    if dry_run:        for p in sorted(real.rglob(\"*\")):            print(\"\u0443\u0434\u0430\u043b\u0438\u043b \u0431\u044b:\", p)        return    if not shutil.rmtree.avoids_symlink_attacks:        raise UnsafeDeletion(\"\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 \u043d\u0435 \u0437\u0430\u0449\u0438\u0449\u0430\u0435\u0442 rmtree \u043e\u0442 \u0441\u0438\u043c\u043b\u0438\u043d\u043a-\u0430\u0442\u0430\u043a\")    shutil.rmtree(real)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0427\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0432\u0430\u0436\u043d\u043e:<\/p>\n<ul>\n<li>\n<p><strong>\u041f\u0443\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0434\u043e <\/strong><code><strong>Path()<\/strong><\/code><strong>.<\/strong> <code>Path(\"\")<\/code> \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 <code>Path(\".\")<\/code>, \u0442\u043e \u0435\u0441\u0442\u044c \u0432 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433. \u042d\u0442\u043e \u043f\u0438\u0442\u043e\u043d\u043e\u0432\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u043e\u0433 \u043f\u0443\u0441\u0442\u043e\u0433\u043e <code>$STEAMROOT<\/code>, \u0438 \u043e\u043d \u043a\u0443\u0434\u0430 \u043c\u0435\u043d\u0435\u0435 \u0437\u0430\u043c\u0435\u0442\u0435\u043d.<\/p>\n<\/li>\n<li>\n<p><code><strong>resolve(strict=True)<\/strong><\/code> \u0440\u0430\u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442 <code>..<\/code> \u0438 \u0441\u0438\u043c\u043b\u0438\u043d\u043a\u0438 \u0438 \u043f\u0430\u0434\u0430\u0435\u0442, \u0435\u0441\u043b\u0438 \u043f\u0443\u0442\u0438 \u043d\u0435\u0442. \u0421\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u043e \u0443\u0436\u0435 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0435 \u043f\u0443\u0442\u0438: \u0441\u0442\u0440\u043e\u043a\u0430 <code>cache\/..\/..\/<\/code> \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 <code>cache<\/code>.<\/p>\n<\/li>\n<li>\n<p><code><strong>is_relative_to<\/strong><\/code> (Python 3.9+) \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043f\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c \u043f\u0443\u0442\u0438. \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0447\u0435\u0440\u0435\u0437 <code>str(real).startswith(str(root))<\/code> \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u0430: <code>\/srv\/app-old<\/code> \u00ab\u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f\u00bb \u0441 <code>\/srv\/app<\/code>.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0430\u043c \u043a\u043e\u0440\u0435\u043d\u044c \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f<\/strong> \u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e, \u0447\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0435\u0433\u043e.<\/p>\n<\/li>\n<li>\n<p><code><strong>dry_run<\/strong><\/code> \u2014 \u0434\u0435\u0448\u0451\u0432\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0443\u0439\u0434\u0451\u0442, \u0434\u043e \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u043e\u043d\u043e \u0443\u0439\u0434\u0451\u0442.<\/p>\n<\/li>\n<\/ul>\n<h4>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430 \u0436\u0438\u0432\u043e\u0439 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435<\/h4>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 <code>cache<\/code> \u0441 \u0444\u0430\u0439\u043b\u043e\u043c \u0432\u043d\u0443\u0442\u0440\u0438, \u0430 \u0440\u044f\u0434\u043e\u043c \u2014 \u00ab\u0447\u0443\u0436\u0443\u044e\u00bb \u043f\u0430\u043f\u043a\u0443 \u0441 <code>important.txt<\/code> \u0438 \u0441\u0438\u043c\u043b\u0438\u043d\u043a \u043d\u0430 \u043d\u0435\u0451 \u0438\u0437 \u043a\u0435\u0448\u0430:<\/p>\n<pre><code class=\"python\">base = Path(tempfile.mkdtemp())cache = base \/ \"cache\"(cache \/ \"a\").mkdir(parents=True)(cache \/ \"a\" \/ \"f.txt\").write_text(\"x\")victim = Path(tempfile.mkdtemp())(victim \/ \"important.txt\").write_text(\"!\")(cache \/ \"link\").symlink_to(victim)for t in [\"\", \"\/\", str(base), str(base \/ \"cache\" \/ \"..\" \/ \"..\"), str(cache \/ \"link\")]:    try:        safe_rmtree(t, base)    except UnsafeDeletion as e:        print(\"\u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043e:\", e)safe_rmtree(cache, base, dry_run=True)safe_rmtree(cache, base)print(cache.exists(), (victim \/ \"important.txt\").exists())<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0412\u044b\u0432\u043e\u0434:<\/p>\n<pre><code>\u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043e: \u043f\u0443\u0441\u0442\u043e\u0439 \u043f\u0443\u0442\u044c\u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043e: \/ \u2014 \u0437\u0430\u043f\u0440\u0435\u0449\u0451\u043d\u043d\u044b\u0439 \u043f\u0443\u0442\u044c\u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043e: \/tmp\/tmps_zcsnez \u2014 \u0437\u0430\u043f\u0440\u0435\u0449\u0451\u043d\u043d\u044b\u0439 \u043f\u0443\u0442\u044c\u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043e: \/tmp \u0432\u043d\u0435 \/tmp\/tmps_zcsnez\u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043e: \/tmp\/tmps_zcsnez\/cache\/link \u2014 \u0441\u0438\u043c\u043b\u0438\u043d\u043a, \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c\u0443\u0434\u0430\u043b\u0438\u043b \u0431\u044b: \/tmp\/tmps_zcsnez\/cache\/a\u0443\u0434\u0430\u043b\u0438\u043b \u0431\u044b: \/tmp\/tmps_zcsnez\/cache\/a\/f.txt\u0443\u0434\u0430\u043b\u0438\u043b \u0431\u044b: \/tmp\/tmps_zcsnez\/cache\/linkFalse True<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041a\u0435\u0448 \u0443\u0434\u0430\u043b\u0451\u043d, <code>important.txt<\/code> \u043d\u0430 \u043c\u0435\u0441\u0442\u0435: \u0441\u0438\u043c\u043b\u0438\u043d\u043a \u0432\u043d\u0443\u0442\u0440\u0438 \u0434\u0435\u0440\u0435\u0432\u0430 <code>rmtree<\/code> \u0441\u043d\u0451\u0441 \u043a\u0430\u043a \u0441\u0441\u044b\u043b\u043a\u0443 \u0438 \u0432 \u0447\u0443\u0436\u0443\u044e \u043f\u0430\u043f\u043a\u0443 \u043d\u0435 \u043f\u043e\u043b\u0435\u0437.<\/p>\n<details class=\"spoiler\">\n<summary>onerror, onexc \u0438 read-only \u0444\u0430\u0439\u043b\u044b \u043d\u0430 Windows<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041d\u0430 Windows <code>rmtree<\/code> \u0447\u0430\u0441\u0442\u043e \u0441\u043f\u043e\u0442\u044b\u043a\u0430\u0435\u0442\u0441\u044f \u043e \u0444\u0430\u0439\u043b\u044b \u0441 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c \u00ab\u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u0435\u043d\u0438\u0435\u00bb \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043d\u0443\u0442\u0440\u0438 <code>.git<\/code>. \u041e\u0431\u044b\u0447\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u2014 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043e\u0448\u0438\u0431\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043d\u0438\u043c\u0430\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e:<\/p>\n<pre><code class=\"python\">import os, statdef _force(func, path, exc):    os.chmod(path, stat.S_IWRITE)    func(path)shutil.rmtree(real, onexc=_force)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>onexc<\/code> \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0432 Python 3.12, \u0430 \u0441\u0442\u0430\u0440\u044b\u0439 <code>onerror<\/code> \u0432 \u0442\u043e\u0439 \u0436\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u043c. \u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c 3.11 \u0438 \u043d\u0438\u0436\u0435, \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>onerror<\/code> \u2014 \u0443 \u043d\u0435\u0433\u043e \u0442\u0440\u0435\u0442\u0438\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043d\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0430 \u043a\u043e\u0440\u0442\u0435\u0436 \u0438\u0437 <code>sys.exc_info()<\/code>.<\/p>\n<p>\u0418 \u0433\u043b\u0430\u0432\u043d\u043e\u0435: \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 <code>ignore_errors=True<\/code> \u00ab\u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0430\u0434\u0430\u043b\u043e\u00bb. \u0412\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u0435\u0442\u0435 \u0443\u0437\u043d\u0430\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a.<\/p>\n<\/div>\n<\/details>\n<h3>\u0427\u0442\u043e \u0435\u0449\u0451 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435<\/h3>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/extt\/0b\/01\/25\/0b0125b037da2f535873c1d0d2cb5279.png\" width=\"1600\" height=\"900\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/extt\/0b\/01\/25\/0b0125b037da2f535873c1d0d2cb5279.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/extt\/0b\/01\/25\/0b0125b037da2f535873c1d0d2cb5279.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p><strong>\u0423\u0434\u0430\u043b\u044f\u0439\u0442\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e, \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0441\u0430\u043c\u0438.<\/strong> \u041b\u0443\u0447\u0448\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2014 <code>tempfile.TemporaryDirectory()<\/code> \u0438\u043b\u0438 <code>mktemp -d<\/code>: \u043f\u0443\u0442\u044c \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u043d\u043e\u0432\u044b\u0439, \u0438 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0435 \u0432\u044b \u0440\u043e\u0432\u043d\u043e \u0435\u0433\u043e. \u0415\u0441\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a\u043b\u0430\u0434\u0451\u0442 \u0444\u0430\u0439\u043b\u044b \u0432 \u043e\u0431\u0449\u0438\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433, \u043f\u0443\u0441\u0442\u044c \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0442\u0430\u043c \u043c\u0430\u0440\u043a\u0435\u0440 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0443\u0441\u0442\u043e\u0439 <code>.myapp-cache<\/code>) \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0434 \u043e\u0447\u0438\u0441\u0442\u043a\u043e\u0439.<\/p>\n<p><strong>\u041d\u0435 \u0431\u0435\u0440\u0438\u0442\u0435 \u043f\u0443\u0442\u044c \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0438\u0437 \u043a\u043e\u043d\u0444\u0438\u0433\u0430 \u0438\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0432\u0432\u043e\u0434\u0430.<\/strong> \u041a\u043e\u043d\u0444\u0438\u0433 \u2014 \u044d\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043a\u043e\u0433\u0434\u0430-\u043d\u0438\u0431\u0443\u0434\u044c \u043a\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e. \u0418\u0437 \u043d\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u0440\u0430\u0442\u044c \u0438\u043c\u044f \u043f\u043e\u0434\u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430, \u043d\u043e \u043a\u043e\u0440\u0435\u043d\u044c, \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435, \u043b\u0443\u0447\u0448\u0435 \u0437\u0430\u0448\u0438\u0442\u044c \u0432 \u043a\u043e\u0434.<\/p>\n<p><strong>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442\u0435, \u043f\u043e\u0442\u043e\u043c \u0443\u0434\u0430\u043b\u044f\u0439\u0442\u0435.<\/strong> \u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 \u00ab\u043a\u043e\u0440\u0437\u0438\u043d\u0443\u00bb \u0432\u0438\u0434\u0430 <code>trash\/2026-11-03\/<\/code> \u0441 \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0439 \u043e\u0447\u0438\u0441\u0442\u043a\u043e\u0439 \u0434\u0430\u0451\u0442 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443. \u0414\u043b\u044f \u043a\u0435\u0448\u0435\u0439 \u044d\u0442\u043e \u043f\u043e\u0447\u0442\u0438 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e.<\/p>\n<p><strong>\u041b\u043e\u0433\u0438\u0440\u0443\u0439\u0442\u0435, \u0447\u0442\u043e \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0435.<\/strong> \u0425\u043e\u0442\u044f \u0431\u044b \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043f\u0443\u0442\u044c \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0444\u0430\u0439\u043b\u043e\u0432. \u041a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u0440\u0438\u0434\u0451\u0442 \u0441 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c \u00ab\u043a\u0443\u0434\u0430 \u0434\u0435\u043b\u0438\u0441\u044c \u043c\u043e\u0438 \u0434\u0430\u043d\u043d\u044b\u0435\u00bb, \u0443 \u0432\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0442.<\/p>\n<p><strong>\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u043d\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0424\u0421.<\/strong> \u0422\u0435\u0441\u0442 \u0432\u044b\u0448\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043f\u0430\u0440\u0443 \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u0441\u0442\u0440\u043e\u043a \u0438 \u043b\u043e\u0432\u0438\u0442 \u043f\u0443\u0441\u0442\u044b\u0435 \u043f\u0443\u0442\u0438, <code>..<\/code> \u0438 \u0441\u0438\u043c\u043b\u0438\u043d\u043a\u0438. \u0412 pytest \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u0430\u044f \u0444\u0438\u043a\u0441\u0442\u0443\u0440\u0430 <code>tmp_path<\/code>.<\/p>\n<h3>\u0427\u0435\u043a-\u043b\u0438\u0441\u0442 \u0434\u043b\u044f \u0440\u0435\u0432\u044c\u044e<\/h3>\n<ul>\n<li>\n<p>\u0412 Bash: <code>set -euo pipefail<\/code>, <code>${VAR:?}<\/code> \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043f\u0443\u0442\u0438 \u0434\u043b\u044f <code>rm<\/code>, \u043a\u0430\u0432\u044b\u0447\u043a\u0438, <code>--<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u0442 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 <code>\"$DIR\/\"*<\/code> \u0431\u0435\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 <code>DIR<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0412 Python \u043f\u0443\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043e\u0442\u0441\u0435\u043a\u0430\u0435\u0442\u0441\u044f \u0434\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f <code>Path<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0443\u0442\u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 <code>resolve()<\/code>, \u0430 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u2014 \u0447\u0435\u0440\u0435\u0437 <code>is_relative_to<\/code>, \u0430 \u043d\u0435 <code>startswith<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u043a\u043e\u0440\u043d\u044f, \u0438 \u0441\u0430\u043c \u043a\u043e\u0440\u0435\u043d\u044c \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u0442 <code>ignore_errors=True<\/code> \u0431\u0435\u0437 \u043e\u0447\u0435\u043d\u044c \u0432\u0435\u0441\u043a\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u044b.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u0442\u044c <code>dry_run<\/code> \u0438\u043b\u0438 \u0445\u043e\u0442\u044f \u0431\u044b \u043b\u043e\u0433 \u0443\u0434\u0430\u043b\u044f\u0435\u043c\u044b\u0445 \u043f\u0443\u0442\u0435\u0439.<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u043e\u0434 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043a\u0443\u0447\u043d\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430 \u0440\u0435\u0432\u044c\u044e \u0435\u0433\u043e \u043f\u0440\u043e\u043b\u0438\u0441\u0442\u044b\u0432\u0430\u044e\u0442. \u041d\u043e \u044d\u0442\u043e \u043e\u0434\u043d\u043e \u0438\u0437 \u043d\u0435\u043c\u043d\u043e\u0433\u0438\u0445 \u043c\u0435\u0441\u0442, \u0433\u0434\u0435 \u043e\u0448\u0438\u0431\u043a\u0430 \u0432 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0432\u0441\u0435\u0445 \u0435\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0445. \u041b\u0438\u0448\u043d\u0438\u0435 \u0434\u0435\u0441\u044f\u0442\u044c \u0441\u0442\u0440\u043e\u043a \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u043e\u0431\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043a\u0443\u0434\u0430 \u0434\u0435\u0448\u0435\u0432\u043b\u0435.<\/p>\n<\/div>\n<p>\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/1102984\/\">https:\/\/habr.com\/ru\/articles\/1102984\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041d\u0430 \u044d\u0442\u043e\u0439 \u043d\u0435\u0434\u0435\u043b\u0435 \u0432 \u0442\u043e\u043f \u0425\u0430\u0431\u0440\u0430 \u043f\u043e\u043f\u0430\u043b\u0430 \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u043e \u0442\u043e\u043c, \u043a\u0430\u043a Telegram Desktop \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e \u0447\u0438\u0441\u0442\u0438\u043b \u0447\u0443\u0436\u0443\u044e \u043f\u0430\u043f\u043a\u0443 C:\\custom \u0438 \u0443\u043d\u0451\u0441 \u043e\u043a\u043e\u043b\u043e 800 \u0413\u0411 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c. \u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043b\u0438\u0441\u044c \u043d\u0430 \u00ab\u043a\u0430\u043a \u0442\u0430\u043a\u043e\u0435 \u0432\u043e\u043e\u0431\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u0443\u0441\u0442\u0438\u0442\u044c\u00bb \u0438 \u00ab\u0443 \u043d\u0430\u0441 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0441\u043a\u0440\u0438\u043f\u0442, \u043f\u0440\u043e\u0441\u0442\u043e \u0435\u043c\u0443 \u043f\u043e\u043a\u0430 \u0432\u0435\u0437\u043b\u043e\u00bb.\u042f \u043e\u0442\u043d\u043e\u0448\u0443\u0441\u044c \u043a\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435. \u041f\u043e\u0447\u0442\u0438 \u0432 \u043b\u044e\u0431\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0435\u0441\u0442\u044c \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0447\u0442\u043e-\u0442\u043e \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e: \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u043a\u0435\u0448\u0430, \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432, \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u043e\u0432 \u0441\u0431\u043e\u0440\u043a\u0438, \u0441\u0442\u0430\u0440\u044b\u0445 \u0431\u044d\u043a\u0430\u043f\u043e\u0432. \u041f\u0438\u0448\u0435\u0442\u0441\u044f \u043e\u043d \u0437\u0430 \u043f\u044f\u0442\u044c \u043c\u0438\u043d\u0443\u0442, \u0440\u0435\u0432\u044c\u044e\u0438\u0442\u0441\u044f \u043f\u043e \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438, \u0438 \u0433\u043e\u0434\u0430\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u2014 \u0434\u043e \u043f\u0435\u0440\u0432\u043e\u0439 \u043f\u0443\u0441\u0442\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438\u043b\u0438 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0438\u043c\u043b\u0438\u043d\u043a\u0430.\u041d\u0438\u0436\u0435 \u2014 \u0440\u0430\u0437\u0431\u043e\u0440 \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u0432 \u043d\u043e\u0433\u0443 \u0438 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043a\u043e\u0434 \u043d\u0430 Bash \u0438 Python, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044d\u0442\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442. \u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u044f \u043f\u0440\u043e\u0433\u043d\u0430\u043b \u043d\u0430 Python 3.13 \u0438 GNU coreutils 9.7.\u041a\u043b\u0430\u0441\u0441\u0438\u043a\u0430 \u0436\u0430\u043d\u0440\u0430: \u043f\u0443\u0441\u0442\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f\u0421\u0430\u043c\u044b\u0439 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u2014 \u0431\u0430\u0433 \u0432 Steam \u0434\u043b\u044f Linux \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 2015 \u0433\u043e\u0434\u0430. \u0412 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0431\u044b\u043b\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0432\u0438\u0434\u0430:rm -rf &#171;$STEAMROOT\/&#187;*\u0415\u0441\u043b\u0438 STEAMROOT \u043f\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0430\u0441\u044c \u043f\u0443\u0441\u0442\u043e\u0439 (\u0443 \u043f\u043e\u0441\u0442\u0440\u0430\u0434\u0430\u0432\u0448\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0435\u0451 \u00ab\u0441\u043b\u043e\u043c\u0430\u043b\u00bb \u043f\u0435\u0440\u0435\u043d\u043e\u0441 \u043f\u0430\u043f\u043a\u0438 Steam), \u0441\u0442\u0440\u043e\u043a\u0430 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u043b\u0430\u0441\u044c \u0432 rm -rf &#171;\/&#187;*. \u0414\u0430\u043b\u044c\u0448\u0435 \u2014 \u0432\u0441\u0451, \u043d\u0430 \u0447\u0442\u043e \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0431\u044b\u043b\u0438 \u043f\u0440\u0430\u0432\u0430, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043f\u0440\u0438\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0434\u0438\u0441\u043a \u0441 \u0431\u044d\u043a\u0430\u043f\u0430\u043c\u0438.\u0415\u0449\u0451 \u0440\u0430\u043d\u044c\u0448\u0435, \u0432 2011-\u043c, \u0431\u044b\u043b Bumblebee \u2014 \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043b\u044f \u0433\u0438\u0431\u0440\u0438\u0434\u043d\u043e\u0439 \u0433\u0440\u0430\u0444\u0438\u043a\u0438 NVIDIA \u043d\u0430 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0430\u0445. \u0412 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u0447\u043d\u043e\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u0437\u0430\u0442\u0435\u0441\u0430\u043b\u0441\u044f \u043b\u0438\u0448\u043d\u0438\u0439 \u043f\u0440\u043e\u0431\u0435\u043b:rm -rf \/usr \/lib\/nvidia-current\/xorg\/xorg\u0412\u043c\u0435\u0441\u0442\u043e \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0443\u0442\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0434\u0432\u0430, \u0438 \u043f\u0435\u0440\u0432\u044b\u043c \u0438\u0437 \u043d\u0438\u0445 \u0431\u044b\u043b \/usr.\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u043d\u0438 \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043d\u0435 \u0431\u044b\u043b\u043e \u00ab\u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e\u00bb \u043a\u043e\u0434\u0430. \u041e\u0434\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430, \u043f\u043e\u043d\u044f\u0442\u043d\u0430\u044f \u043b\u044e\u0431\u043e\u043c\u0443 \u0434\u0436\u0443\u043d\u0443.Bash: \u0442\u0440\u0438 \u0441\u0442\u0440\u043e\u0447\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u0435\u0433\u0434\u0430set -euo pipefail#!\/usr\/bin\/env bashset -euo pipefail\u0417\u0434\u0435\u0441\u044c \u043d\u0430\u0441 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 -u: \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u043d\u0435\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u043e\u0439, \u0438 \u0441\u043a\u0440\u0438\u043f\u0442 \u043f\u0430\u0434\u0430\u0435\u0442. \u0412\u0430\u0436\u043d\u0430\u044f \u043e\u0433\u043e\u0432\u043e\u0440\u043a\u0430: -u \u043d\u0435 \u0441\u043f\u0430\u0441\u0430\u0435\u0442 \u043e\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430, \u043d\u043e \u043f\u0443\u0441\u0442\u0430 (CACHE_DIR=&#187;&#187;). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0434\u043d\u043e\u0433\u043e set -u \u043c\u0430\u043b\u043e.${VAR:?} \u043f\u0440\u044f\u043c\u043e \u0432 \u043f\u0443\u0442\u0438rm -rf &#8212; &#171;${CACHE_DIR:?CACHE_DIR \u043d\u0435 \u0437\u0430\u0434\u0430\u043d}\/&#187;*\u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f ${VAR:?\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435} \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439, \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043d\u0435 \u0437\u0430\u0434\u0430\u043d\u0430 \u0438\u043b\u0438 \u043f\u0443\u0441\u0442\u0430. \u0414\u0432\u043e\u0435\u0442\u043e\u0447\u0438\u0435 \u0442\u0443\u0442 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u043e: ${VAR?} \u0431\u0435\u0437 \u043d\u0435\u0433\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442 \u043f\u0443\u0441\u0442\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443.\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u044e:$ bash t.sht.sh: line 3: CACHE_DIR: CACHE_DIR \u043d\u0435 \u0437\u0430\u0434\u0430\u043d$ echo $?1rm \u0434\u0430\u0436\u0435 \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f.&#8212; \u0438 \u043a\u0430\u0432\u044b\u0447\u043a\u0438\u0414\u0432\u043e\u0439\u043d\u044b\u0435 \u043a\u0430\u0432\u044b\u0447\u043a\u0438 \u0437\u0430\u0449\u0438\u0449\u0430\u044e\u0442 \u043e\u0442 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u044f \u043f\u0443\u0442\u0438 \u0441 \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c\u0438 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (\u043f\u0440\u0438\u0432\u0435\u0442, Bumblebee). \u0410 &#8212; \u0433\u043e\u0432\u043e\u0440\u0438\u0442 rm, \u0447\u0442\u043e \u0434\u0430\u043b\u044c\u0448\u0435 \u0438\u0434\u0443\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0443\u0442\u0438, \u0430 \u043d\u0435 \u043e\u043f\u0446\u0438\u0438: \u0444\u0430\u0439\u043b \u0441 \u0438\u043c\u0435\u043d\u0435\u043c -rf \u0432 \u043f\u0430\u043f\u043a\u0435 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0451\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439.\u0410 \u043a\u0430\u043a \u0436\u0435 &#8212;preserve-root?\u0412 GNU rm \u0437\u0430\u0449\u0438\u0442\u0430 &#8212;preserve-root \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0438 rm -rf \/ \u043e\u0442\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u041d\u043e \u043e\u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0440\u0435\u043d\u044c. rm -rf \/* \u2014 \u044d\u0442\u043e \u0443\u0436\u0435 \u043d\u0435 \u043a\u043e\u0440\u0435\u043d\u044c, \u0430 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432 \u0432 \u043d\u0451\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0441\u043a\u0440\u044b\u043b\u0430 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430, \u0438 &#8212;preserve-root \u0442\u0443\u0442 \u043d\u0435 \u043f\u043e\u043c\u043e\u0436\u0435\u0442. \u0420\u043e\u0432\u043d\u043e \u0442\u0430\u043a \u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b \u0441\u043b\u0443\u0447\u0430\u0439 \u0441\u043e Steam.\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0435\u0441\u0442\u044c &#8212;one-file-system \u2014 \u043e\u043d \u043d\u0435 \u0434\u0430\u0451\u0442 rm \u0443\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u0414\u043b\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u043e\u0447\u0438\u0441\u0442\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0442\u0440\u043e\u0433\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0434\u0438\u0441\u043a\u0438, \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0441\u0442\u0440\u0430\u0445\u043e\u0432\u043a\u0430. \u0418 \u043f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e \u043d\u0430 macOS \u0438 \u0432 BusyBox rm \u043d\u0435 GNU, \u0438 \u043d\u0430\u0431\u043e\u0440 \u0444\u043b\u0430\u0433\u043e\u0432 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f.\u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d#!\/usr\/bin\/env bashset -euo pipefail: &#171;${CACHE_DIR:?CACHE_DIR \u043d\u0435 \u0437\u0430\u0434\u0430\u043d}&#187;# \u041a\u0430\u0442\u0430\u043b\u043e\u0433 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0438 \u0431\u044b\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u043c, \u0430 \u043d\u0435 \u0441\u0438\u043c\u043b\u0438\u043d\u043a\u043e\u043cif [[ ! -d &#171;$CACHE_DIR&#187; || -L &#171;$CACHE_DIR&#187; ]]; then    echo &#171;\u0421\u0442\u0440\u0430\u043d\u043d\u044b\u0439 CACHE_DIR: $CACHE_DIR&#187; &gt;&amp;2    exit 1fireal=$(realpath &#8212; &#171;$CACHE_DIR&#187;)case &#171;$real&#187; in    \/|\/home|\/home\/*\/|&#187;$HOME&#187;|\/usr*|\/etc*|\/var)        echo &#171;\u041e\u0442\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0441\u044c \u0447\u0438\u0441\u0442\u0438\u0442\u044c $real&#187; &gt;&amp;2        exit 1        ;;esacfind &#171;$real&#187; -mindepth 1 -maxdepth 1 -exec rm -rf &#8212;one-file-system &#8212; {} +find -mindepth 1 \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0441\u043a\u0440\u044b\u0442\u044b\u0435 \u0444\u0430\u0439\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 * \u0432 Bash \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0435 \u0437\u0430\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u0442, \u2014 \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435 \u0442\u0440\u043e\u0433\u0430\u0435\u0442 \u0441\u0430\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433.Python: shutil.rmtree \u043d\u0435 \u0434\u0443\u043c\u0430\u0435\u0442 \u0437\u0430 \u0432\u0430\u0441\u0412 Python \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043f\u0438\u0448\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439:shutil.rmtree(path)\u0418 \u0443 \u043d\u0435\u0451 \u0440\u043e\u0432\u043d\u043e \u0442\u0435 \u0436\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. rmtree \u0443\u0434\u0430\u043b\u0438\u0442 \u0442\u043e, \u0447\u0442\u043e \u0435\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u043b\u0438, \u2014 \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0434\u043e\u043c\u0430\u0448\u043d\u0438\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043a\u043e\u043d\u0444\u0438\u0433 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u0441\u044f \u043d\u0435 \u0442\u0430\u043a.\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0442\u0435\u043c\u0430 \u2014 \u0441\u0438\u043c\u043b\u0438\u043d\u043a\u0438. \u0421\u0430\u043c rmtree \u043d\u0430 \u0441\u0438\u043c\u043b\u0438\u043d\u043a \u0440\u0443\u0433\u0430\u0435\u0442\u0441\u044f (OSError: Cannot call rmtree on a symbolic link), \u0430 \u0441\u0438\u043c\u043b\u0438\u043d\u043a\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u0434\u0435\u0440\u0435\u0432\u0430 \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u043a\u0430\u043a \u0441\u0441\u044b\u043b\u043a\u0438, \u043d\u0435 \u0437\u0430\u0445\u043e\u0434\u044f \u0432 \u043d\u0438\u0445. \u041d\u043e \u0435\u0441\u0442\u044c \u0433\u043e\u043d\u043a\u0430: \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u00ab\u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u00bb \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435\u043c \u0435\u0433\u043e \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0434\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u0441\u0438\u043c\u043b\u0438\u043d\u043a. \u041d\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445, \u0433\u0434\u0435 \u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 openat\/unlinkat, rmtree \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u044b \u0438 \u0437\u0430\u0449\u0438\u0449\u0451\u043d \u043e\u0442 \u044d\u0442\u043e\u0439 \u0430\u0442\u0430\u043a\u0438. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c shutil.rmtree.avoids_symlink_attacks (\u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0432 Python 3.3). \u041d\u0430 Linux \u043e\u043d True, \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c False.\u041e\u0431\u0451\u0440\u0442\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u043b\u0438\u0448\u043d\u0435\u0435\u0418\u0434\u0435\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f: \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u043a\u043e\u0440\u043d\u044f \u2014 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u0435\u0448\u0430, \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043f\u0430\u043f\u043a\u0438. \u0412\u0441\u0451 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u2014 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.import shutilimport tempfilefrom pathlib import Pathclass UnsafeDeletion(Exception):    passFORBIDDEN = {Path(&#171;\/&#187;), Path.home().resolve()}def safe_rmtree(target, allowed_root, dry_run=False):    if not target or not str(target).strip():        raise UnsafeDeletion(&#171;\u043f\u0443\u0441\u0442\u043e\u0439 \u043f\u0443\u0442\u044c&#187;)    root = Path(allowed_root).resolve(strict=True)    path = Path(target)    if path.is_symlink():        raise UnsafeDeletion(f&#187;{path} \u2014 \u0441\u0438\u043c\u043b\u0438\u043d\u043a, \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c&#187;)    real = path.resolve(strict=True)    if real in FORBIDDEN or real == root:        raise UnsafeDeletion(f&#187;{real} \u2014 \u0437\u0430\u043f\u0440\u0435\u0449\u0451\u043d\u043d\u044b\u0439 \u043f\u0443\u0442\u044c&#187;)    if not real.is_relative_to(root):        raise UnsafeDeletion(f&#187;{real} \u0432\u043d\u0435 {root}&#187;)    if dry_run:        for p in sorted(real.rglob(&#171;*&#187;)):            print(&#171;\u0443\u0434\u0430\u043b\u0438\u043b \u0431\u044b:&#187;, p)        return    if not shutil.rmtree.avoids_symlink_attacks:        raise UnsafeDeletion(&#171;\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 \u043d\u0435 \u0437\u0430\u0449\u0438\u0449\u0430\u0435\u0442 rmtree \u043e\u0442 \u0441\u0438\u043c\u043b\u0438\u043d\u043a-\u0430\u0442\u0430\u043a&#187;)    shutil.rmtree(real)\u0427\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0432\u0430\u0436\u043d\u043e:\u041f\u0443\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0434\u043e Path(). Path(&#171;&#187;) \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 Path(&#171;.&#187;), \u0442\u043e \u0435\u0441\u0442\u044c \u0432 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433. \u042d\u0442\u043e \u043f\u0438\u0442\u043e\u043d\u043e\u0432\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u043e\u0433 \u043f\u0443\u0441\u0442\u043e\u0433\u043e $STEAMROOT, \u0438 \u043e\u043d \u043a\u0443\u0434\u0430 \u043c\u0435\u043d\u0435\u0435 \u0437\u0430\u043c\u0435\u0442\u0435\u043d.resolve(strict=True) \u0440\u0430\u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442 .. \u0438 \u0441\u0438\u043c\u043b\u0438\u043d\u043a\u0438 \u0438 \u043f\u0430\u0434\u0430\u0435\u0442, \u0435\u0441\u043b\u0438 \u043f\u0443\u0442\u0438 \u043d\u0435\u0442. \u0421\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u043e \u0443\u0436\u0435 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0435 \u043f\u0443\u0442\u0438: \u0441\u0442\u0440\u043e\u043a\u0430 cache\/..\/..\/ \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 cache.is_relative_to (Python 3.9+) \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043f\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c \u043f\u0443\u0442\u0438. \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0447\u0435\u0440\u0435\u0437 str(real).startswith(str(root)) \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u0430: \/srv\/app-old \u00ab\u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f\u00bb \u0441 \/srv\/app.\u0421\u0430\u043c \u043a\u043e\u0440\u0435\u043d\u044c \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f \u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e, \u0447\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0435\u0433\u043e.dry_run \u2014 \u0434\u0435\u0448\u0451\u0432\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0443\u0439\u0434\u0451\u0442, \u0434\u043e \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u043e\u043d\u043e \u0443\u0439\u0434\u0451\u0442.\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430 \u0436\u0438\u0432\u043e\u0439 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 cache \u0441 \u0444\u0430\u0439\u043b\u043e\u043c \u0432\u043d\u0443\u0442\u0440\u0438, \u0430 \u0440\u044f\u0434\u043e\u043c \u2014 \u00ab\u0447\u0443\u0436\u0443\u044e\u00bb \u043f\u0430\u043f\u043a\u0443 \u0441 important.txt \u0438 \u0441\u0438\u043c\u043b\u0438\u043d\u043a \u043d\u0430 \u043d\u0435\u0451 \u0438\u0437 \u043a\u0435\u0448\u0430:base = Path(tempfile.mkdtemp())cache = base \/ &#171;cache&#187;(cache \/ &#171;a&#187;).mkdir(parents=True)(cache \/ &#171;a&#187; \/ &#171;f.txt&#187;).write_text(&#171;x&#187;)victim = Path(tempfile.mkdtemp())(victim \/ &#171;important.txt&#187;).write_text(&#171;!&#187;)(cache \/ &#171;link&#187;).symlink_to(victim)for t in [&#171;&#187;, &#171;\/&#187;, str(base), str(base \/ &#171;cache&#187; \/ &#171;..&#187; \/ &#171;..&#187;), str(cache \/ &#171;link&#187;)]:    try:        safe_rmtree(t, base)    except UnsafeDeletion as e:        print(&#171;\u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043e:&#187;, e)safe_rmtree(cache, base, dry_run=True)safe_rmtree(cache, base)print(cache.exists(), (victim \/ &#171;important.txt&#187;).exists())\u0412\u044b\u0432\u043e\u0434:\u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043e: \u043f\u0443\u0441\u0442\u043e\u0439 \u043f\u0443\u0442\u044c\u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043e: \/ \u2014 \u0437\u0430\u043f\u0440\u0435\u0449\u0451\u043d\u043d\u044b\u0439 \u043f\u0443\u0442\u044c\u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043e: \/tmp\/tmps_zcsnez \u2014 \u0437\u0430\u043f\u0440\u0435\u0449\u0451\u043d\u043d\u044b\u0439 \u043f\u0443\u0442\u044c\u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043e: \/tmp \u0432\u043d\u0435 \/tmp\/tmps_zcsnez\u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043e: \/tmp\/tmps_zcsnez\/cache\/link \u2014 \u0441\u0438\u043c\u043b\u0438\u043d\u043a, \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c\u0443\u0434\u0430\u043b\u0438\u043b \u0431\u044b: \/tmp\/tmps_zcsnez\/cache\/a\u0443\u0434\u0430\u043b\u0438\u043b \u0431\u044b: \/tmp\/tmps_zcsnez\/cache\/a\/f.txt\u0443\u0434\u0430\u043b\u0438\u043b \u0431\u044b: \/tmp\/tmps_zcsnez\/cache\/linkFalse True\u041a\u0435\u0448 \u0443\u0434\u0430\u043b\u0451\u043d, important.txt \u043d\u0430 \u043c\u0435\u0441\u0442\u0435: \u0441\u0438\u043c\u043b\u0438\u043d\u043a \u0432\u043d\u0443\u0442\u0440\u0438 \u0434\u0435\u0440\u0435\u0432\u0430 rmtree \u0441\u043d\u0451\u0441 \u043a\u0430\u043a \u0441\u0441\u044b\u043b\u043a\u0443 \u0438 \u0432 \u0447\u0443\u0436\u0443\u044e \u043f\u0430\u043f\u043a\u0443 \u043d\u0435 \u043f\u043e\u043b\u0435\u0437.onerror, onexc \u0438 read-only \u0444\u0430\u0439\u043b\u044b \u043d\u0430 Windows\u041d\u0430 Windows rmtree \u0447\u0430\u0441\u0442\u043e \u0441\u043f\u043e\u0442\u044b\u043a\u0430\u0435\u0442\u0441\u044f \u043e \u0444\u0430\u0439\u043b\u044b \u0441 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c \u00ab\u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u0435\u043d\u0438\u0435\u00bb \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043d\u0443\u0442\u0440\u0438 .git. \u041e\u0431\u044b\u0447\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u2014 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043e\u0448\u0438\u0431\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043d\u0438\u043c\u0430\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e:import os, statdef _force(func, path, exc):    os.chmod(path, stat.S_IWRITE)    func(path)shutil.rmtree(real, onexc=_force)\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 onexc \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0432 Python 3.12, \u0430 \u0441\u0442\u0430\u0440\u044b\u0439 onerror \u0432 \u0442\u043e\u0439 \u0436\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u043c. \u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c 3.11 \u0438 \u043d\u0438\u0436\u0435, \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c onerror \u2014 \u0443 \u043d\u0435\u0433\u043e \u0442\u0440\u0435\u0442\u0438\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043d\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0430 \u043a\u043e\u0440\u0442\u0435\u0436 \u0438\u0437 sys.exc_info().\u0418 \u0433\u043b\u0430\u0432\u043d\u043e\u0435: \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 ignore_errors=True \u00ab\u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0430\u0434\u0430\u043b\u043e\u00bb. \u0412\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u0435\u0442\u0435 \u0443\u0437\u043d\u0430\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a.\u0427\u0442\u043e \u0435\u0449\u0451 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435\u0423\u0434\u0430\u043b\u044f\u0439\u0442\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e, \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0441\u0430\u043c\u0438. \u041b\u0443\u0447\u0448\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2014 tempfile.TemporaryDirectory() \u0438\u043b\u0438 mktemp -d: \u043f\u0443\u0442\u044c \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u043d\u043e\u0432\u044b\u0439, \u0438 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0435 \u0432\u044b \u0440\u043e\u0432\u043d\u043e \u0435\u0433\u043e. \u0415\u0441\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a\u043b\u0430\u0434\u0451\u0442 \u0444\u0430\u0439\u043b\u044b \u0432 \u043e\u0431\u0449\u0438\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433, \u043f\u0443\u0441\u0442\u044c \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0442\u0430\u043c \u043c\u0430\u0440\u043a\u0435\u0440 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0443\u0441\u0442\u043e\u0439 .myapp-cache) \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0434 \u043e\u0447\u0438\u0441\u0442\u043a\u043e\u0439.\u041d\u0435 \u0431\u0435\u0440\u0438\u0442\u0435 \u043f\u0443\u0442\u044c \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0438\u0437 \u043a\u043e\u043d\u0444\u0438\u0433\u0430 \u0438\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0432\u0432\u043e\u0434\u0430. \u041a\u043e\u043d\u0444\u0438\u0433 \u2014 \u044d\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043a\u043e\u0433\u0434\u0430-\u043d\u0438\u0431\u0443\u0434\u044c \u043a\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e. \u0418\u0437 \u043d\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u0440\u0430\u0442\u044c \u0438\u043c\u044f \u043f\u043e\u0434\u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430, \u043d\u043e \u043a\u043e\u0440\u0435\u043d\u044c, \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435, \u043b\u0443\u0447\u0448\u0435 \u0437\u0430\u0448\u0438\u0442\u044c \u0432 \u043a\u043e\u0434.\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442\u0435, \u043f\u043e\u0442\u043e\u043c \u0443\u0434\u0430\u043b\u044f\u0439\u0442\u0435. \u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 \u00ab\u043a\u043e\u0440\u0437\u0438\u043d\u0443\u00bb \u0432\u0438\u0434\u0430 trash\/2026-11-03\/ \u0441 \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0439 \u043e\u0447\u0438\u0441\u0442\u043a\u043e\u0439 \u0434\u0430\u0451\u0442 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443. \u0414\u043b\u044f \u043a\u0435\u0448\u0435\u0439 \u044d\u0442\u043e \u043f\u043e\u0447\u0442\u0438 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e.\u041b\u043e\u0433\u0438\u0440\u0443\u0439\u0442\u0435, \u0447\u0442\u043e \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0435. \u0425\u043e\u0442\u044f \u0431\u044b \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043f\u0443\u0442\u044c \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0444\u0430\u0439\u043b\u043e\u0432. \u041a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u0440\u0438\u0434\u0451\u0442 \u0441 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c \u00ab\u043a\u0443\u0434\u0430 \u0434\u0435\u043b\u0438\u0441\u044c \u043c\u043e\u0438 \u0434\u0430\u043d\u043d\u044b\u0435\u00bb, \u0443 \u0432\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0442.\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u043d\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0424\u0421. \u0422\u0435\u0441\u0442 \u0432\u044b\u0448\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043f\u0430\u0440\u0443 \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u0441\u0442\u0440\u043e\u043a \u0438 \u043b\u043e\u0432\u0438\u0442 \u043f\u0443\u0441\u0442\u044b\u0435 \u043f\u0443\u0442\u0438, .. \u0438 \u0441\u0438\u043c\u043b\u0438\u043d\u043a\u0438. \u0412 pytest \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u0430\u044f \u0444\u0438\u043a\u0441\u0442\u0443\u0440\u0430 tmp_path.\u0427\u0435\u043a-\u043b\u0438\u0441\u0442 \u0434\u043b\u044f \u0440\u0435\u0432\u044c\u044e\u0412 Bash: set -euo pipefail, ${VAR:?} \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043f\u0443\u0442\u0438 \u0434\u043b\u044f rm, \u043a\u0430\u0432\u044b\u0447\u043a\u0438, &#8212;.\u041d\u0435\u0442 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 &#171;$DIR\/&#187;* \u0431\u0435\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 DIR.\u0412 Python \u043f\u0443\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043e\u0442\u0441\u0435\u043a\u0430\u0435\u0442\u0441\u044f \u0434\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f Path.\u041f\u0443\u0442\u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 resolve(), \u0430 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u2014 \u0447\u0435\u0440\u0435\u0437 is_relative_to, \u0430 \u043d\u0435 startswith.\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u043a\u043e\u0440\u043d\u044f, \u0438 \u0441\u0430\u043c \u043a\u043e\u0440\u0435\u043d\u044c \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f.\u041d\u0435\u0442 ignore_errors=True \u0431\u0435\u0437 \u043e\u0447\u0435\u043d\u044c \u0432\u0435\u0441\u043a\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u044b.\u0415\u0441\u0442\u044c dry_run \u0438\u043b\u0438 \u0445\u043e\u0442\u044f \u0431\u044b \u043b\u043e\u0433 \u0443\u0434\u0430\u043b\u044f\u0435\u043c\u044b\u0445 \u043f\u0443\u0442\u0435\u0439.\u041a\u043e\u0434 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043a\u0443\u0447\u043d\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430 \u0440\u0435\u0432\u044c\u044e \u0435\u0433\u043e \u043f\u0440\u043e\u043b\u0438\u0441\u0442\u044b\u0432\u0430\u044e\u0442. \u041d\u043e \u044d\u0442\u043e \u043e\u0434\u043d\u043e \u0438\u0437 \u043d\u0435\u043c\u043d\u043e\u0433\u0438\u0445 \u043c\u0435\u0441\u0442, \u0433\u0434\u0435 \u043e\u0448\u0438\u0431\u043a\u0430 \u0432 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0432\u0441\u0435\u0445 \u0435\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0445. \u041b\u0438\u0448\u043d\u0438\u0435 \u0434\u0435\u0441\u044f\u0442\u044c \u0441\u0442\u0440\u043e\u043a \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u043e\u0431\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043a\u0443\u0434\u0430 \u0434\u0435\u0448\u0435\u0432\u043b\u0435.\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 https:\/\/habr.com\/ru\/articles\/1102984\/<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-501435","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/501435","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=501435"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/501435\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=501435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=501435"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=501435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}