Pergunta

Per the Magento download page, under the patches section

Please upload the patch into your Magento root directory and run the appropriate SSH command: For patch files with the file extension `.sh: sh patch_file_name.sh Example: sh PATCH_SUPEE-1868_CE_1.7.0.2_v1.sh

Magento recommends a direct invocation of the sh command to run their patch runner. The file extension of .sh supports this as well.

However, if you look at the top of each patch runner file, the shebang line points to bash.

#!/bin/bash
# Patch apllying tool template
# v0.1.2
# (c) Copyright 2013. Magento Inc.
#

The programmer in me wants to trust the source file, but the process wonk wants to obey what's written on the Magento website, the cynic wonders if the patch has been tested against the differences between bash and sh.

Foi útil?

Solução

You must use bash, actually. On line 14 of the patch you explicitly pointed out is this code:

if (( $? != 0 )); then

$(( is a valid arithmetic expression in XCU sh, but (( is not.)

On many UNIX-like platforms, however, /bin/sh is just a symlink to /bin/bash. When invoked with the name sh, bash does disable some of its POSIXly-unstrict behavior, but not all of it. It's likely that these patches would work fine for bash invoked as sh.

Outras dicas

In case it helps someone in future, I have used Phpstorm to apply patch and its patch tool is great. It took less than 30 seconds to apply patch without any issues and you can also see and go through the differences the files have.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a magento.stackexchange
scroll top