Bug 228788 - databases/mysql80-client fails to patch
Summary: databases/mysql80-client fails to patch
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Mahdi Mokhtari
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-06 18:03 UTC by Curtis Villamizar
Modified: 2018-08-14 14:44 UTC (History)
3 users (show)

See Also:
mmokhi: maintainer-feedback+


Attachments
files/patch-utilities_CMakeLists.txt - one character change - fixes problem (682 bytes, patch)
2018-06-06 23:21 UTC, Curtis Villamizar
no flags Details | Diff
replacement patch for databases/mysql80-client/files/patch-utilities_CMakeLists.txt (657 bytes, patch)
2018-06-17 00:32 UTC, Curtis Villamizar
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Curtis Villamizar 2018-06-06 18:03:49 UTC
databases/mysql80-client and databases/mysql80-server at r471861

#  cd databases/mysql80-client ; rm -rf work ; make patch

===>  Patching for mysql80-client-8.0.11
===>  Applying FreeBSD patches for mysql80-client-8.0.11
Ignoring previously applied (or reversed) patch.
3 out of 3 hunks ignored--saving rejects to CMakeLists.txt.rej
=> FreeBSD patch patch-CMakeLists.txt failed to apply cleanly.

#  find work -name \*.rej

work/mysql-8.0.11/utilities/CMakeLists.txt.rej
work/mysql-8.0.11/CMakeLists.txt.rej

All three patches in files/patch-CMakeLists.txt fail.  One patch in files/patch-utilities_CMakeLists.txt fails.

#  cat work/mysql-8.0.11/utilities/CMakeLists.txt.rej
@@ -87,4 +88,5 @@
 ENDIF()
 
+IF(FALSE)
 MYSQL_ADD_EXECUTABLE(my_print_defaults my_print_defaults.c)
 TARGET_LINK_LIBRARIES(my_print_defaults  mysys mysys_ssl)

#  uname -a

FreeBSD r11-amd64.v6ds.occnc.com 11.2-BETA3 FreeBSD 11.2-BETA3 #0 r334309: Tue May 29 11:48:53 EDT 2018     root@amd64-boot1.v6only.occnc.com:/usr/releng/r11-20180528/obj.amd64.occnc11.amd64/usr/releng/r11-20180528/src/sys/occnc11.amd64  amd64
Comment 1 Curtis Villamizar 2018-06-06 23:21:58 UTC
Created attachment 194057 [details]
files/patch-utilities_CMakeLists.txt - one character change - fixes problem

