Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hunk failing on simple patch, how should I interpret the rejection file?

Tags:

git

patch

I am trying to create a patch that removes the last 20 or so lines from a makefile but am getting "Hunk #1 FAILED at 14." and the following rejection file.

***************
*** 14,35 ****

  host_cpu = @host_cpu@

- if MAC_DARWIN
- carbon = @enable_carbon@
- bin_SCRIPTS = $(launch_scripts)
- install: install-am
- if UniversalMacBinary
-     $(CC) -arch ppc -o aoutppc -Dcpu="\"$(host_cpu)\"" -I. $(srcdir)/launch.c $(srcdir)/mac2uxarg.c -framework Carbon
-     $(CC) -arch i386 -o aouti386 -Dcpu="\"$(host_cpu)\"" -I. $(srcdir)/launch.c $(srcdir)/mac2uxarg.c -framework Carbon
-     lipo aouti386 aoutppc -create -output a.out
- else
-     gcc -g -arch i386 -Dncpu="\"$(host_cpu)\"" -I. $(srcdir)/launch.c $(srcdir)/mac2uxarg.c -framework Carbon
-
- endif
-     carbon=$(carbon) sh $(srcdir)/launch_inst.sh "$(host_cpu)" "$(DESTDIR)$(prefix)" "$(srcdir)"
-     for i in $(S) ; do \
-         sed "s/^CPU.*/CPU=\"$(host_cpu)\"/" < $(DESTDIR)$(bindir)/$$i > temp; \
-         mv temp $(DESTDIR)$(bindir)/$$i; \
-         chmod 755 $(DESTDIR)$(bindir)/$$i; \
-     done
- endif
--- 14,16 ----

  host_cpu = @host_cpu@

How should I interpret it? I would have thought that the lines 14-16 were a match. The patch is

diff --git a/src/mac/Makefile.am b/src/mac/Makefile.am
index a612653..76d9389 100755
--- a/src/mac/Makefile.am
+++ b/src/mac/Makefile.am
@@ -14,22 +14,3 @@ EXTRA_DIST = maccmd.c njconf.h nrnneosm.h bbsconf.h macnrn.h nrnconf.h \

 host_cpu = @host_cpu@

-if MAC_DARWIN
-carbon = @enable_carbon@
-bin_SCRIPTS = $(launch_scripts)
-install: install-am
-if UniversalMacBinary
-    $(CC) -arch ppc -o aoutppc -Dcpu="\"$(host_cpu)\"" -I. $(srcdir)/launch.c $(srcdir)/mac2uxarg.c -framework Carbon
-    $(CC) -arch i386 -o aouti386 -Dcpu="\"$(host_cpu)\"" -I. $(srcdir)/launch.c $(srcdir)/mac2uxarg.c -framework Carbon
-    lipo aouti386 aoutppc -create -output a.out
-else
-    gcc -g -arch i386 -Dncpu="\"$(host_cpu)\"" -I. $(srcdir)/launch.c $(srcdir)/mac2uxarg.c -framework Carbon
-
-endif
-    carbon=$(carbon) sh $(srcdir)/launch_inst.sh "$(host_cpu)" "$(DESTDIR)$(prefix)" "$(srcdir)"
-    for i in $(S) ; do \
-        sed "s/^CPU.*/CPU=\"$(host_cpu)\"/" < $(DESTDIR)$(bindir)/$$i > temp; \
-        mv temp $(DESTDIR)$(bindir)/$$i; \
-        chmod 755 $(DESTDIR)$(bindir)/$$i; \
-    done
-endif
like image 615
Tom Close Avatar asked Feb 01 '26 02:02

Tom Close


1 Answers

Sorry, should have done some more digging before asking. The problem was that I was pasting the patch into another file using vim and it was changing the line endings.

I fixed it by saving piping the patch directly to the file using >>

git diff >> my_file
like image 193
Tom Close Avatar answered Feb 03 '26 22:02

Tom Close



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!