zlib 1.2.9 added an uncompress2 function that clashes with swish's
internal compress2 function. The build is fixed by the following
mechanical diff that renames the internal function to swish_uncompress2
as was done in alpine:
https://git.alpinelinux.org/aports/tree/main/swish-e/zlib-shadowing.patch?h=3.14-stable
I couldn't come up with a preprocessor trick that would allow avoiding
the bulk rename, but hopefully there's something cleverer that would
avoid a big diff.
HOMEPAGE is broken, so I removed it.
Index: Makefile
===================================================================
RCS file: /cvs/ports/textproc/swish-e/Makefile,v
retrieving revision 1.14
diff -u -p -r1.14 Makefile
--- Makefile 12 Jul 2019 20:50:15 -0000 1.14
+++ Makefile 2 Jul 2021 14:06:04 -0000
@@ -3,12 +3,11 @@
COMMENT = web/text search engine
DISTNAME = swish-e-2.4.7
-REVISION = 4
+REVISION = 5
SHARED_LIBS = swish-e 2.1
CATEGORIES = textproc www
-HOMEPAGE = http://swish-e.org/
-MASTER_SITES = ${HOMEPAGE}distribution/
+MASTER_SITES = http://swish-e.org/distribution/
# GPLv2
PERMIT_PACKAGE = Yes
Index: patches/patch-src_btree_c
===================================================================
RCS file: patches/patch-src_btree_c
diff -N patches/patch-src_btree_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_btree_c 2 Jul 2021 14:04:13 -0000
@@ -0,0 +1,119 @@
+$OpenBSD$
+
+Fix namespace collision with libz
+
+Index: src/btree.c
+--- src/btree.c.orig
++++ src/btree.c
+@@ -321,7 +321,7 @@ unsigned char *key_k;
+ {
+ k = j + (i - j) / 2;
+ key_k = BTREE_KeyData(pg,k);
+- key_len_k = uncompress2(&key_k);
++ key_len_k = swish_uncompress2(&key_k);
+ isbigger = BTREE_CompareKeys(key,key_len,key_k,key_len_k);
+ if (!isbigger)
+ break;
+@@ -358,7 +358,7 @@ sw_off_t data_pointer;
+ return 0;
+
+ *found = BTREE_KeyData(pg,k);
+- *found_len = uncompress2(found);
++ *found_len = swish_uncompress2(found);
+
+ /* Solaris do not like this. Use memcpy instead
+ data_pointer = *(sw_off_t *) (*found + *found_len);
+@@ -483,7 +483,7 @@ int j, k = pos;
+
+ /* Compute length of deleted key */
+ del_key_start = q = BTREE_KeyData(pg,k);
+- q += uncompress2(&q);
++ q += swish_uncompress2(&q);
+ q += sizeof(sw_off_t);
+ del_key_end = q;
+ del_entry_len = del_key_end - del_key_start;
+@@ -610,7 +610,7 @@ int tmp;
+ for(i = 0; i < n; i++)
+ {
+ key_data = start = BTREE_KeyData(pg, pg->n - n + i);
+- key_len = uncompress2(&key_data);
++ key_len = swish_uncompress2(&key_data);
+
+ memcpy(p, start, (key_data - start) + key_len + sizeof(sw_off_t));
+ tmp = p - new_pg->data;
+@@ -628,7 +628,7 @@ int tmp;
+ for(i = 0; i < (int)pg->n ; i++)
+ {
+ key_data = start = BTREE_KeyData(pg,i);
+- key_len = uncompress2(&key_data);
++ key_len = swish_uncompress2(&key_data);
+
+ memmove(p, start, (key_data - start) + key_len + sizeof(sw_off_t));
+ tmp = p - pg->data;
+@@ -687,7 +687,7 @@ int comp;
+ if(!(pg->flags & BTREE_ROOT_NODE))
+ {
+ key_data0 = BTREE_KeyData(pg,0);
+- key_len0 = uncompress2(&key_data0);
++ key_len0 = swish_uncompress2(&key_data0);
+ father_pg = BTREE_ReadPage(b,b->tree[level]);
+ BTREE_InsertInPage(b,father_pg, key_data0, key_len0, pg->page_number, level - 1, 1);
+ }
+@@ -711,7 +711,7 @@ int comp;
+ pg->next = new_pg->page_number;
+
+ key_data0 = BTREE_KeyData(new_pg,0);
+- key_len0 = uncompress2(&key_data0);
++ key_len0 = swish_uncompress2(&key_data0);
+
+ /* Let's see where to put the key */
+ if(BTREE_CompareKeys(key, key_len, key_data0, key_len0) > 0)
+@@ -740,10 +740,10 @@ int comp;
+ root_page = BTREE_NewPage(b,b->page_size, BTREE_ROOT_NODE);
+
+ key_data0 = BTREE_KeyData(pg,0);
+- key_len0 = uncompress2(&key_data0);
++ key_len0 = swish_uncompress2(&key_data0);
+ BTREE_AddKeyToPage(root_page, 0, key_data0, key_len0 , pg->page_number);
+ key_data0 = BTREE_KeyData(new_pg,0);
+- key_len0 = uncompress2(&key_data0);
++ key_len0 = swish_uncompress2(&key_data0);
+ BTREE_AddKeyToPage(root_page, 1, key_data0, key_len0, new_pg->page_number);
+
+ b->root_page = root_page->page_number;
+@@ -769,7 +769,7 @@ int comp;
+ BTREE_FreePage(b, pg);
+
+ key_data0 = BTREE_KeyData(new_pg,0);
+- key_len0 = uncompress2(&key_data0);
++ key_len0 = swish_uncompress2(&key_data0);
+ BTREE_FreePage(b, BTREE_Walk(b,key_data0,key_len0));
+ }
+ else
+@@ -778,7 +778,7 @@ int comp;
+ BTREE_FreePage(b, pg);
+
+ key_data0 = BTREE_KeyData(new_pg,0);
+- key_len0 = uncompress2(&key_data0);
++ key_len0 = swish_uncompress2(&key_data0);
+ }
+
+ if(!(new_pg->flags & BTREE_ROOT_NODE))
+@@ -827,7 +827,7 @@ BTREE_Page *pg = BTREE_Walk(b,key,key_len);
+
+ key_k = BTREE_KeyData(pg,k);
+
+- key_len_k = uncompress2(&key_k);
++ key_len_k = swish_uncompress2(&key_k);
+
+ if ( key_len_k != key_len)
+ return -1; /* Error - Should never happen */
+@@ -903,7 +903,7 @@ int key_len_k;
+ b->current_position = 0;
+ }
+ key_k = BTREE_KeyData(pg,b->current_position);
+- *found_len = key_len_k = uncompress2(&key_k);
++ *found_len = key_len_k = swish_uncompress2(&key_k);
+ *found = emalloc(key_len_k);
+ memcpy(*found,key_k,key_len_k);
+ data_pointer = UNPACKFILEOFFSET(*(unsigned long *) (key_k + key_len_k));
Index: patches/patch-src_compress_c
===================================================================
RCS file: /cvs/ports/textproc/swish-e/patches/patch-src_compress_c,v
retrieving revision 1.1
diff -u -p -r1.1 patch-src_compress_c
--- patches/patch-src_compress_c 2 Dec 2014 11:59:42 -0000 1.1
+++ patches/patch-src_compress_c 2 Jul 2021 14:04:13 -0000
@@ -1,6 +1,61 @@
$OpenBSD: patch-src_compress_c,v 1.1 2014/12/02 11:59:42 naddy Exp $
---- src/compress.c.orig Sun Apr 5 03:58:32 2009
-+++ src/compress.c Tue Dec 2 05:06:54 2014
+
+Fix namespace collision with libz
+
+Index: src/compress.c
+--- src/compress.c.orig
++++ src/compress.c
+@@ -194,7 +194,7 @@ int uncompress1(FILE * fp, int (*f_getc) (FILE *))
+
+ /* same routine but this works with a memory forward buffer instead of file */
+ /* it also increases the buffer pointer */
+-int uncompress2(unsigned char **buffer)
++int swish_uncompress2(unsigned char **buffer)
+ {
+ int _c;
+ int num = 0;
+@@ -604,10 +604,10 @@ void uncompress_location_values(unsigned char **buf,un
+ else
+ (*frequency) |= (*flag) & 15; /* Binary 00001111 */
+
+- *filenum = uncompress2(&p);
++ *filenum = swish_uncompress2(&p);
+
+ if(! (*frequency))
+- *frequency = uncompress2(&p);
++ *frequency = swish_uncompress2(&p);
+
+ *buf = p;
+ }
+@@ -656,7 +656,7 @@ void uncompress_location_positions(unsigned char **buf
+ }
+
+ /* First position is always "as is" */
+- posdata[0] = (unsigned int)uncompress2(&p);
++ posdata[0] = (unsigned int)swish_uncompress2(&p);
+
+ /* Check if positions where stored as two values per byte or the old "compress" style */
+ if(flag & POS_4_BIT)
+@@ -674,7 +674,7 @@ void uncompress_location_positions(unsigned char **buf
+ {
+ for (i = 1; i < frequency; i++)
+ {
+- tmp = uncompress2(&p);
++ tmp = swish_uncompress2(&p);
+ posdata[i] = (unsigned int)tmp;
+ }
+ }
+@@ -974,8 +974,8 @@ void remove_worddata_longs(unsigned char *worddata,
+ src = worddata;
+
+ /* Jump over tfrequency and get first metaID */
+- tfrequency = uncompress2(&src); /* tfrequency */
+- metaID = uncompress2(&src); /* metaID */
++ tfrequency = swish_uncompress2(&src); /* tfrequency */
++ metaID = swish_uncompress2(&src); /* metaID */
+ dst = src;
+
+ while(1)
@@ -995,7 +995,7 @@ void remove_worddata_longs(unsigned char *worddata,
progerr("Internal error in remove_worddata_longs");
@@ -10,3 +65,12 @@ $OpenBSD: patch-src_compress_c,v 1.1 201
/* Increase pointers */
src += data_len;
+@@ -1006,7 +1006,7 @@ void remove_worddata_longs(unsigned char *worddata,
+ break; /* End of worddata */
+
+ /* Get next metaID */
+- metaID = uncompress2(&src);
++ metaID = swish_uncompress2(&src);
+ dst = compress3(metaID,dst);
+ }
+ /* Adjust to new size */
Index: patches/patch-src_compress_h
===================================================================
RCS file: patches/patch-src_compress_h
diff -N patches/patch-src_compress_h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_compress_h 2 Jul 2021 14:04:13 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+Fix namespace collision with libz
+
+Index: src/compress.h
+--- src/compress.h.orig
++++ src/compress.h
+@@ -36,7 +36,7 @@ void compress1(int num, FILE *fp, int (*f_putc)(int ,
+ unsigned char *compress3(int num, unsigned char *buffer);
+
+ int uncompress1(FILE *fp, int (*f_getc)(FILE *fp));
+-int uncompress2(unsigned char **buffer);
++int swish_uncompress2(unsigned char **buffer);
+
+
+ unsigned long PACKLONG(unsigned long num);
Index: patches/patch-src_db_native_c
===================================================================
RCS file: patches/patch-src_db_native_c
diff -N patches/patch-src_db_native_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_db_native_c 2 Jul 2021 14:04:13 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+Fix namespace collision with libz
+
+Index: src/db_native.c
+--- src/db_native.c.orig
++++ src/db_native.c
+@@ -1601,7 +1601,7 @@ long DB_ReadWordData_Native(sw_off_t wordID, unsign
+
+ *worddata = buf = WORDDATA_Get(DB->worddata,wordID,data_size);
+ /* Get saved_bytes and adjust data_size */
+- *saved_bytes = uncompress2(&buf);
++ *saved_bytes = swish_uncompress2(&buf);
+ *data_size -= (buf - (*worddata));
+ /* Remove saved_bytes from buffer
+ ** We need to use memmove because data overlaps */
Index: patches/patch-src_db_read_c
===================================================================
RCS file: patches/patch-src_db_read_c
diff -N patches/patch-src_db_read_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_db_read_c 2 Jul 2021 14:04:13 -0000
@@ -0,0 +1,66 @@
+$OpenBSD$
+
+Fix namespace collision with libz
+
+Index: src/db_read.c
+--- src/db_read.c.orig
++++ src/db_read.c
+@@ -308,24 +308,24 @@ void parse_MetaNames_from_buffer(INDEXDATAHEADER *h
+ /* First clear out the default metanames */
+ freeMetaEntries( header );
+
+- num_metanames = uncompress2(&s);
++ num_metanames = swish_uncompress2(&s);
+
+ for (i = 0; i < num_metanames; i++)
+ {
+- len = uncompress2(&s);
++ len = swish_uncompress2(&s);
+ word = emalloc(len +1);
+ memcpy(word,s,len); s += len;
+ word[len] = '\0';
+ /* Read metaID */
+- metaID = uncompress2(&s);
++ metaID = swish_uncompress2(&s);
+ /* metaType was saved as metaType+1 */
+- metaType = uncompress2(&s);
++ metaType = swish_uncompress2(&s);
+
+- alias = uncompress2(&s) - 1;
++ alias = swish_uncompress2(&s) - 1;
+
+- sort_len = uncompress2(&s);
++ sort_len = swish_uncompress2(&s);
+
+- bias = uncompress2(&s) - RANK_BIAS_RANGE - 1;
++ bias = swish_uncompress2(&s) - RANK_BIAS_RANGE - 1;
+
+
+ /* add the meta tag */
+@@ -350,11 +350,11 @@ static void load_word_hash_from_buffer(WORD_HASH_TABLE
+
+ unsigned char *s = (unsigned char *)buffer;
+
+- num_words = uncompress2(&s);
++ num_words = swish_uncompress2(&s);
+
+ for (i=0; i < num_words ; i++)
+ {
+- len = uncompress2(&s);
++ len = swish_uncompress2(&s);
+ word = emalloc(len+1);
+ memcpy(word,s,len); s += len;
+ word[len] = '\0';
+@@ -373,10 +373,10 @@ void parse_integer_table_from_buffer(int table[], int
+ int tmp,i;
+ unsigned char *s = (unsigned char *)buffer;
+
+- tmp = uncompress2(&s); /* Jump the number of elements */
++ tmp = swish_uncompress2(&s); /* Jump the number of elements */
+ for (i = 0; i < table_size; i++)
+ {
+- tmp = uncompress2(&s); /* Gut all the elements */
++ tmp = swish_uncompress2(&s); /* Gut all the elements */
+ table[i] = tmp - 1;
+ }
+ }
Index: patches/patch-src_db_write_c
===================================================================
RCS file: patches/patch-src_db_write_c
diff -N patches/patch-src_db_write_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_db_write_c 2 Jul 2021 14:04:13 -0000
@@ -0,0 +1,115 @@
+$OpenBSD$
+
+Fix namespace collision with libz
+
+Index: src/db_write.c
+--- src/db_write.c.orig
++++ src/db_write.c
+@@ -239,7 +239,7 @@ void build_worddata(SWISH * sw, ENTRY * ep)
+ /* Jump pointer to next element */
+ p = compressed_data + sizeof(LOCATION *);
+
+- metaID = uncompress2(&p);
++ metaID = swish_uncompress2(&p);
+
+ memcpy((char *)&chunk_size,(char *)p,sizeof(chunk_size));
+ p += sizeof(chunk_size);
+@@ -386,12 +386,12 @@ unsigned char *q;
+ ** are presents to calculate a safe size for olddata with packedlongs */
+ p1=olddata;
+ num_metaids1=0;
+- uncompress2(&p1); /* Jump tfreq */
++ swish_uncompress2(&p1); /* Jump tfreq */
+ do
+ {
+ num_metaids1++;
+- uncompress2(&p1); /* Jump metaid */
+- metadata_length_1 = uncompress2(&p1);
++ swish_uncompress2(&p1); /* Jump metaid */
++ metadata_length_1 = swish_uncompress2(&p1);
+ p1 += metadata_length_1;
+ } while ((p1 - olddata) != sz_olddata);
+ maxtotsize = sw->Index->sz_worddata_buffer + (sz_olddata + num_metaids1 * sizeof(long));
+@@ -417,17 +417,17 @@ unsigned char *q;
+ q = p = sw->Index->worddata_buffer;
+
+ /* Now read tfrequency */
+- tfreq1 = uncompress2(&p1); /* tfrequency - number of files with this word */
+- tfreq2 = uncompress2(&p2); /* tfrequency - number of files with this word */
++ tfreq1 = swish_uncompress2(&p1); /* tfrequency - number of files with this word */
++ tfreq2 = swish_uncompress2(&p2); /* tfrequency - number of files with this word */
+ /* Write tfrequency */
+ p = compress3(tfreq1 + tfreq2, p);
+
+ /* Now look for MetaIDs */
+- curmetaID_1 = uncompress2(&p1);
+- curmetaID_2 = uncompress2(&p2);
++ curmetaID_1 = swish_uncompress2(&p1);
++ curmetaID_2 = swish_uncompress2(&p2);
+
+ /* Old data is compressed in a different more optimized schema */
+- metadata_length_1 = uncompress2(&p1);
++ metadata_length_1 = swish_uncompress2(&p1);
+ nextposmetaname_1 = p1 - olddata + metadata_length_1;
+
+ curmetanamepos_1 = p1 - olddata;
+@@ -485,8 +485,8 @@ unsigned char *q;
+ /* Values for next metaID if exists */
+ if(curmetaID_1)
+ {
+- curmetaID_1 = uncompress2(&p1); /* Next metaID */
+- metadata_length_1 = uncompress2(&p1);
++ curmetaID_1 = swish_uncompress2(&p1); /* Next metaID */
++ metadata_length_1 = swish_uncompress2(&p1);
+ nextposmetaname_1 = p1 - olddata + metadata_length_1;
+ curmetanamepos_1 = p1 - olddata;
+ }
+@@ -522,7 +522,7 @@ unsigned char *q;
+ /* Values for next metaID if exists */
+ if(curmetaID_2)
+ {
+- curmetaID_2 = uncompress2(&p2); /* Next metaID */
++ curmetaID_2 = swish_uncompress2(&p2); /* Next metaID */
+ nextposmetaname_2 = UNPACKLONG2(p2);
+ p2 += sizeof(long);
+ curmetanamepos_2 = p2 - newdata;
+@@ -539,8 +539,8 @@ unsigned char *q;
+ }
+ else
+ {
+- curmetaID_1 = uncompress2(&p1); /* Next metaID */
+- metadata_length_1 = uncompress2(&p1);
++ curmetaID_1 = swish_uncompress2(&p1); /* Next metaID */
++ metadata_length_1 = swish_uncompress2(&p1);
+ nextposmetaname_1 = p1 - olddata + metadata_length_1;
+ curmetanamepos_1 = p1 - olddata;
+ }
+@@ -556,7 +556,7 @@ unsigned char *q;
+ }
+ else
+ {
+- curmetaID_2 = uncompress2(&p2); /* Next metaID */
++ curmetaID_2 = swish_uncompress2(&p2); /* Next metaID */
+ nextposmetaname_2 = UNPACKLONG2(p2);
+ p2 += sizeof(long);
+ curmetanamepos_2 = p2 - newdata;
+@@ -587,8 +587,8 @@ unsigned char *q;
+ }
+ else
+ {
+- curmetaID_1 = uncompress2(&p1); /* Next metaID */
+- metadata_length_1 = uncompress2(&p1);
++ curmetaID_1 = swish_uncompress2(&p1); /* Next metaID */
++ metadata_length_1 = swish_uncompress2(&p1);
+ nextposmetaname_1 = p1 - olddata + metadata_length_1;
+ curmetanamepos_1 = p1 - olddata;
+ }
+@@ -615,7 +615,7 @@ unsigned char *q;
+ }
+ else
+ {
+- curmetaID_2 = uncompress2(&p2); /* Next metaID */
++ curmetaID_2 = swish_uncompress2(&p2); /* Next metaID */
+ nextposmetaname_2 = UNPACKLONG2(p2);
+ p2+= sizeof(long);
+ curmetanamepos_2= p2 - newdata;
Index: patches/patch-src_dump_c
===================================================================
RCS file: patches/patch-src_dump_c
diff -N patches/patch-src_dump_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_dump_c 2 Jul 2021 14:04:13 -0000
@@ -0,0 +1,55 @@
+$OpenBSD$
+
+Fix namespace collision with libz
+
+Index: src/dump.c
+--- src/dump.c.orig
++++ src/dump.c
+@@ -249,9 +249,9 @@ void DB_decompress(SWISH * sw, IndexFILE * indexf,
+ /* parse and print word's data */
+ s = worddata;
+
+- tmpval = uncompress2(&s); /* tfrequency */
+- metaID = uncompress2(&s); /* metaID */
+- metadata_length = uncompress2(&s);
++ tmpval = swish_uncompress2(&s); /* tfrequency */
++ metaID = swish_uncompress2(&s); /* metaID */
++ metadata_length = swish_uncompress2(&s);
+
+ filenum = 0;
+ start = s;
+@@ -276,8 +276,8 @@ void DB_decompress(SWISH * sw, IndexFILE * indexf,
+ if ( metadata_length == (s - start))
+ {
+ filenum = 0;
+- metaID = uncompress2(&s);
+- metadata_length = uncompress2(&s);
++ metaID = swish_uncompress2(&s);
++ metadata_length = swish_uncompress2(&s);
+ start = s;
+ }
+
+@@ -337,9 +337,9 @@ void DB_decompress(SWISH * sw, IndexFILE * indexf,
+ /* parse and print word's data */
+ s = worddata;
+
+- tmpval = uncompress2(&s); /* tfrequency */
+- metaID = uncompress2(&s); /* metaID */
+- metadata_length = uncompress2(&s);
++ tmpval = swish_uncompress2(&s); /* tfrequency */
++ metaID = swish_uncompress2(&s); /* metaID */
++ metadata_length = swish_uncompress2(&s);
+
+ filenum = 0;
+ start = s;
+@@ -437,8 +437,8 @@ void DB_decompress(SWISH * sw, IndexFILE * indexf,
+ if ( metadata_length == (s - start))
+ {
+ filenum = 0;
+- metaID = uncompress2(&s);
+- metadata_length = uncompress2(&s);
++ metaID = swish_uncompress2(&s);
++ metadata_length = swish_uncompress2(&s);
+ start = s;
+ }
+ }
Index: patches/patch-src_filter_c
===================================================================
RCS file: /cvs/ports/textproc/swish-e/patches/patch-src_filter_c,v
retrieving revision 1.2
diff -u -p -r1.2 patch-src_filter_c
--- patches/patch-src_filter_c 26 Oct 2010 12:21:35 -0000 1.2
+++ patches/patch-src_filter_c 2 Jul 2021 14:04:13 -0000
@@ -1,7 +1,9 @@
-$OpenBSD: patch-src_filter_c,v 1.2 2010/10/26 12:21:35 merdely Exp $
---- src/filter.c.orig Sat Apr 4 21:58:32 2009
-+++ src/filter.c Tue Oct 26 01:40:11 2010
-@@ -51,7 +51,7 @@ $Id: patch-src_filter_c,v 1.2 2010/10/26 12:21:35 merdely Exp $
+$OpenBSD$
+
+Index: src/filter.c
+--- src/filter.c.orig
++++ src/filter.c
+@@ -51,7 +51,7 @@ $Id: filter.c 1859 2007-01-05 22:14:10Z whmoseley $
No comments:
Post a Comment