From: Kefu Chai Date: Tue, 23 Jun 2026 23:11:24 +0000 (+0800) Subject: script: fix invalid escape sequences X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F69687%2Fhead;p=ceph.git script: fix invalid escape sequences Python 3.12 warns on invalid escape sequences in non-raw strings: ``` ceph-release-notes:45: SyntaxWarning: invalid escape sequence '\d' cpatch.py:465: SyntaxWarning: invalid escape sequence '\;' ``` In `cpatch.py`, use raw strings for the two Dockerfile RUN lines so their find -exec ... \; keeps the literal backslash-semicolon. Signed-off-by: Kefu Chai --- diff --git a/src/script/cpatch.py b/src/script/cpatch.py index 5e33e9b2c13..b891c8c70ea 100755 --- a/src/script/cpatch.py +++ b/src/script/cpatch.py @@ -462,12 +462,12 @@ class Builder: if os.path.isdir(self._workdir / "tmp_bin"): # For every binary file that was copied to the tmp_bin directory by the jobs above, search for the existing file in the container and replace it. dlines.append("ADD tmp_bin /tmpbin") - dlines.append("RUN for i in tmpbin/*; do find /usr/bin /usr/sbin -name $(basename $i) -exec mv -f $i '{}' \;; echo $(basename $i); done && rm -rf tmpbin") + dlines.append(r"RUN for i in tmpbin/*; do find /usr/bin /usr/sbin -name $(basename $i) -exec mv -f $i '{}' \;; echo $(basename $i); done && rm -rf tmpbin") if os.path.isdir(self._workdir / "tmp_lib"): # For every library file that was copied to the tmp_lib directory by the jobs above, search for the existing file in the container and replace it. dlines.append("ADD tmp_lib /tmplib") - dlines.append("RUN for i in tmplib/*; do find /usr/lib64 -name $(basename $i) -exec mv -f $i '{}' \;; echo $(basename $i); done && rm -rf tmplib") + dlines.append(r"RUN for i in tmplib/*; do find /usr/lib64 -name $(basename $i) -exec mv -f $i '{}' \;; echo $(basename $i); done && rm -rf tmplib") if os.path.isdir(self._workdir / "tmp_bin"): # by default locally built binaries assume /usr/local