I am trying to apply a patch and recieving a message of patch failure that the file already exist (kgdb patch to kernel, but the question is general for any such patch failure). What should I do in such case ?
ubuntu#ubuntu-laptop:~/dvrrdk/DVRRDK_04.01.00.02/ti_tools/linux_lsp/kernel/linux-dvr-rdk$
patch -p1 < /media/sf_VMshar/gdb_patch/linux-2.6.15.5-kgdb-2.4/core-lite.patch
patching file Documentation/DocBook/Makefile
Hunk #1 FAILED at 10.
1 out of 1 hunk FAILED -- saving rejects to file Documentation/DocBook/Makefile.rej
The next patch would create the file Documentation/DocBook/kgdb.tmpl,
which already exists! Assume -R? [n] ^C
Thanks,
Ran
$ patch -p1 < /media/sf_VMshar/gdb_patch/linux-2.6.15.5-kgdb-2.4/core-lite.patch
patching file Documentation/DocBook/Makefile
Hunk #1 FAILED at 10.
1 out of 1 hunk FAILED -- saving rejects to file Documentation/DocBook/Makefile.rej
The next patch would create the file Documentation/DocBook/kgdb.tmpl,
which already exists! Assume -R? [n] ^C
Error at 1 out of 1 hunk FAILED -- saving rejects to file Documentation/DocBook/Makefile.rej
Is due to the fact that the patch is not meant for this kernel version and also
the next patch intends to create a file Documentation/DocBook/kgdb.tmpl which already exists in your source code
Conclusion: You will have to manually apply the patch
Related
Back story - a vendor gave us buildroot 2017.08.2 with Linux 4.4.49 a long time ago. We never updated the Ubuntu 14.x build machine. Starting over with Ubuntu 20 and the newer GCC is wreaking havoc on the older packages and kernel.
I tried jumping to the longest LTS 5.15 kernel but too many hardware specific patches failed for me to start there while learning & remembering. I put some effort into building 4.4.49 kernel in 2021.11.1 but there are more warnings/errors than I want to make educated guesses at as a way-stop to then updating the kernel.
I selected 4.19.231 as 'recent enough but close enough'. I cannot see why the hunk below is failing to patch the Makefile.
Applying 0001-add-am33x-firmware.patch using patch:
patching file firmware/am335x-bone-scale-data.bin
patching file firmware/am335x-evm-scale-data.bin
patching file firmware/am335x-pm-firmware.bin
patching file firmware/am335x-pm-firmware.elf
patching file firmware/am43x-evm-scale-data.bin
patching file firmware/.gitignore
Applying 0002-add-8250-serial-tx-hooks.patch using patch:
patching file drivers/tty/serial/8250/8250_port.c
Hunk #1 succeeded at 1516 with fuzz 1 (offset 236 lines).
Hunk #2 succeeded at 1590 with fuzz 2 (offset 296 lines).
Hunk #3 succeeded at 1649 with fuzz 2 (offset 329 lines).
Hunk #4 succeeded at 3377 (offset 439 lines).
Applying 0003-add-tty-tx-en-driver.patch using patch:
**patching file drivers/misc/Makefile
Hunk #1 FAILED at 53.**
1 out of 1 hunk FAILED -- saving rejects to file drivers/misc/Makefile.rej
patching file drivers/misc/Kconfig
Hunk #1 succeeded at 513 with fuzz 2 (offset -12 lines).
patching file drivers/misc/tty_tx_en.c
make[1]: *** [package/pkg-generic.mk:251: /home/dobleadmin/Buildroot2021/buildroot-2021.11.1/output/build/linux-4.19.231/.stamp_patched] Error 1
make: *** [Makefile:84: _all] Error 2
The Makefile section:
obj-$(CONFIG_GENWQE) += genwqe/
obj-$(CONFIG_ECHO) += echo/
obj-$(CONFIG_VEXPRESS_SYSCFG) += vexpress-syscfg.o
obj-$(CONFIG_CXL_BASE) += cxl/
obj-$(CONFIG_ASPEED_LPC_CTRL) += aspeed-lpc-ctrl.o
obj-$(CONFIG_ASPEED_LPC_SNOOP) += aspeed-lpc-snoop.o
The patch hunk:
Index: linux-custom/drivers/misc/Makefile
===================================================================
--- linux-custom.orig/drivers/misc/Makefile
+++ linux-custom/drivers/misc/Makefile ## -52,3 +52,4 ## obj-$(CONFIG_GENWQE) += genwqe/
obj-$(CONFIG_ECHO) += echo/
obj-$(CONFIG_VEXPRESS_SYSCFG) += vexpress-syscfg.o
obj-$(CONFIG_CXL_BASE) += cxl/
+obj-$(CONFIG_TTY_TX_EN) += tty_tx_en.o
Your patch can not be applied: in 4.4 it was applied at the end of the file, after the line containing CONFIG_CXL_BASE. This line is no longer the last one in v4.19. Given the change, it should however be trivial to update the patch.
I want to build linux-rt kernel and after downloading kernel and patch from kernel.org website i run this command as with documentation:
gzip -cd ../patch-5.11.4-rt11.patch.gz | patch -p1 --verbose {}
now i see this line in first time
patching file {}
Using Plan A...
Hunk #1 FAILED at 35.
1 out of 1 hunk FAILED -- saving rejects to file {}.rej
Hmm... The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
|index d7db179963221..c33b0e16d04b4 100644
|--- a/include/linux/rbtree.h
|+++ b/include/linux/rbtree.h
--------------------------
patching file {}
Using Plan A...
Hunk #1 FAILED at 19.
Hunk #2 FAILED at 112.
2 out of 2 hunks FAILED -- saving rejects to file {}.rej
Hmm...The next patch would create the file {},
which already exists! Assume -R? [n]
which key should be pressed to apply this patches ?
How can we...
use the Ant task patch in Linux for patching files with DOS linefeeds?
apply the command line option --binary with the Ant task patch?
See the details below.
Files
build.xml: Ant build file with a patch task
test.patch: patch file with DOS linefeeds
test.txt: source file with DOS linefeeds
Command line patch fails
DOS linefeeds in the patch file are converted into Unix linefeeds and patching
fails:
[0] mypc<u0>:~/src/test/ant_patch_crlf>patch -i test.patch
(Stripping trailing CRs from patch; use --binary to disable.)
patching file test.txt
Hunk #1 FAILED at 1 (different line endings).
1 out of 1 hunk FAILED -- saving rejects to file test.txt.rej
Command line patch --binary works fine
As suggested above
use --binary to disable
adding the option --binary helps:
[0] mypc<u0>:~/src/test/ant_patch_crlf>patch --binary -i test.patch
patching file test.txt
Ant task patch fails
Ant task patch fails with the same error than command line without the
option --binary:
[0] mypc<u0>:~/src/test/ant_patch_crlf>ant
Buildfile: /home/u0/src/test/ant_patch_crlf/build.xml
patch:
[patch] (Stripping trailing CRs from patch; use --binary to disable.)
[patch] patching file test.txt
[patch] Hunk #1 FAILED at 1 (different line endings).
[patch] 1 out of 1 hunk FAILED -- saving rejects to file test.txt.rej
[patch] 'patch' failed with exit code 1
BUILD SUCCESSFUL
Total time: 0 seconds
I'm getting the following error and have no idea why. All my extensions are properly installed to not effect any code code.
Any ideas?
sudo sh ./PATCH_SUPEE-9767_CE_1.9.3.0_v1-2017-05-25-09-09-56.sh
./PATCH_SUPEE-9767_CE_1.9.3.0_v1-2017-05-25-09-09-56.sh: 14: ./PATCH_SUPEE-9767_CE_1.9.3.0_v1-2017-05-25-09-09-56.sh: 127: not found
./PATCH_SUPEE-9767_CE_1.9.3.0_v1-2017-05-25-09-09-56.sh: 14: ./PATCH_SUPEE-9767_CE_1.9.3.0_v1-2017-05-25-09-09-56.sh: 127: not found
./PATCH_SUPEE-9767_CE_1.9.3.0_v1-2017-05-25-09-09-56.sh: 25: ./PATCH_SUPEE-9767_CE_1.9.3.0_v1-2017-05-25-09-09-56.sh: 0: not found
Checking if patch can be applied/reverted successfully...
-e ERROR: Patch can't be applied/reverted successfully.
checking file app/code/core/Mage/Admin/Model/Session.php
checking file app/code/core/Mage/Adminhtml/Block/Checkout/Formkey.php
checking file app/code/core/Mage/Adminhtml/Block/Notification/Symlink.php
checking file app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Date.php
checking file app/code/core/Mage/Adminhtml/Model/Config/Data.php
checking file app/code/core/Mage/Adminhtml/controllers/Catalog/Product/GalleryController.php
checking file app/code/core/Mage/Checkout/controllers/MultishippingController.php
checking file app/code/core/Mage/Checkout/controllers/OnepageController.php
Hunk #1 succeeded at 350 (offset 1 line).
Hunk #2 succeeded at 370 (offset 1 line).
Hunk #3 succeeded at 417 (offset 1 line).
Hunk #4 succeeded at 446 (offset 1 line).
Hunk #5 succeeded at 485 (offset 1 line).
checking file app/code/core/Mage/Checkout/etc/system.xml
checking file app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage.php
Hunk #1 succeeded at 282 (offset -1 lines).
checking file app/code/core/Mage/Core/Controller/Front/Action.php
checking file app/code/core/Mage/Core/Controller/Request/Http.php
checking file app/code/core/Mage/Core/Model/File/Validator/Image.php
checking file app/code/core/Mage/Core/etc/system.xml
checking file app/code/core/Mage/Customer/Model/Session.php
checking file app/code/core/Mage/Dataflow/Model/Convert/Adapter/Zend/Cache.php
checking file app/code/core/Mage/Dataflow/Model/Convert/Container/Abstract.php
checking file app/code/core/Mage/Dataflow/Model/Convert/Parser/Csv.php
checking file app/code/core/Mage/Dataflow/Model/Convert/Parser/Xml/Excel.php
checking file app/code/core/Mage/ImportExport/Model/Import/Uploader.php
checking file app/code/core/Mage/Sales/Model/Quote/Item.php
checking file app/code/core/Mage/Widget/Model/Widget/Instance.php
checking file app/code/core/Mage/XmlConnect/Helper/Image.php
checking file app/code/core/Mage/XmlConnect/controllers/Adminhtml/MobileController.php
checking file app/design/adminhtml/default/default/layout/main.xml
checking file app/design/adminhtml/default/default/template/notification/formkey.phtml
checking file app/design/adminhtml/default/default/template/notification/symlink.phtml
checking file app/design/adminhtml/default/default/template/page/head.phtml
checking file app/design/frontend/base/default/template/checkout/cart/shipping.phtml
checking file app/design/frontend/base/default/template/checkout/multishipping/billing.phtml
checking file app/design/frontend/base/default/template/checkout/multishipping/shipping.phtml
checking file app/design/frontend/base/default/template/checkout/onepage/billing.phtml
checking file app/design/frontend/base/default/template/checkout/onepage/payment.phtml
Hunk #1 succeeded at 35 (offset -1 lines).
checking file app/design/frontend/base/default/template/checkout/onepage/shipping.phtml
checking file app/design/frontend/base/default/template/checkout/onepage/shipping_method.phtml
checking file app/design/frontend/base/default/template/persistent/checkout/onepage/billing.phtml
checking file app/design/frontend/rwd/default/layout/page.xml
checking file app/design/frontend/rwd/default/template/checkout/cart/shipping.phtml
checking file app/design/frontend/rwd/default/template/checkout/multishipping/addresses.phtml
checking file app/design/frontend/rwd/default/template/checkout/multishipping/billing.phtml
checking file app/design/frontend/rwd/default/template/checkout/onepage/payment.phtml
Hunk #1 succeeded at 36 (offset -1 lines).
checking file app/design/frontend/rwd/default/template/checkout/onepage/shipping.phtml
checking file app/design/frontend/rwd/default/template/persistent/checkout/onepage/billing.phtml
checking file app/etc/config.xml
checking file app/locale/en_US/Mage_Adminhtml.csv
Hunk #1 succeeded at 1281 (offset -4 lines).
checking file app/locale/en_US/Mage_Core.csv
Hunk #1 succeeded at 406 (offset -1 lines).
checking file app/locale/en_US/Mage_Dataflow.csv
checking file app/locale/en_US/Mage_XmlConnect.csv
checking file downloader/Maged/Connect.php
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
3 out of 3 hunks ignored
checking file downloader/Maged/Controller.php
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
2 out of 2 hunks ignored
checking file downloader/Maged/Model/Session.php
Hunk #1 succeeded at 96 with fuzz 2 (offset 14 lines).
Hunk #2 succeeded at 302 with fuzz 2 (offset 29 lines).
checking file js/lib/jquery/jquery-1.12.0.js
checking file js/lib/jquery/jquery-1.12.0.min.js
checking file js/lib/jquery/jquery-1.12.0.min.map
checking file js/varien/payment.js
checking file skin/frontend/base/default/js/opcheckout.js
Hunk #1 succeeded at 711 (offset 27 lines).
The hunk error normally came because it will not match the file lines. In this case you can do 2 things.
Replace those mention error files with new same version Magento setup and then try to install the patch using SSH.
Install the patch manually.
In this patch in front end only form key is added in checkout and cart files so you can do it manually.
Thanks.
I had a similar issue.
The solution for me was next:
Check if you have 'downloader' folder in your project, if not (usually it is not under git) - download it (better from the current project, versions can be different);
Revert the previous version of this patch (description of the patch - "Note that you must revert SUPEE-9767 version 1 before deploying version 2.")
($ bash ./PATCH_SUPEE-9767_CE_1.9.3.0_v1-2017-05-25-09-09-56.sh -R)
and after that try to patch 2nd version.
First, since I'm a newbie at git, I'll have to post more background then may be necessary.
(I've edited this to remove all the path/file_names and search_for patterns)
# git apply -v patch_name.patch
[...] trailing whitespace.
[...] trailing whitespace.
error: [...]
error: patch failed: ... :255
error: [...] : patch does not apply
[...]
I didn't find any 255 git errors, but I did find a promising one: git: patch does not apply Except this command produces error,
git apply --ignore-space-change --ignore-whitespace mychanges.patch
> error: unknown option `ignore-whitespace'
Same for the other --ignore-space-change option. A search at the Git Wiki could not find these commands. I'm using Linux/Fedora F11, a few years old, but I'm a newbie and not going for linux certification :). What is the equivalent command for Linux/Fedora?
PS. Yes, just what I was thinking. Git is slang for idiot, which is synonymous for newbie
UPDATE Below is the new message from git. Is this half fixed?
file_name.patch:26: trailing whitespace.
file_name.patch:39: trailing whitespace.
Checking patch file_name...
Hunk #1 succeeded at 294 (offset 6 lines).
Checking patch file_name.inc...
Hunk #1 succeeded at 23 (offset -1 lines).
Checking patch [...]
Hunk #1 succeeded at 79 (offset 12 lines).
error: while searching for:
[...]
error: patch failed: file_name:255
error: file_name: patch does not apply
Checking patch file_name...
Hunk #1 succeeded at 17 (offset 4 lines).
What do you get from git --version? --ignore-whitespace was added in version 1.6.5. Assuming you have an older version and don't want to upgrade, maybe --whitespace=fix would help?