Changed my_print_defaults.c to my_print_defaults.cc and make patch works.
Make install also works.
Comment 2 Curtis Villamizar 2018-06-06 23:25:28 UTC
Ignore comment about work/mysql-8.0.11/CMakeLists.txt.rej .  That was due to trying to reapply make patch.  rm -rf work and make patch doesn't produce this.
Running make patch again after a failure produces this.  The one line fix solves the only problem.
Comment 3 Fernando Apesteguía freebsd_committer 2018-06-10 16:39:40 UTC
(In reply to Curtis Villamizar from comment #2)

Hi Curtis, I'm in Revision: 471939 and I can not reproduce the problem:

fernape@hammer:~/FreeBSD-repos/ports/head/databases/mysql80-client$ make patch
===>  License GPLv2 accepted by the user
===>   mysql80-client-8.0.11 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by mysql80-client-8.0.11 for building
===>  Extracting for mysql80-client-8.0.11
=> SHA256 Checksum OK for mysql-boost-8.0.11.tar.gz.
/usr/home/fernape/FreeBSD-repos/ports/head/databases/mysql80-client/work/mysql-8.0.11/sql/sql_hints.yy.cc                                                      
/usr/home/fernape/FreeBSD-repos/ports/head/databases/mysql80-client/work/mysql-8.0.11/sql/sql_hints.yy.h                                                       
===>  Patching for mysql80-client-8.0.11
===>  Applying FreeBSD patches for mysql80-client-8.0.11
fernape@hammer:~/FreeBSD-repos/ports/head/databases/mysql80-client$

fernape@hammer:~/FreeBSD-repos/ports/head/databases/mysql80-server$ make patch                                                                            

===>  License GPLv2 accepted by the user
===>   mysql80-server-8.0.11 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by mysql80-server-8.0.11 for building
===>  Extracting for mysql80-server-8.0.11
=> SHA256 Checksum OK for mysql-boost-8.0.11.tar.gz.
/usr/home/fernape/FreeBSD-repos/ports/head/databases/mysql80-server/work/mysql-8.0.11/sql/sql_hints.yy.cc
/usr/home/fernape/FreeBSD-repos/ports/head/databases/mysql80-server/work/mysql-8.0.11/sql/sql_hints.yy.h
===>  Patching for mysql80-server-8.0.11
===>  Applying FreeBSD patches for mysql80-server-8.0.11
fernape@hammer:~/FreeBSD-repos/ports/head/databases/mysql80-server$

Would you mind to try again?
Comment 4 Curtis Villamizar 2018-06-11 02:27:04 UTC
I can't see how your copy could possibly work.  The file my_print_defaults.c is simply missing and replaced with my_print_defaults.cc.  Try reproducing by doing a "rm -rf work" and then "make patch".  If you did a prior "make extract" you may have an old distro.  Note that mysql80-server has the distinfo file so that has to be up to date too.

This is entirely reproducible.  Be sure *both* mysql80-client and mysql80-server are updated.

[r11-amd64 234] # cd /usr/ports/databases/
[r11-amd64 235] # svn update ../mysql80-*
svn: No match.
[r11-amd64 236] # svn update mysql80-*
Updating 'mysql80-client':
At revision 472103.
Updating 'mysql80-server':
At revision 472103.
Summary of updates:
  Updated 'mysql80-client' to r472103.
  Updated 'mysql80-server' to r472103.
[r11-amd64 237] # svn update mysql80-*
Updating 'mysql80-client':
At revision 472163.
Updating 'mysql80-server':
At revision 472163.
Summary of updates:
  Updated 'mysql80-client' to r472163.
  Updated 'mysql80-server' to r472163.
[r11-amd64 238] # svn diff mysql80-client/
Index: mysql80-client/files/patch-utilities_CMakeLists.txt
===================================================================
--- mysql80-client/files/patch-utilities_CMakeLists.txt (revision 472163)
+++ mysql80-client/files/patch-utilities_CMakeLists.txt (working copy)
@@ -12,7 +12,7 @@
  ENDIF()
  
 +IF(FALSE)
- MYSQL_ADD_EXECUTABLE(my_print_defaults my_print_defaults.c)
+ MYSQL_ADD_EXECUTABLE(my_print_defaults my_print_defaults.cc)
  TARGET_LINK_LIBRARIES(my_print_defaults  mysys mysys_ssl)
 @@ -142,11 +144,14 @@ IF(WITH_INNOBASE_STORAGE_ENGINE)
    TARGET_LINK_LIBRARIES(innochecksum mysys mysys_ssl ${LZ4_LIBRARY})
[r11-amd64 239] # find mysql80-client/work/
mysql-8.0.11/ pkg/          stage/        
[r11-amd64 239] # find mysql80-client/work/mysql-8.0.11 -name my_print_defaults.c
[r11-amd64 240] # find mysql80-client/work/mysql-8.0.11 -name my_print_defaults.cc
mysql80-client/work/mysql-8.0.11/utilities/my_print_defaults.cc
[r11-amd64 241] # ( cd mysql80-client ; make config )
===> No options to configure

[r11-amd64 246] # cat mysql80-server/distinfo 
TIMESTAMP = 1524414416
SHA256 (mysql-boost-8.0.11.tar.gz) = f40711a9bd91ab2ccea331484a6d281f806b0fdecf78f4c9e9d8a4c91208f309
SIZE (mysql-boost-8.0.11.tar.gz) = 77647598
[r11-amd64 247] # tar -tf ../distfiles/mysql-boost-8.0.11.tar.gz | grep my_print_defaults
mysql-8.0.11/man/my_print_defaults.1
mysql-8.0.11/utilities/my_print_defaults.cc
Comment 5 Fernando Apesteguía freebsd_committer 2018-06-11 17:48:23 UTC
(In reply to Curtis Villamizar from comment #4)

Hi Curtis,

Unfortunately I can not reproduce it.

In my system, with updated ports tree:

fernape@hammer:~/FreeBSD-repos/ports/head/databases/mysql80-client$ svn st
fernape@hammer:~/FreeBSD-repos/ports/head/databases/mysql80-client$ svn up
Updating '.':
At revision 472196.
fernape@hammer:~/FreeBSD-repos/ports/head/databases/mysql80-client$ make patch
===>  License GPLv2 accepted by the user
===>   mysql80-client-8.0.11 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by mysql80-client-8.0.11 for building
===>  Extracting for mysql80-client-8.0.11
=> SHA256 Checksum OK for mysql-boost-8.0.11.tar.gz.
/usr/home/fernape/FreeBSD-repos/ports/head/databases/mysql80-client/work/mysql-8.0.11/sql/sql_hints.yy.cc
/usr/home/fernape/FreeBSD-repos/ports/head/databases/mysql80-client/work/mysql-8.0.11/sql/sql_hints.yy.h
===>  Patching for mysql80-client-8.0.11
===>  Applying FreeBSD patches for mysql80-client-8.0.11
fernape@hammer:~/FreeBSD-repos/ports/head/databases/mysql80-client$ 

It really doesn't matter that my_print_defaults.c does not exist, because the patch files/patch-utilities_CMakeLists.txt adds a IF(FALSE) on top of that section so the my_print_defaults executable is never built.

In fact if I try to apply your proposed patch, it fails:

fernape@hammer:~/FreeBSD-repos/ports/head/databases/mysql80-client$ cat ~/Downloads/file_228788.txt 
Index: databases/mysql80-client/files/patch-utilities_CMakeLists.txt
===================================================================
--- databases/mysql80-client/files/patch-utilities_CMakeLists.txt       (revision 471884)
+++ databases/mysql80-client/files/patch-utilities_CMakeLists.txt       (working copy)
@@ -12,7 +12,7 @@
  ENDIF()
  
 +IF(FALSE)
- MYSQL_ADD_EXECUTABLE(my_print_defaults my_print_defaults.c)
+ MYSQL_ADD_EXECUTABLE(my_print_defaults my_print_defaults.cc)
  TARGET_LINK_LIBRARIES(my_print_defaults  mysys mysys_ssl)
 @@ -142,11 +144,14 @@ IF(WITH_INNOBASE_STORAGE_ENGINE)
    TARGET_LINK_LIBRARIES(innochecksum mysys mysys_ssl ${LZ4_LIBRARY})
fernape@hammer:~/FreeBSD-repos/ports/head/databases/mysql80-client$ patch -p2 < ~/Downloads/file_228788.txt 
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|Index: databases/mysql80-client/files/patch-utilities_CMakeLists.txt
|===================================================================
|--- databases/mysql80-client/files/patch-utilities_CMakeLists.txt       (revision 471884)
|+++ databases/mysql80-client/files/patch-utilities_CMakeLists.txt       (working copy)
--------------------------
Patching file files/patch-utilities_CMakeLists.txt using Plan A...
Hunk #1 failed at 12.
1 out of 1 hunks failed--saving rejects to files/patch-utilities_CMakeLists.txt.rej
done
fernape@hammer:~/FreeBSD-repos/ports/head/databases/mysql80-client$ 

That make sense since your patch adds the IF(FALSE) too.

Could you double check that your mysql80-* directories are completely clean? No rest of other patches whatsoever?

Thanks in advance.
Comment 6 Curtis Villamizar 2018-06-13 16:37:12 UTC
IMPORTANT: In order to reproduce this bug, mysql80-server must be up to date!

The mysql80-client directory does not contain the distinfo file.  The makefile contains the line "MASTERDIR= ${.CURDIR}/../mysql80-server" which refers to the mysql80-server directory which is where it picks up the distinfo file.

If mysql80-server is not up to date when mysql80-client is built then older source will be used and therefore you won't be able to reproduce the bug (and also the patch provided will fail).
Comment 7 Fernando Apesteguía freebsd_committer 2018-06-13 17:19:02 UTC
(In reply to Curtis Villamizar from comment #6)

Let's see if we can find where your story and mine diverge :)

OK, so:

fernape@hammer:~/FreeBSD-repos/ports/head$ make -C databases/mysql80-server/ -V DISTNAME
mysql-boost-8.0.11
fernape@hammer:~/FreeBSD-repos/ports/head$ make -C databases/mysql80-client/ -V DISTNAME                                                                       
mysql-boost-8.0.11

Is this the version you see?

fernape@hammer:~/FreeBSD-repos/ports/head$ sudo make -C databases/mysql80-client/ clean distclean
===>  Cleaning for mysql80-client-8.0.11
===>  Deleting distfiles for mysql80-client-8.0.11
fernape@hammer:~/FreeBSD-repos/ports/head$ sudo make -C databases/mysql80-server/ clean distclean                                                              
===>  Cleaning for mysql80-server-8.0.11
===>  Deleting distfiles for mysql80-server-8.0.11

Clean work directory and distribution files for both ports.

fernape@hammer:~/FreeBSD-repos/ports/head$ svn up
Updating '.':
At revision 472333.

Very updated ports tree checkout

fernape@hammer:~/FreeBSD-repos/ports/head$ svn st databases/mysql80-client/
fernape@hammer:~/FreeBSD-repos/ports/head$ svn st databases/mysql80-server/

No local changes.

fernape@hammer:~/FreeBSD-repos/ports/head$ sudo make -C databases/mysql80-client/ patch                                                                        
===>  License GPLv2 accepted by the user
===>   mysql80-client-8.0.11 depends on file: /usr/local/sbin/pkg - found
=> mysql-boost-8.0.11.tar.gz doesn't seem to exist in /usr/home/fernape/FreeBSD-repos/ports/head/distfiles/.
=> Attempting to fetch ftp://ftp.fi.muni.cz/pub/mysql/Downloads/MySQL-8.0/mysql-boost-8.0.11.tar.gz
mysql-boost-8.0.11.tar.gz                     100% of   74 MB 5507 kBps 00m14s
===> Fetching all distfiles required by mysql80-client-8.0.11 for building
===>  Extracting for mysql80-client-8.0.11
=> SHA256 Checksum OK for mysql-boost-8.0.11.tar.gz.
/usr/home/fernape/FreeBSD-repos/ports/head/databases/mysql80-client/work/mysql-8.0.11/sql/sql_hints.yy.cc
/usr/home/fernape/FreeBSD-repos/ports/head/databases/mysql80-client/work/mysql-8.0.11/sql/sql_hints.yy.h
===>  Patching for mysql80-client-8.0.11
===>  Applying FreeBSD patches for mysql80-client-8.0.11
fernape@hammer:~/FreeBSD-repos/ports/head$ 

So it downloaded the correct distfile and applied the patch.

Can you reproduce these steps?

Thanks in advance.
Comment 8 Curtis Villamizar 2018-06-14 20:20:18 UTC
Thanks for continuing to look into this.  It is possible that the distinfo file
is not the same but the revision in the makefile was not updated.

[r11-amd64 255] # make -C databases/mysql80-server/ -V DISTNAME
mysql-boost-8.0.11
[r11-amd64 256] # cat databases/mysql80-server/distinfo 
TIMESTAMP = 1524414416
SHA256 (mysql-boost-8.0.11.tar.gz) = f40711a9bd91ab2ccea331484a6d281f806b0fdecf78f4c9e9d8a4c91208f309
SIZE (mysql-boost-8.0.11.tar.gz) = 77647598
[r11-amd64 257] # md5 !$
md5 databases/mysql80-server/distinfo
MD5 (databases/mysql80-server/distinfo) = 7dd64cec58fde18ece7a60baa391583e

[r11-amd64 258] # make -C databases/mysql80-client/ -V DISTNAME
mysql-boost-8.0.11


Again:
[r11-amd64 264] # rm -rf mysql80-client/work/ mysql80-server/work/
[r11-amd64 265] # ( cd mysql80-client/ ; make patch )
===>  License GPLv2 accepted by the user
===>   mysql80-client-8.0.11 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by mysql80-client-8.0.11 for building
===>  Extracting for mysql80-client-8.0.11
=> SHA256 Checksum OK for mysql-boost-8.0.11.tar.gz.
/usr/releng/r11-20180528/ports/databases/mysql80-client/work/mysql-8.0.11/sql/sql_hints.yy.cc
/usr/releng/r11-20180528/ports/databases/mysql80-client/work/mysql-8.0.11/sql/sql_hints.yy.h
===>  Patching for mysql80-client-8.0.11
===>  Applying FreeBSD patches for mysql80-client-8.0.11
1 out of 3 hunks failed--saving rejects to utilities/CMakeLists.txt.rej
=> FreeBSD patch patch-utilities_CMakeLists.txt failed to apply cleanly.
=> Patch(es)  patch-CMakeLists.txt patch-client_CMakeLists.txt patch-cmake_os_DragonFly.cmake patch-cmake_ssl.cmake patch-cmd-line-utils_libedit_chartype.h patch-cmd-line-utils_libedit_vi.c patch-include_CMakeLists.txt patch-include_my__compare.h patch-include_myisam.h patch-libmysql_CMakeLists.txt patch-man_CMakeLists.txt patch-mysys__ssl_my__default.cc patch-mysys__ssl_my__md5.cc patch-plugin_x_client_xconnection__impl.cc patch-scripts_CMakeLists.txt patch-share_CMakeLists.txt patch-sql-common_client.cc patch-sql_auth_sha2__password__common.cc patch-sql_mysqld.cc patch-sql_sys__vars.cc patch-storage_myisam_mi__dynrec.cc patch-support-files_CMakeLists.txt applied cleanly.
*** Error code 1

Stop.
make: stopped in /usr/releng/r11-20180528/ports/databases/mysql80-client
Comment 9 Fernando Apesteguía freebsd_committer 2018-06-15 16:28:45 UTC
(In reply to Curtis Villamizar from comment #8)
Hi Curtis,

I was hopping that you could reproduce the steps in comment #6 so we are sure we are on the same page :-)

I can reproduce your steps:

fernape@hammer:~$ cd FreeBSD-repos/ports/head/databases/mysql80-server/
fernape@hammer:~/FreeBSD-repos/ports/head/databases/mysql80-server$ cat distinfo 
TIMESTAMP = 1524414416
SHA256 (mysql-boost-8.0.11.tar.gz) = f40711a9bd91ab2ccea331484a6d281f806b0fdecf78f4c9e9d8a4c91208f309
SIZE (mysql-boost-8.0.11.tar.gz) = 77647598
fernape@hammer:~/FreeBSD-repos/ports/head/databases/mysql80-server$ md5 !$
md5 distinfo
MD5 (distinfo) = 7dd64cec58fde18ece7a60baa391583e
fernape@hammer:~/FreeBSD-repos/ports/head/databases/mysql80-server$ 

Let's see the failing patch:

fernape@hammer:~/FreeBSD-repos/ports/head/databases/mysql80-client$ md5 files/patch-utilities_CMakeLists.txt 
MD5 (files/patch-utilities_CMakeLists.txt) = 91a69d2b7e1c02d423981d28559c8a08
fernape@hammer:~/FreeBSD-repos/ports/head/databases/mysql80-client$ 

Let's do a very simple experiment:

fernape@hammer:~$ mkdir test
fernape@hammer:~$ cd test/
fernape@hammer:~/test$ wget ftp://ftp.fi.muni.cz/pub/mysql/Downloads/MySQL-8.0/mysql-boost-8.0.11.tar.gz                                                    
--2018-06-15 16:07:11--  ftp://ftp.fi.muni.cz/pub/mysql/Downloads/MySQL-8.0/mysql-boost-8.0.11.tar.gz
           => 'mysql-boost-8.0.11.tar.gz'
Resolving ftp.fi.muni.cz (ftp.fi.muni.cz)... 147.251.48.205, 2001:718:801:230::cd
Connecting to ftp.fi.muni.cz (ftp.fi.muni.cz)|147.251.48.205|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD (1) /pub/mysql/Downloads/MySQL-8.0 ... done.
==> SIZE mysql-boost-8.0.11.tar.gz ... 77647598
==> PASV ... done.    ==> RETR mysql-boost-8.0.11.tar.gz ... done.
Length: 77647598 (74M) (unauthoritative)

mysql-boost-8.0.11.tar.gz               100%[===============================================================================>]  74.05M  6.33MB/s    in 13s     

2018-06-15 16:07:25 (5.63 MB/s) - 'mysql-boost-8.0.11.tar.gz' saved [77647598]

fernape@hammer:~/test$ tar xvzf mysql-boost-8.0.11.tar.gz

(omitted output)...

fernape@hammer:~/test$ cd mysql-8.0.11/
fernape@hammer:~/test/mysql-8.0.11$ wget https://svn.freebsd.org/ports/head/databases/mysql80-client/files/patch-utilities_CMakeLists.txt
--2018-06-15 16:19:05--  https://svn.freebsd.org/ports/head/databases/mysql80-client/files/patch-utilities_CMakeLists.txt
Resolving svn.freebsd.org (svn.freebsd.org)... 213.138.116.72, 2001:41c8:112:8300::e6a:0
Connecting to svn.freebsd.org (svn.freebsd.org)|213.138.116.72|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1211 (1.2K) [text/plain]
Saving to: 'patch-utilities_CMakeLists.txt'

patch-utilities_CMakeLists.txt          100%[===============================================================================>]   1.18K  --.-KB/s    in 0s

2018-06-15 16:19:05 (26.2 MB/s) - 'patch-utilities_CMakeLists.txt' saved [1211/1211]

fernape@hammer:~/test/mysql-8.0.11$ md5 patch-utilities_CMakeLists.txt
MD5 (patch-utilities_CMakeLists.txt) = 91a69d2b7e1c02d423981d28559c8a08
fernape@hammer:~/test/mysql-8.0.11$ less patch-utilities_CMakeLists.txt
fernape@hammer:~/test/mysql-8.0.11$ patch -p0 < patch-utilities_CMakeLists.txt
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- utilities/CMakeLists.txt.orig      2016-03-28 18:06:12 UTC
|+++ utilities/CMakeLists.txt
--------------------------
Patching file utilities/CMakeLists.txt using Plan A...
Hunk #1 succeeded at 59 with fuzz 2 (offset 14 lines).
Hunk #2 succeeded at 88 with fuzz 2 (offset 14 lines).
Hunk #3 succeeded at 174 with fuzz 2 (offset 30 lines).
done
fernape@hammer:~/test/mysql-8.0.11$ 

We have downloaded the same tarball (confirmed by the md5sum) and the same patch from the FreeBSD repo. And it applies the patch.

Note however that it needs to apply an offset. Do you have patch aliased to something like patch -F1 or similar?

Also, are you using ports from an svn checkout, portsnap...?

What I would like to do:

1) Reproduce the steps above to confirm you can "manually" patch the distribution.

2) Reproduce the steps in comment #6

3) Upload:
   * mysql80-server/work/mysql-8.0.11/utilities/CMakeLists.txt
   * mysql80-client/files/patch-utilities_CMakeLists.txt
   * If the patching fails, upload .rej and .orig too.
Comment 10 Curtis Villamizar 2018-06-15 21:29:31 UTC
I get a different result on the test.  There are no aliases and patch is 
/usr/bin/patch.  I'm using "FreeBSD r11-amd64.v6ds.occnc.com 11.2-BETA3 FreeBSD 11.2-BETA3 #0 r334309: Tue May 29 11:48:53 EDT 2018     root@amd64-boot1.v6only.occnc.com:/usr/releng/r11-20180528/obj.amd64.occnc11.amd64/usr/releng/r11-20180528/src/sys/occnc11.amd64  amd64" (output of uname -a).  Are you using R11 and if so is it before or after the version I'm using.  If newer, then I'll try and OS upgrade (this is a bhyve VM so easy enough to burn it and start over - just takes time).  This seems to be a difference in the patch fuzzing.  (btw- might be better to use fetch rather than wget to reduce non-useful output but I duplicated steps exactly except omitting the -v from tar args).

[r11-amd64 277] # cd test
[r11-amd64 278] # ls
[r11-amd64 279] # 
[r11-amd64 279] # wget ftp://ftp.fi.muni.cz/pub/mysql/Downloads/MySQL-8.0/mysql-boost-8.0.11.tar.gz 
--2018-06-15 16:47:42--  ftp://ftp.fi.muni.cz/pub/mysql/Downloads/MySQL-8.0/mysql-boost-8.0.11.tar.gz
           => 'mysql-boost-8.0.11.tar.gz'
Resolving ftp.fi.muni.cz (ftp.fi.muni.cz)... 2001:718:801:230::cd, 147.251.48.205
Connecting to ftp.fi.muni.cz (ftp.fi.muni.cz)|2001:718:801:230::cd|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD (1) /pub/mysql/Downloads/MySQL-8.0 ... done.
==> SIZE mysql-boost-8.0.11.tar.gz ... 77647598
==> EPSV ... done.    ==> RETR mysql-boost-8.0.11.tar.gz ... done.
Length: 77647598 (74M) (unauthoritative)

mysql-boost-8.0.11. 100%[===================>]  74.05M  2.46MB/s    in 47s     

2018-06-15 16:48:32 (1.58 MB/s) - 'mysql-boost-8.0.11.tar.gz' saved [77647598]

[r11-amd64 280] # tar xzf mysql-boost-8.0.11.tar.gz
[r11-amd64 281] # cd mysql-8.0.11/
[r11-amd64 282] # wget https://svn.freebsd.org/ports/head/databases/mysql80-client/files/patch-utilities_CMakeLists.txt
--2018-06-15 16:49:48--  https://svn.freebsd.org/ports/head/databases/mysql80-client/files/patch-utilities_CMakeLists.txt
Resolving svn.freebsd.org (svn.freebsd.org)... 2610:1c1:1:606c::e6a:0, 96.47.72.69
Connecting to svn.freebsd.org (svn.freebsd.org)|2610:1c1:1:606c::e6a:0|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1211 (1.2K) [text/plain]
Saving to: 'patch-utilities_CMakeLists.txt'

patch-utilities_CMa 100%[===================>]   1.18K  --.-KB/s    in 0s      

2018-06-15 16:49:49 (20.4 MB/s) - 'patch-utilities_CMakeLists.txt' saved [1211/1211]

[r11-amd64 283] # md5 patch-utilities_CMakeLists.txt
MD5 (patch-utilities_CMakeLists.txt) = 91a69d2b7e1c02d423981d28559c8a08
[r11-amd64 284] # cat pa
packaging/                      patch-utilities_CMakeLists.txt 
[r11-amd64 284] # cat patch-utilities_CMakeLists.txt 
--- utilities/CMakeLists.txt.orig       2016-03-28 18:06:12 UTC
+++ utilities/CMakeLists.txt
@@ -45,6 +45,7 @@ ENDIF()
 
 ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/include/mysqld_error.h
                    ${PROJECT_BINARY_DIR}/${INSTALL_MYSQLSHAREDIR}/english/errmsg.sys
+                   COMMAND mkdir -p ${PROJECT_BINARY_DIR}/share/
                    COMMAND comp_err
                     --charset=${PROJECT_SOURCE_DIR}/share/charsets
                     --out-dir=${PROJECT_BINARY_DIR}/${INSTALL_MYSQLSHAREDIR}/
@@ -73,4 +74,5 @@ IF (WIN32 AND WITH_SSL_PATH AND HAVE_CRY
 ENDIF()
 
+IF(FALSE)
 MYSQL_ADD_EXECUTABLE(my_print_defaults my_print_defaults.c)
 TARGET_LINK_LIBRARIES(my_print_defaults  mysys mysys_ssl)
@@ -142,11 +144,14 @@ IF(WITH_INNOBASE_STORAGE_ENGINE)
   TARGET_LINK_LIBRARIES(innochecksum mysys mysys_ssl ${LZ4_LIBRARY})
   ADD_DEPENDENCIES(innochecksum GenError)
 ENDIF()
+ENDIF()
 
+IF(FALSE)
 IF(UNIX)
   MYSQL_ADD_EXECUTABLE(resolve_stack_dump resolve_stack_dump.cc)
   TARGET_LINK_LIBRARIES(resolve_stack_dump mysys mysys_ssl)
 ENDIF()
+ENDIF()
 
 # In published release builds on Solaris, we need to bundle gcc source.
 # PB2 will take care of putting it in extra/ when needed
[r11-amd64 285] # patch -p0 < patch-utilities_CMakeLists.txt
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- utilities/CMakeLists.txt.orig      2016-03-28 18:06:12 UTC
|+++ utilities/CMakeLists.txt
--------------------------
Patching file utilities/CMakeLists.txt using Plan A...
Hunk #1 succeeded at 59 with fuzz 2 (offset 14 lines).
Hunk #2 failed at 88.
Hunk #3 succeeded at 174 with fuzz 2 (offset 30 lines).
1 out of 3 hunks failed--saving rejects to utilities/CMakeLists.txt.rej
done
Comment 11 Fernando Apesteguía freebsd_committer 2018-06-16 16:41:07 UTC
(In reply to Curtis Villamizar from comment #10)

Please, upload utilities/CMakeLists.txt.rej

Also, after uncompressing the distfile, what's the md5 sum of utilities/CMakeLists.txt?

I'm testing in 11.1 amd64.
Comment 12 Curtis Villamizar 2018-06-17 00:28:57 UTC
[r11-amd64 295] # md5 patch-utilities_CMakeLists.txt
MD5 (patch-utilities_CMakeLists.txt) = 91a69d2b7e1c02d423981d28559c8a08
[r11-amd64 296] # find * -name \*.rej
utilities/CMakeLists.txt.rej
[r11-amd64 297] # cat utilities/CMakeLists.txt.rej
@@ -87,4 +88,5 @@
 ENDIF()
 
+IF(FALSE)
 MYSQL_ADD_EXECUTABLE(my_print_defaults my_print_defaults.c)
 TARGET_LINK_LIBRARIES(my_print_defaults  mysys mysys_ssl)
[r11-amd64 298] # grep my_print_defaults utilities/CMakeLists.txt.orig 
MYSQL_ADD_EXECUTABLE(my_print_defaults my_print_defaults.cc)
TARGET_LINK_LIBRARIES(my_print_defaults  mysys mysys_ssl)
SET_TARGET_PROPERTIES(my_print_defaults PROPERTIES LINKER_LANGUAGE CXX)

btw- Would you please do the same grep.

Also, the patch I provided is a patch to the databases/mysql80-client/files/patch-utilities_CMakeLists.txt patch file.

Its interesting that my svn diff didn't patch.  Perhaps I did something dumb like pasted in the diff instead of upload.  It is clearly a white space issue.  The following confirms that it is just whitespace (I manually added the second c making it .cc) so I'll upload the diff again.  Would you please try that and if the patched patch-utilities_CMakeLists.txt works for both of us, consider using it.

[r11-amd64 312] # diff -u patch-utilities_CMakeLists.txt.orig patch-utilities_CMakeLists.txt
--- patch-utilities_CMakeLists.txt.orig 2018-06-16 19:49:00.323453000 -0400
+++ patch-utilities_CMakeLists.txt      2018-06-16 19:52:44.838394000 -0400
@@ -12,7 +12,7 @@
  ENDIF()
  
 +IF(FALSE)
- MYSQL_ADD_EXECUTABLE(my_print_defaults my_print_defaults.c)
+ MYSQL_ADD_EXECUTABLE(my_print_defaults my_print_defaults.cc)
  TARGET_LINK_LIBRARIES(my_print_defaults  mysys mysys_ssl)
 @@ -142,11 +144,14 @@ IF(WITH_INNOBASE_STORAGE_ENGINE)
    TARGET_LINK_LIBRARIES(innochecksum mysys mysys_ssl ${LZ4_LIBRARY})
[r11-amd64 313] # diff -u patch-utilities_CMakeLists.txt.orig patch-utilities_CMakeLists.txt | diff -u - attachment.cgi\?id=194057 
--- -   2018-06-16 19:53:52.292180418 -0400
+++ attachment.cgi?id=194057    2018-06-16 19:49:24.639482000 -0400
@@ -1,11 +1,13 @@
---- patch-utilities_CMakeLists.txt.orig        2018-06-16 19:49:00.323453000 -0400
-+++ patch-utilities_CMakeLists.txt     2018-06-16 19:52:44.838394000 -0400
-@@ -12,7 +12,7 @@
-  ENDIF()
-  
- +IF(FALSE)
-- MYSQL_ADD_EXECUTABLE(my_print_defaults my_print_defaults.c)
-+ MYSQL_ADD_EXECUTABLE(my_print_defaults my_print_defaults.cc)
-  TARGET_LINK_LIBRARIES(my_print_defaults  mysys mysys_ssl)
- @@ -142,11 +144,14 @@ IF(WITH_INNOBASE_STORAGE_ENGINE)
-    TARGET_LINK_LIBRARIES(innochecksum mysys mysys_ssl ${LZ4_LIBRARY})
+Index: databases/mysql80-client/files/patch-utilities_CMakeLists.txt
+===================================================================
+--- databases/mysql80-client/files/patch-utilities_CMakeLists.txt       (revision 471884)
++++ databases/mysql80-client/files/patch-utilities_CMakeLists.txt       (working copy)
+@@ -12,7 +12,7 @@
+  ENDIF()
+  
+ +IF(FALSE)
+- MYSQL_ADD_EXECUTABLE(my_print_defaults my_print_defaults.c)
++ MYSQL_ADD_EXECUTABLE(my_print_defaults my_print_defaults.cc)
+  TARGET_LINK_LIBRARIES(my_print_defaults  mysys mysys_ssl)
+ @@ -142,11 +144,14 @@ IF(WITH_INNOBASE_STORAGE_ENGINE)
+    TARGET_LINK_LIBRARIES(innochecksum mysys mysys_ssl ${LZ4_LIBRARY})
[r11-amd64 314] # diff -u patch-utilities_CMakeLists.txt.orig patch-utilities_CMakeLists.txt | diff -uw - attachment.cgi\?id=194057
--- -   2018-06-16 19:55:23.652685463 -0400
+++ attachment.cgi?id=194057    2018-06-16 19:49:24.639482000 -0400
@@ -1,5 +1,7 @@
---- patch-utilities_CMakeLists.txt.orig        2018-06-16 19:49:00.323453000 -0400
-+++ patch-utilities_CMakeLists.txt     2018-06-16 19:52:44.838394000 -0400
+Index: databases/mysql80-client/files/patch-utilities_CMakeLists.txt
+===================================================================
+--- databases/mysql80-client/files/patch-utilities_CMakeLists.txt       (revision 471884)
++++ databases/mysql80-client/files/patch-utilities_CMakeLists.txt       (working copy)
 @@ -12,7 +12,7 @@
   ENDIF()
Comment 13 Curtis Villamizar 2018-06-17 00:32:20 UTC
Created attachment 194316 [details]
replacement patch for databases/mysql80-client/files/patch-utilities_CMakeLists.txt

The prior patch had whitespace issues.  I might have foolishly pasted it in rather than uploaded.
Comment 14 Mahdi Mokhtari freebsd_committer freebsd_triage 2018-06-17 09:51:37 UTC
Hi,
First I appologise for my late response (Had busy week of AFK; lots of paperworks).
And thank you fernape@ for taking care of this (and some other PR) ;D

Dear Curtis, Can you also send a svn st "after svn up" your repo?
I could not find it in your logs (I wanted to make sure your local repo doesn't have any conflicting changes locally after/before updating...)
Comment 15 Fernando Apesteguía freebsd_committer 2018-06-17 18:28:50 UTC
(In reply to Mahdi Mokhtari from comment #14)

> First I appologise for my late response (Had busy week of AFK; lots of paperworks). And thank you fernape@ for taking care of this (and some other PR) ;D

No problem, Mahdi! :)

I think I found the problem. There was a change in patch(1) in r326084. I just compiled patch(1) from the previous revision in r326083 and it applied files/patch-utilities_CMakeLists.txtcleanly. See also the revision https://reviews.freebsd.org/D12631

I can also confirm that the patch failing occurs in 12-CURRENT (r332309) too. Sorry, I should have checked that earlier and we would have saved some time :S That's why Curtis sees this behavior: he has the new patch(1) binary in 11.2 RC BETA 3.

Clearly, the patch is outdated (.c vs .cc in the context line just below the line that needs to be added), but it is a bit annoying and confusing that the same patch works in some releases and not in others.

I was just bitten by this very same thing today while updating audio/musicpc.

Hope this helps.
Comment 16 Curtis Villamizar 2018-06-18 15:57:31 UTC
(In reply to Mahdi Mokhtari from comment #14)

Do you need more information or did comment #15 cover it.  This is a solved problem with a one character fix to a patch file.
Comment 17 Jakob Breivik Grimstveit 2018-07-05 11:53:50 UTC
This seems to fail, still. 

$ uname -a
FreeBSD core2.grimstveit.no 11.2-RELEASE FreeBSD 11.2-RELEASE #3 r335750: Thu Jun 28 13:35:17 CEST 2018     root@core2.grimstveit.no:/usr/obj/usr/src/sys/CORE2  amd64

[...]
===>   mysql80-server-8.0.11_1 depends on shared library: libmysqlclient.so.21 - not found
===>  License GPLv2 accepted by the user
===>   mysql80-client-8.0.11_1 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by mysql80-client-8.0.11_1 for building
===>  Extracting for mysql80-client-8.0.11_1
=> SHA256 Checksum OK for mysql-boost-8.0.11.tar.gz.
/usr/ports/databases/mysql80-client/work/mysql-8.0.11/sql/sql_hints.yy.cc
/usr/ports/databases/mysql80-client/work/mysql-8.0.11/sql/sql_hints.yy.h
===>  Patching for mysql80-client-8.0.11_1
===>  Applying FreeBSD patches for mysql80-client-8.0.11_1
1 out of 3 hunks failed--saving rejects to utilities/CMakeLists.txt.rej
=> FreeBSD patch patch-utilities_CMakeLists.txt failed to apply cleanly.
=> Patch(es)  patch-CMakeLists.txt patch-client_CMakeLists.txt patch-cmake_os_DragonFly.cmake patch-cmake_ssl.cmake patch-cmd-line-utils_libedit_chartype.h patch-cmd-line-utils_libedit_vi.c patch-include_CMakeLists.txt patch-include_my__compare.h patch-include_myisam.h patch-libmysql_CMakeLists.txt patch-man_CMakeLists.txt patch-mysys__ssl_my__default.cc patch-mysys__ssl_my__md5.cc patch-plugin_x_client_xconnection__impl.cc patch-scripts_CMakeLists.txt patch-share_CMakeLists.txt patch-sql-common_client.cc patch-sql_auth_sha2__password__common.cc patch-sql_mysqld.cc patch-sql_sys__vars.cc patch-storage_myisam_mi__dynrec.cc patch-support-files_CMakeLists.txt applied cleanly.
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/databases/mysql80-client
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/databases/mysql80-server
*** Error code 1

Stop.
make: stopped in /usr/ports/databases/mysql80-server
Comment 18 Fernando Apesteguía freebsd_committer 2018-07-06 06:15:23 UTC
(In reply to Jakob Breivik Grimstveit from comment #17)

I'm afraid the patch hasn't been applied to the ports tree yet
Comment 19 MattS 2018-07-31 03:12:19 UTC
(In reply to Curtis Villamizar from comment #1)

I was experiencing this same issue on a clean install of 11.2 and this fixed it. Thanks.
Comment 20 commit-hook freebsd_committer 2018-07-31 19:08:20 UTC
A commit references this bug:

Author: fernape
Date: Tue Jul 31 19:08:00 UTC 2018
New revision: 476016
URL: https://svnweb.freebsd.org/changeset/ports/476016

Log:
  databases/mysql80-client: Unbreak patching

  Broken after patch(1) changes in r326084

  PR:	228788
  Submitted by:	curtis@ipv6.occnc.com
  Approved by:	tcberner (mentor) mmokhi (maintainer)
  Differential Revision:	https://reviews.freebsd.org/D16532

Changes:
  head/databases/mysql80-client/files/patch-utilities_CMakeLists.txt
Comment 21 Fernando Apesteguía freebsd_committer 2018-07-31 19:09:23 UTC
Committed,

Thanks to everyone involved and sorry for the delay!
Comment 22 commit-hook freebsd_committer 2018-08-14 14:44:55 UTC
A commit references this bug:

Author: mmokhi
Date: Tue Aug 14 14:44:32 UTC 2018
New revision: 477159
URL: https://svnweb.freebsd.org/changeset/ports/477159

Log:
  MFH: r476016 r476944 r477036 r477063 r477105

  databases/mysql80-client: Unbreak patching

  Broken after patch(1) changes in r326084

  PR:	228788
  Submitted by:	curtis@ipv6.occnc.com
  Approved by:	tcberner (mentor) mmokhi (maintainer)
  Differential Revision:	https://reviews.freebsd.org/D16532

  databases/mysql80-{client, server}: Update ports to 8.0.12
  This update includes Oracle Critical Patch Advisory published on July 2018
  More info:
  http://www.oracle.com/technetwork/security-advisory/cpujul2018-4258247.html#AppendixMSQL
  Also:
  Delete upstreamed hunks of patches.
  Change local patches regarding upstream changes.

  PR:		229861
  Reported by:	Markus Kohlmeyer <rootservice@gmail.com>
  Sponsored by:	The FreeBSD Foundation

  databases/mysql80-server: Fix build on default Clang of 10.4-base
  Add sse4.2 flag to CXXFLAGS on 10.4 case.
  The build-script needs it when using intrin lib on crc32

  Sponsored by:	The FreeBSD Foundation

  databases/mysql80-server: Use c++14-lang instead of `msse-4.2 in CXXFLAG`
  As suggested via replies to r477036 using `-msse-4.2` may break build on other
  platforms.

  Reported by:	linimon danfe jbeich
  Sponsored by:	The FreeBSD Foundation

  databases/mysql80-server: Delete no-longer-needed patch for sse4.2

  Reported by:	jbeich
  Sponsored by:	The FreeBSD Foundation

  Approved by:	ports-secteam (feld)

Changes:
_U  branches/2018Q3/
  branches/2018Q3/databases/mysql80-client/Makefile
  branches/2018Q3/databases/mysql80-client/files/patch-CMakeLists.txt
  branches/2018Q3/databases/mysql80-client/files/patch-scripts_CMakeLists.txt
  branches/2018Q3/databases/mysql80-client/files/patch-sql-common_client.cc
  branches/2018Q3/databases/mysql80-client/files/patch-utilities_CMakeLists.txt
  branches/2018Q3/databases/mysql80-server/Makefile
  branches/2018Q3/databases/mysql80-server/distinfo
  branches/2018Q3/databases/mysql80-server/files/patch-client_CMakeLists.txt
  branches/2018Q3/databases/mysql80-server/files/patch-plugin_x_CMakeLists.txt
  branches/2018Q3/databases/mysql80-server/files/patch-plugin_x_src_xpl__regex.cc
  branches/2018Q3/databases/mysql80-server/files/patch-scripts_CMakeLists.txt
  branches/2018Q3/databases/mysql80-server/files/patch-sql-common_client.cc
  branches/2018Q3/databases/mysql80-server/pkg-plist