mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-11-04 07:49:35 +00:00 
			
		
		
		
	update-translations.sh: use kube::util::ensure-temp-dir instead of static path.
Use a temporary directory to hold the generated temporary file. This helps prevent a class of potential security issues on various platforms.
This commit is contained in:
		@@ -14,6 +14,9 @@
 | 
				
			|||||||
# See the License for the specific language governing permissions and
 | 
					# See the License for the specific language governing permissions and
 | 
				
			||||||
# limitations under the License.
 | 
					# limitations under the License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
 | 
				
			||||||
 | 
					source "${KUBE_ROOT}/hack/lib/util.sh"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
KUBECTL_FILES="pkg/kubectl/cmd/*.go pkg/kubectl/cmd/*/*.go"
 | 
					KUBECTL_FILES="pkg/kubectl/cmd/*.go pkg/kubectl/cmd/*/*.go"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
generate_pot="false"
 | 
					generate_pot="false"
 | 
				
			||||||
@@ -62,8 +65,9 @@ if [[ "${generate_pot}" == "true" ]]; then
 | 
				
			|||||||
  perl -pi -e 's/CHARSET/UTF-8/' tmp.pot
 | 
					  perl -pi -e 's/CHARSET/UTF-8/' tmp.pot
 | 
				
			||||||
  perl -pi -e 's/\\\(/\\\\\(/g' tmp.pot
 | 
					  perl -pi -e 's/\\\(/\\\\\(/g' tmp.pot
 | 
				
			||||||
  perl -pi -e 's/\\\)/\\\\\)/g' tmp.pot
 | 
					  perl -pi -e 's/\\\)/\\\\\)/g' tmp.pot
 | 
				
			||||||
  if msgcat -s tmp.pot > /tmp/template.pot; then
 | 
					  kube::util::ensure-temp-dir
 | 
				
			||||||
    mv /tmp/template.pot translations/kubectl/template.pot
 | 
					  if msgcat -s tmp.pot > "${KUBE_TEMP}/template.pot"; then
 | 
				
			||||||
 | 
					    mv "${KUBE_TEMP}/template.pot" translations/kubectl/template.pot
 | 
				
			||||||
    rm tmp.pot
 | 
					    rm tmp.pot
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
    echo "Failed to update template.pot"
 | 
					    echo "Failed to update template.pot"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user