diff options
author | ozgursarier | 2017-03-25 22:26:55 +0300 |
---|---|---|
committer | ozgursarier | 2017-03-25 22:26:55 +0300 |
commit | 9d07c02a13583bc626bbc2562ca6517f313602e9 (patch) | |
tree | e8786122e336f4a296f386beb18a85f9113cebaa | |
parent | 08ca9110682901547587700f8bb746cb330be631 (diff) | |
download | aur-9d07c02a13583bc626bbc2562ca6517f313602e9.tar.gz |
Build fix for non-popcnt CPUs
-rw-r--r-- | .SRCINFO | 16 | ||||
-rw-r--r-- | COPYRIGHT | 45 | ||||
-rw-r--r-- | CRAFTY.FAQ | 244 | ||||
-rw-r--r-- | Makefile.patch | 102 | ||||
-rw-r--r-- | PKGBUILD | 66 | ||||
-rw-r--r-- | crafty-data.tar.bz2 | bin | 0 -> 36432 bytes | |||
-rw-r--r-- | paths.patch | 35 | ||||
-rw-r--r-- | security-203541.patch | 44 |
8 files changed, 224 insertions, 328 deletions
@@ -1,9 +1,9 @@ # Generated by mksrcinfo v8 -# Mon Jan 23 12:24:10 UTC 2017 +# Sat Mar 25 19:25:48 UTC 2017 pkgbase = crafty pkgdesc = A free, open-source computer chess program developed by Dr. Robert M. (Bob) Hyatt pkgver = 25.2 - pkgrel = 1 + pkgrel = 2 url = http://www.craftychess.com/ arch = i686 arch = x86_64 @@ -12,14 +12,18 @@ pkgbase = crafty source = http://www.craftychess.com/downloads/book/book.bin source = http://www.craftychess.com/downloads/book/start.pgn.gz source = http://www.craftychess.com/downloads/book/startc.pgn.gz - source = COPYRIGHT - source = CRAFTY.FAQ + source = crafty-data.tar.bz2 + source = security-203541.patch + source = paths.patch + source = Makefile.patch md5sums = d8ad87d9b0fc39a437595203d7b302fc md5sums = f8f93189c64324b1959a489da822438e md5sums = 880279c223dc34164837a351faafe2f0 md5sums = 7a53d5f09d2baa5e7f0df4ee81961cfb - md5sums = 438cec9f32fb79f58822f97cf64e7afb - md5sums = f744727e291b6dec7e7c69bb3586b6dd + md5sums = 18cb719601b36825113274335ee0e3f1 + md5sums = 02c7ab07c0ff8f77738a055772f4406d + md5sums = 9db34746e90ceb116d162a5fa727f7e0 + md5sums = 178436e4fdacdecd58d0bbdeb9aba924 pkgname = crafty diff --git a/COPYRIGHT b/COPYRIGHT deleted file mode 100644 index 77b5c8434e35..000000000000 --- a/COPYRIGHT +++ /dev/null @@ -1,45 +0,0 @@ -Crafty, copyright 1996-2010 by Robert M. Hyatt, Ph.D., Associate Professor -of Computer and Information Sciences, University of Alabama at Birmingham. - -Crafty is a team project consisting of the following members. These are -the people involved in the continuing development of this program, there -are no particular members responsible for any specific aspect of Crafty. - - Michael Byrne, Pen Argyle, PA. - Robert Hyatt, University of Alabama at Birmingham. - Tracy Riegle, Hershey, PA. - Peter Skinner, Edmonton, AB Canada. - Ted Langreck . - -All rights reserved. No part of this program may be reproduced in any -form or by any means, for other than your personal use, without the -express written permission of the authors. This program may not be used -in whole, nor in part, to enter any computer chess competition without -written permission from the authors. Such permission will include the -requirement that the program be entered under the name "Crafty" so that -the program's ancestry will be known. - -Copies of the source must contain the original copyright notice intact. - -Any changes made to this software must also be made public to comply with -the original intent of this software distribution project. These -restrictions apply whether the distribution is being done for free or as -part or all of a commercial product. The authors retain sole ownership -and copyright on this program except for 'personal use' explained below. - -Personal use includes any use you make of the program yourself, either by -playing games with it yourself, or allowing others to play it on your -machine, and requires that if others use the program, it must be clearly -identified as "Crafty" to anyone playing it (on a chess server as one -example). Personal use does not allow anyone to enter this into a chess -tournament where other program authors are invited to participate. IE you -can do your own local tournament, with Crafty + other programs, since this -is for your personal enjoyment. But you may not enter Crafty into an -event where it will be in competition with other programs/programmers -without permission as stated previously. - -Crafty is the "son" (direct descendent) of Cray Blitz. it is designed -totally around the bit-board data structure for reasons of speed of ex- -ecution, ease of adding new knowledge, and a *significantly* cleaner -overall design. it is written totally in ANSI C with some few UNIX system -calls required for I/O, etc. diff --git a/CRAFTY.FAQ b/CRAFTY.FAQ deleted file mode 100644 index e362b036ac43..000000000000 --- a/CRAFTY.FAQ +++ /dev/null @@ -1,244 +0,0 @@ -Frequently asked questions (FAQ) on Crafty. -Last modified on 1996.06.17 -Send corrections/additions/comments to: -Anil Mungal (amungal@vnet.ibm.com) - ------ -[1] What is Crafty? -[1.1] What platforms can Crafty run on? -[1.2] What is Crafty's rating/strength? -[1.3] Where can I get Crafty? -[1.4] How do I build Crafty? -[1.5] How do I build Crafty's Book? -[1.6] How can I maximize Crafty's performance? -[1.7] What are "tablebases" and how do I use 'em? -[1.8] How can I get a graphical interface with Crafty? -[1.9] How can I use both Crafty and XBoard to analyze positions/games? ------ -[1] What is Crafty? - -Crafty is a chess program written by Bob Hyatt (hyatt@cis.uab.edu). -It is modeled after Cray Blitz (also written by Bob). - -Crafty has the following features: -- written in C -- can be compiled with the GNU C compiler on various platforms -- has a customizable opening book -- supports tablebases (Steven Edward's endgame database) -- text interface - -Crafty is a work in progress, and is frequently updated/enhanced by Bob. ------ -[1.1] What platforms can Crafty run on? - -The decision to write Crafty so that it compiles with the GNU C compiler -allows it to run on many platforms without the hassle of porting. -(Thanks Bob) - -Currently Crafty runs on: - -- DEC alpha running OSF/1-Digital Unix -- any Cray-1 compatible architecture including XMP, YMP, C90, etc. -- HP workstation running HP_UX operating system (unix) -- PC running DOS, Windows, or OS/2 Warp, using DJGPP port of gcc to compile -- RS/6000 running AIX (unix) -- Sun SparcStation running Solaris (SYSV/R4) Unix -- Sun SparcStation running SunOX (BSD) Unix -- Any architecture running the Linux operating system -- Microsoft Win95/WinNT, when compiled with Microsoft Visual C++ -- Macintosh and other MacOS-compatible computers - -Storage requirements range from 1Mb (small book and no tablebase) to 60Mb -(largest book and no tablebases) to 300Mb (largest book and all tablebases). ------ -[1.2] What is Crafty's rating/strength? - -Crafty's strength is directly dependant upon processor speed, hash table size, -size and content of it's opening book, and it's use of an endgame database. -Versions of Crafty running on ICC and FICS have ratings around 2500-2700. -This does not necessarily mean that Crafty will perform at this level -under tournament conditions. - -Crafty's computational power in nodes/sec has been measured as follows: - - Platform Nodes/sec - -------- --------- - DEC alpha running OSF/1-Digital Unix 75,000 - Cray-1 XMP, YMP, C90, etc. ?????? - HP workstation running HP_UX operating system 35,000 - 80X86 architecture running LINUX (unix) 30,000 (P5/133) - Pentium 100 PC 24,000 - Pentium Pro 200 PC 75,000 - RS/6000 running AIX (unix) ?????? - Sun SparcStation running Solaris (SYSV/R4) Unix 30,000 (Sparc-20) - -According to the Louget Chess test, Crafty has been given the following ratings: - - Platform Hash table Louget rating (comparable to FIDE rating) - ======== ========== ============= -Crafty v9.21 PP200 56 MB 2395 -Crafty v9.21 PP150 56 MB 2365 -Crafty v9.21 P133 14 MB 2305 -Crafty v9.21 P90 7 MB 2235 - -Where the platforms were: -PP200 = Pentium Pro 200 Mhz, 16+256KB internal caches, Aurora Intel motherboard -PP150 = Pentium Pro 150 Mhz, 16+256KB internal caches, Asustek motherboard -P133 = Pentium 133 Mhz, 256 KB pipeline burst synchronous L2 cache -P90 = Pentium 90 Mhz, 256 KB asynchronous cache (Intel Zappa, Triton Chipset) - -For more info on the Louget Chess test, you can contact: -Frederic Louguet (louguet@worldnet.net) ----- -[1.3] Where can I get Crafty? - -You can get Crafty by anonymous FTP at: ftp://news.cis.uab.edu/pub/hyatt - -Here is a description of the files that you will probably see. - -read.me : Read me file that Bob updates -crafty.exe : PC DOS executable. (needs DPMI) -craftyt.exe : PC DOS executable with tablebases support. (needs DPMI) -crafty.faq : this file -crafty.linux : Linux executable -crafty.sun : Sun Sparc-20 executable -crafty.zip : Crafty source code -crafty.tar.Z : Crafty source code -crafty.tar.gz : Crafty source code -cwsdpmi.exe : DPMI provider -large1.zip : Large PGN file used to create an opening book (1/4) -large2.zip : Large PGN file used to create an opening book (2/4) -large3.zip : Large PGN file used to create an opening book (3/4) -large4.zip : Large PGN file used to create an opening book (4/4) -medium.zip : Medium PGN file used to create an opening book -small.zip : Small PGN file used to create an opening book -start.zip : Tiny PGN file used to create an opening book -probs.Z : A test suite of chess problems -wcrafty.exe : Windows executable. -wcraftyt.exe : Windows executable with tablebases support. - -The Macintosh port of Crafty is available from <ftp://ftp.limunltd.com/crafty/>. -The Mac versions are supported from <http://www.limunltd.com/crafty/>. - ------ -[1.4] How do I build Crafty? - -If you wish to build Crafty for yourself, you need a copy of the source -and the GNU C compiler (or the djgpp compiler for DOS) to compile. - - a) Unzip/uncompress the source code. - - b) Follow the instructions in the Makefile. You will probably have to: - - comment/uncomment sections based on your hardware platform. - - edit the directory paths. - - add whatever optimization flags that you want. - - c) type make - ------ -[1.5] How do I build Crafty's Book? - -You need an executable version of Crafty and a PGN file to build it's book. -Choose between large (unzip large1.zip, large2.zip, large3.zip, large4.zip -and append them into one file), medium (unzip medium.zip), or small.zip -(unzip small.zip). -Large produces a 90Mb-60Mb opening database with 100K GM games; medium produces -a 30Mb database, and small will produce a 1Mb database. Note that you will -need at least double this space to create the files, since temporary files -are written to disk, and then later deleted. Use the following commands to -build the book: - - crafty - book create <filename> 60 - quit - -<filename> should be replaced by the PGN filename that is created when you unzip -the book file of your choice. - -Start.zip contains a small file that is used to create books.bin. -books.bin is created as follows: - - crafty - books create start.pgn 60 - quit - -This file contains suggested openings that fit Crafty's "open" style of -play better. You can edit/modify this at will, and it takes a fraction of -a second to re-build after modification, so the big book file can be left -alone. - -Note that the "60" is arbitrary, and is used to cut book lines off at roughly -60 plies. You "can" say 500, so that the entire games will be stored, -but you need even more disk space. You can also reduce this number to 30 -(15 moves for each side) to conserve disk space as needed, since the book -will contain far fewer positions. ------ -[1.6] How can I maximize Crafty's performance? - - a) Compile with different combinations of the following options: - -DCOMPACT_ATTACKS, and -DUSE_SPLIT_SHIFTS. Then check the performance - of Crafty. The best test is to simply let it search to a fixed depth - (say sd=8 for example) from the opening position and pick the compiler - /optimizer options that minimize this time. Pick SD=n so that the search - takes at least 2 minutes. - - b) Increase the size of hash and hashp based on the following - observations: - - hash is more important that hashp. the only guidance is that - you don't want to make hash so large things slow down due to - excessive paging or swapping. - - there's a compile option -DFAST. if you use this, crafty won't - report any hashing statistics, making it harder to decide when - to make things bigger. ------ -[1.7] What are tablebases and how do I use 'em? - -tablebases are endgame databases distributed freely by Steven Edwards -(sje@mv.mv.com). If you are downloading an executable, for dos you'll -want craftyt.exe, and for Win95/WinNT, you'll want wcraftyt.exe. If -you compile your own, -DTABLEBASES will do the trick. - -Once you have an executable that expects tablebases, you typically -put them in a sub-directory TB that should be in the directory where -you normally run crafty. You can change this by editing the Makefile -and changing TBDIR to point to where you want 'em. - -Next, you need the tablebase files. These are available from ftp.onenet.net -and other ftp sites. The files are named like this: KBNK.tbb and KBNK.tbw -for the KBN vs K tablebases. On some ftp machines the "." is replaced by a -"_". after downloading them, rename them to replace the _ by . or crafty -will not recognize them. These files are also available from the primary -Crafty site ftp.cis.uab/edu/pub/hyatt/TB. - -The complete set takes about 260Mb, for all 4-man endings. We are working -on new ones for frequently encountered endings like KRP vs KR. These will -be made available as they are completed. There are 10 5-piece files now -available, KRPKR, KRNKR, KRBKR, KRRKR and KQRKR, where each has a .tbb -and .tbw pair. These files require about 500mb zipped, but will expand -to about 2.3 gigabytes when unzipped. So be prepared for a large disk -space requirement. - -Note that these databases are "mate in n" type databases, so you'll see -some interesting mate announcements from Crafty, with Mate in 30 a very -common occurrence. :) ------ -[1.8] How can I get a graphical interface with Crafty? - -On Unix systems, you can use XBoard with Crafty. On Windows systems, you -can use WinBoard. For more information on XBoard and WinBoard, check out: -http://www.research.digital.com/SRC/personal/Tim_Mann/chess.html ------ -[1.9] How can I use both Crafty and XBoard to analyze positions/games? - -It is now possible to use XBoard and Crafty together to perform -interactive analysis of positions and stored (PGN, etc.) games. - -To do this, you need a recent version of Crafty (12.3 or up) and -xboard/winboard version 3.6.1 or later. - -For instructions, see the winboard/xboard faq, which explains how to use -this powerful and interesting facility. ------ -** End of Crafty FAQ ** - - diff --git a/Makefile.patch b/Makefile.patch new file mode 100644 index 000000000000..321b07150353 --- /dev/null +++ b/Makefile.patch @@ -0,0 +1,102 @@ +--- Makefile.orig 2016-10-03 23:11:34.000000000 +0300 ++++ Makefile 2017-03-25 19:59:41.178474095 +0300 +@@ -76,26 +76,24 @@ + quick: + $(MAKE) target=UNIX \ + CC=clang \ +- opt='-DSYZYGY -DTEST -DTRACE -DCPUS=4' \ +- CFLAGS='-mpopcnt -Wall -Wno-array-bounds -pipe -O3' \ ++ opt='$(opt) -DSYZYGY -DTEST -DTRACE' \ ++ CFLAGS='$(CFLAGS) -Wall -Wno-array-bounds -pipe -O3' \ + LDFLAGS='$(LDFLAGS) -lstdc++' \ + crafty-make + + unix-gcc: + $(MAKE) -j target=UNIX \ + CC=gcc \ +- opt='-DSYZYGY -DTEST -DCPUS=4' \ +- CFLAGS='-Wall -Wno-array-bounds -pipe -O3 -fprofile-use \ +- -mpopcnt -fprofile-correction -pthread' \ ++ opt='$(opt) -DSYZYGY -DTEST' \ ++ CFLAGS='$(CFLAGS) -Wall -Wno-array-bounds -pipe -O3 -fprofile-use -fprofile-correction -pthread' \ + LDFLAGS='$(LDFLAGS) -fprofile-use -pthread -lstdc++' \ + crafty-make + + unix-gcc-profile: + $(MAKE) -j target=UNIX \ + CC=gcc \ +- opt='-DSYZYGY -DTEST -DCPUS=4' \ +- CFLAGS='-Wall -Wno-array-bounds -pipe -O3 -fprofile-arcs \ +- -mpopcnt -pthread' \ ++ opt='$(opt) -DSYZYGY -DTEST' \ ++ CFLAGS='$(CFLAGS) -Wall -Wno-array-bounds -pipe -O3 -fprofile-arcs -pthread' \ + LDFLAGS='$(LDFLAGS) -fprofile-arcs -pthread -lstdc++ ' \ + crafty-make + +@@ -103,36 +101,32 @@ + @/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/llvm-profdata merge -output=crafty.profdata *.profraw + $(MAKE) -j target=UNIX \ + CC=clang \ +- opt='-DSYZYGY -DTEST -DCPUS=4' \ +- CFLAGS='-Wall -Wno-array-bounds -pipe -O3 \ +- -mpopcnt -fprofile-instr-use=crafty.profdata' \ ++ opt='$(opt) -DSYZYGY -DTEST' \ ++ CFLAGS='$(CFLAGS) -Wall -Wno-array-bounds -pipe -O3 -fprofile-instr-use=crafty.profdata' \ + LDFLAGS='$(LDFLAGS) -fprofile-use -lstdc++' \ + crafty-make + + unix-clang-profile: + $(MAKE) -j target=UNIX \ + CC=clang \ +- opt='-DSYZYGY -DTEST -DCPUS=4' \ +- CFLAGS='-Wall -Wno-array-bounds -pipe -O3 \ +- -mpopcnt -fprofile-instr-generate' \ ++ opt='$(opt) -DSYZYGY -DTEST' \ ++ CFLAGS='$(CFLAGS) -Wall -Wno-array-bounds -pipe -O3 -fprofile-instr-generate' \ + LDFLAGS='$(LDFLAGS) -fprofile-instr-generate -lstdc++ ' \ + crafty-make + + unix-icc: + $(MAKE) -j target=UNIX \ + CC=icc \ +- opt='-DSYZYGY -DTEST -DCPUS=4' \ +- CFLAGS='-Wall -w -O2 -prof_use -prof_dir ./prof -fno-alias \ +- -mpopcnt -pthread' \ ++ opt='$(opt) -DSYZYGY -DTEST' \ ++ CFLAGS='$(CFLAGS) -Wall -w -O2 -prof_use -prof_dir ./prof -fno-alias -pthread' \ + LDFLAGS='$(LDFLAGS) -pthread -lstdc++' \ + crafty-make + + unix-icc-profile: + $(MAKE) -j target=UNIX \ + CC=icc \ +- opt='-DSYZYGY -DTEST -DCPUS=4' \ +- CFLAGS='-Wall -w -O2 -prof_gen -prof_dir ./prof -fno-alias \ +- -mpopcnt -pthread' \ ++ opt='$(opt) -DSYZYGY -DTEST' \ ++ CFLAGS='$(CFLAGS) -Wall -w -O2 -prof_gen -prof_dir ./prof -fno-alias -pthread' \ + LDFLAGS='$(LDFLAGS) -pthread -lstdc++ ' \ + crafty-make + +@@ -145,14 +139,14 @@ + @mkdir prof + @touch *.c *.h + $(MAKE) -j unix-clang-profile +- @echo "#!/bin/csh" > runprof +- @echo "./crafty <<EOF" >>runprof +- @echo "bench" >>runprof +- @echo "mt=0" >>runprof +- @echo "quit" >>runprof +- @echo "EOF" >>runprof ++ @echo "#!/bin/bash" > runprof ++ @echo "./crafty <<EOF" >> runprof ++ @echo "bench" >> runprof ++ @echo "mt=4" >> runprof ++ @echo "quit" >> runprof ++ @echo "EOF" >> runprof + @chmod +x runprof +- @./runprof ++ @bash runprof + @rm runprof + @touch *.c *.h + $(MAKE) -j unix-clang @@ -6,7 +6,7 @@ _build_book=0 # 0=Uses defauld book.bin pkgname=crafty pkgver=25.2 -pkgrel=1 +pkgrel=2 pkgdesc="A free, open-source computer chess program developed by Dr. Robert M. (Bob) Hyatt" arch=('i686' 'x86_64') url="http://www.craftychess.com/" @@ -15,56 +15,56 @@ source=("http://www.craftychess.com/downloads/source/$pkgname-$pkgver.zip" "http://www.craftychess.com/downloads/book/book.`[[ "$_build_book" = '0' ]] && echo bin || echo pgn.gz`" "http://www.craftychess.com/downloads/book/start.pgn.gz" "http://www.craftychess.com/downloads/book/startc.pgn.gz" - "COPYRIGHT" - "CRAFTY.FAQ") + "crafty-data.tar.bz2" + "security-203541.patch" + "paths.patch" + "Makefile.patch") md5sums=('d8ad87d9b0fc39a437595203d7b302fc' "`[[ "$_build_book" = '0' ]] && echo f8f93189c64324b1959a489da822438e || echo 05efad71289b2d328da5110df4a19f85`" '880279c223dc34164837a351faafe2f0' '7a53d5f09d2baa5e7f0df4ee81961cfb' - '438cec9f32fb79f58822f97cf64e7afb' - 'f744727e291b6dec7e7c69bb3586b6dd') + '18cb719601b36825113274335ee0e3f1' + '02c7ab07c0ff8f77738a055772f4406d' + '9db34746e90ceb116d162a5fa727f7e0' + '178436e4fdacdecd58d0bbdeb9aba924') prepare() { cd "$srcdir" - sed -i -e 's:./runprof:sh ./runprof:' -e "s:-DTEST:-DBOOKDIR=\"\\\\\"/usr/share/crafty\\\\\"\" -DTEST:" Makefile - sed -i 's:"crafty.hlp":BOOKDIR"/crafty.hlp":' option.c - sed -i '/PopCnt/s/arg1/x/' boolean.c # bug fix + patch -Np0 -i "${srcdir}/security-203541.patch" + patch -Np1 -i "${srcdir}/paths.patch" + patch -Np0 -i "${srcdir}/Makefile.patch" + sed -i -e "s:mt=4:mt=$(nproc):" Makefile } build() { cd "$srcdir" - unset LDFLAGS - make unix-gcc-profile + make CFLAGS="${CFLAGS} `grep -q "popcnt" /proc/cpuinfo && echo "-mpopcnt"`" opt="-DUNIX -DCPUS=$(nproc)" unix-gcc cd "$srcdir" - - [[ "$_build_book" = '0' ]] && mv book.bin book.bin.orj - - msg "Creating books.bin..." - ./crafty "book create start.pgn 60" quit - mv book.bin books.bin - - msg "Creating bookc.bin..." - ./crafty "book create startc.pgn 60" quit - mv book.bin bookc.bin - - if [[ "$_build_book" = '0' ]]; then - mv book.bin.orj book.bin - else + # create crafty's rc-files within the BUILD directory + homeorj=$HOME; HOME=. + msg "Creating bookfiles, this might take a moment..." + if [[ "$_build_book" = '1' ]]; then msg "Creating book.bin..." ./crafty "book create book.pgn 60" quit fi + # create books.bin (for crafty's opening strategy) + msg "Creating books.bin..." + ./crafty "books create start.pgn 60" quit + # create bookc.bin (computer opening book) + msg "Creating bookc.bin..." + ./crafty "bookc create startc.pgn 60 3" quit + HOME=$homeorj } package() { cd "$srcdir" - install -Dm755 crafty "$pkgdir/usr/bin/crafty" - install -Dm644 crafty.hlp "$pkgdir/usr/share/crafty/crafty.hlp" - - cd "$srcdir" - install -m777 book.bin "$pkgdir/usr/share/crafty/" - install -m644 books.bin "$pkgdir/usr/share/crafty/" - install -m644 bookc.bin "$pkgdir/usr/share/crafty/" - install -Dm644 COPYRIGHT "$pkgdir/usr/share/licenses/$pkgname/COPYRIGHT" - install -Dm644 CRAFTY.FAQ "$pkgdir/usr/share/doc/$pkgname/CRAFTY.FAQ" + install -Dpm 0755 crafty "$pkgdir/usr/bin/crafty" + install -Dpm 0644 crafty-data/crafty.6 "$pkgdir/usr/share/man/man6/crafty.6.gz" + install -dm 0755 "$pkgdir/usr/share/crafty/syzygy/" + install -pm 0666 book.bin "$pkgdir/usr/share/crafty/book.bin" + install -pm 0644 bookc.bin books.bin crafty.hlp "$pkgdir/usr/share/crafty/" + install -Dpm 0644 crafty-data/crafty.rc "$pkgdir/etc/crafty.rc" + install -Dpm 0644 crafty-data/copyright "$pkgdir/usr/share/licenses/crafty/copyright" + install -dpm 0644 crafty-data/{crafty.doc.v18.html,crafty.faq,readme,tournament.howto "$pkgdir/usr/share/doc/crafty/" } diff --git a/crafty-data.tar.bz2 b/crafty-data.tar.bz2 Binary files differnew file mode 100644 index 000000000000..e8733bfc4cde --- /dev/null +++ b/crafty-data.tar.bz2 diff --git a/paths.patch b/paths.patch new file mode 100644 index 000000000000..2f57f0b3cd85 --- /dev/null +++ b/paths.patch @@ -0,0 +1,35 @@ +diff -ura crafty-25.2.orig/chess.h crafty-25.2/chess.h +--- crafty-25.2.orig/chess.h 2016-10-28 06:11:42.000000000 +0300 ++++ crafty-25.2/chess.h 2017-03-25 20:58:32.380031222 +0300 +@@ -62,16 +62,16 @@ + # endif + # endif + # if !defined(BOOKDIR) +-# define BOOKDIR "." ++# define BOOKDIR "/usr/share/crafty" + # endif + # if !defined(LOGDIR) + # define LOGDIR "." + # endif + # if !defined(TBDIR) +-# define TBDIR "./syzygy" ++# define TBDIR "/usr/share/crafty/syzygy" + # endif + # if !defined(RCDIR) +-# define RCDIR "." ++# define RCDIR "/etc" + # endif + # include "lock.h" + # define MAXPLY 129 +diff -ura crafty-25.2.orig/option.c crafty-25.2/option.c +--- crafty-25.2.orig/option.c 2016-10-28 06:11:42.000000000 +0300 ++++ crafty-25.2/option.c 2017-03-25 21:00:02.124519987 +0300 +@@ -980,7 +980,7 @@ + char *readstat = (char *) -1; + int lines = 0; + +- helpfile = fopen("crafty.hlp", "r"); ++ helpfile = fopen(BOOKDIR"/crafty.hlp", "r"); + if (!helpfile) { + printf("ERROR. Unable to open \"crafty.hlp\" -- help unavailable\n"); + return 1; diff --git a/security-203541.patch b/security-203541.patch new file mode 100644 index 000000000000..1d2297bda854 --- /dev/null +++ b/security-203541.patch @@ -0,0 +1,44 @@ +--- main.c.orig 2016-10-28 06:11:42.000000000 +0300 ++++ main.c 2017-03-25 13:52:59.796731999 +0300 +@@ -4308,7 +4308,10 @@ + for (i = 1; i < argc; i++) { + if (strstr(argv[i], "path") || strstr(argv[i], "log") || + strstr(argv[1], "affinity")) { +- strcpy(buffer, argv[i]); ++ /*This is a security flaw (see http://bugs.debian.org/203541 */ ++ /*strcpy(buffer, argv[i]); */ ++ memset(buffer,'\0',sizeof(buffer)); ++ strncpy(buffer,argv[i],sizeof(buffer)-1); + result = Option(tree); + if (result == 0) + Print(2048, "ERROR \"%s\" is unknown command-line option\n", +@@ -4328,11 +4331,16 @@ + */ + #if defined(UNIX) + input_stream = fopen(".craftyrc", "r"); +- if (!input_stream) ++ if (!input_stream) { + if ((pwd = getpwuid(getuid()))) { + sprintf(path, "%s/.craftyrc", pwd->pw_dir); + input_stream = fopen(path, "r"); + } ++ if (!input_stream) { ++ sprintf (path, "%s/crafty.rc", rc_path); ++ input_stream = fopen (path, "r"); ++ } ++ } + if (input_stream) + #else + sprintf(crafty_rc_file_spec, "%s/crafty.rc", rc_path); +@@ -4375,7 +4383,10 @@ + Print(-1, "ERROR ignoring token %s, 255 character max\n", + argv[i]); + else { +- strcpy(buffer, argv[i]); ++ /* This is a security flaw (see http://bugs.debian.org/203541 */ ++ /* strcpy(buffer, argv[i]); */ ++ memset(buffer,'\0',sizeof(buffer)); ++ strncpy(buffer,argv[i],sizeof(buffer)-1); + Print(32, "(info) command line option \"%s\"\n", buffer); + result = Option(tree); + if (result == 0) |