Hello,

ufsdump build is broken now and seems that it became broken quite a long
time ago (though I have not tested when exactly), probably because is
not built by default. This patch fixes this, however I am not sure that
does it in a best possible way. For example, someone may argue that
inlining storeKeyText() is wrong. I am posting it in hope that somebody
else will polish and apply it.

BTW, running ufsdump produces an error:

FATAL: StoreMeta.cc required for use of Factory

Looks like it requires StoreMeta.cc instead of stub_StoreMeta.cc,
currently used.

Thanks,

Eduard.
Fix broken build for ufsdump utility.

=== modified file 'src/Makefile.am'
--- src/Makefile.am	2017-02-19 17:13:27 +0000
+++ src/Makefile.am	2017-03-05 18:49:54 +0000
@@ -600,87 +600,93 @@
 
 ## What requires what..
 ## many things want ACLChecklist.cc
 ## ACLChecklist.cc wants AuthUserRequest.cc
 ## ACLChecklist.cc wants AuthScheme.cc
 ## ACLChecklist.cc wants ACLProxyAuth.cc directly
 ## ACLProxyAuth.cc wants ACLUserData
 ## ACLProxyAuth.cc wants ACLRegexData
 ## cache_cf.cc wants $(AUTH_LIBS)
 ## cache_cf.cc wants store/libstore.la
 ## cache_cf.cc wants AnyP::PortCfg
 ## client_side wants client_db
 ## client_db wants SNMP_SOURCE
 ## snmp_core wants ACLStringData
 ## tools.cc wants ip/libip.la
 ## client_side.cc wants ip/libip.la
 ## libbase.la wants cbdata.*
 ## libbase.la wants MemBuf.*
 ufsdump_SOURCES = \
 	ClientInfo.h \
 	cbdata.h \
 	cbdata.cc \
 	debug.cc \
 	int.h \
 	int.cc \
 	mem/forward.h \
 	MemBuf.cc \
 	MemBuf.h \
 	Parsing.h \
 	store_key_md5.h \
-	store_key_md5.cc \
 	tests/stub_StoreMeta.cc \
 	StoreMetaUnpacker.cc \
+	StatHist.cc \
+	StatHist.h \
 	String.cc \
 	SquidNew.cc \
 	tests/stub_time.cc \
 	ufsdump.cc \
 	dlink.h \
 	dlink.cc \
 	helper/ChildConfig.h \
 	tests/stub_HelperChildConfig.cc \
 	RemovalPolicy.cc \
 	$(WIN32_SOURCE) \
 	fd.h \
 	tests/stub_fd.cc
 ufsdump_LDADD = \
 	ident/libident.la \
 	acl/libacls.la \
 	eui/libeui.la \
 	acl/libstate.la \
 	acl/libapi.la \
 	base/libbase.la \
 	libsquid.la \
 	ip/libip.la \
 	fs/libfs.la \
 	ipc/libipc.la \
 	mgr/libmgr.la \
+	sbuf/libsbuf.la \
+	mem/libmem.la \
+	SquidConfig.o \
+	$(top_builddir)/lib/libmiscutil.la \
+	$(top_builddir)/lib/libmiscencoding.la \
 	$(XTRA_OBJS) \
 	$(REPL_OBJS) \
 	$(NETTLELIB) \
 	$(CRYPTLIB) \
 	$(REGEXLIB) \
 	$(SSLLIB) \
 	$(COMPAT_LIB) \
 	$(EPOLL_LIBS) \
 	$(MINGW_LIBS) \
 	$(XTRA_LIBS)
 ufsdump_DEPENDENCIES = \
 	ident/libident.la \
 	acl/libacls.la \
 	eui/libeui.la \
 	acl/libstate.la \
 	acl/libapi.la \
 	base/libbase.la \
 	libsquid.la \
 	ip/libip.la \
 	fs/libfs.la \
 	ipc/libipc.la \
 	mgr/libmgr.la \
 	DiskIO/libdiskio.la \
 	$(REPL_OBJS)
 
 nodist_ufsdump_SOURCES = \
 	globals.cc
 
 sysconf_DATA = \
 	squid.conf.default \

=== modified file 'src/store_key_md5.cc'
--- src/store_key_md5.cc	2017-01-01 00:12:22 +0000
+++ src/store_key_md5.cc	2017-03-05 17:27:12 +0000
@@ -1,63 +1,47 @@
 /*
  * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
  *
  * Squid software is distributed under GPLv2+ license and includes
  * contributions from numerous individuals and organizations.
  * Please see the COPYING and CONTRIBUTORS files for details.
  */
 
 /* DEBUG: section 20    Storage Manager MD5 Cache Keys */
 
 #include "squid.h"
 #include "HttpRequest.h"
-#include "md5.h"
 #include "store_key_md5.h"
 #include "URL.h"
 
 static cache_key null_key[SQUID_MD5_DIGEST_LENGTH];
 
-const char *
-storeKeyText(const cache_key *key)
-{
-    if (!key)
-        return "[null_store_key]";
-
-    static char buf[SQUID_MD5_DIGEST_LENGTH * 2+1];
-    int i;
-
-    for (i = 0; i < SQUID_MD5_DIGEST_LENGTH; ++i)
-        snprintf(&buf[i*2],sizeof(buf) - i*2, "%02X", *(key + i));
-
-    return buf;
-}
-
 const cache_key *
 storeKeyScan(const char *buf)
 {
     static unsigned char digest[SQUID_MD5_DIGEST_LENGTH];
     int i;
     int j = 0;
     char t[3];
 
     for (i = 0; i < SQUID_MD5_DIGEST_LENGTH; ++i) {
         t[0] = *(buf + (j++));
         t[1] = *(buf + (j++));
         t[2] = '\0';
         *(digest + i) = (unsigned char) strtol(t, NULL, 16);
     }
 
     return digest;
 }
 
 int
 storeKeyHashCmp(const void *a, const void *b)
 {
     const unsigned char *A = (const unsigned char *)a;
     const unsigned char *B = (const unsigned char *)b;
     int i;
 
     for (i = 0; i < SQUID_MD5_DIGEST_LENGTH; ++i) {
         if (A[i] < B[i])
             return -1;
 
         if (A[i] > B[i])

=== modified file 'src/store_key_md5.h'
--- src/store_key_md5.h	2017-02-26 10:24:15 +0000
+++ src/store_key_md5.h	2017-03-05 17:28:34 +0000
@@ -1,40 +1,56 @@
 /*
  * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
  *
  * Squid software is distributed under GPLv2+ license and includes
  * contributions from numerous individuals and organizations.
  * Please see the COPYING and CONTRIBUTORS files for details.
  */
 
 /* DEBUG: section 20    Storage Manager MD5 Cache Keys */
 
 #ifndef SQUID_STORE_KEY_MD5_H_
 #define SQUID_STORE_KEY_MD5_H_
 
 #include "hash.h"
+#include "md5.h"
 #include "http/forward.h"
 #include "store/forward.h"
 
 typedef enum {
     ksDefault = 0,
     ksRevalidation
 } KeyScope;
 
 cache_key *storeKeyDup(const cache_key *);
 cache_key *storeKeyCopy(cache_key *, const cache_key *);
 void storeKeyFree(const cache_key *);
 const cache_key *storeKeyScan(const char *);
-const char *storeKeyText(const cache_key *);
+
+inline const char *
+storeKeyText(const cache_key *key)
+{
+    if (!key)
+        return "[null_store_key]";
+
+    static char buf[SQUID_MD5_DIGEST_LENGTH * 2+1];
+    int i;
+
+    for (i = 0; i < SQUID_MD5_DIGEST_LENGTH; ++i)
+        snprintf(&buf[i*2],sizeof(buf) - i*2, "%02X", *(key + i));
+
+    return buf;
+}
+
 const cache_key *storeKeyPublic(const char *, const HttpRequestMethod&, const KeyScope keyScope = ksDefault);
 const cache_key *storeKeyPublicByRequest(HttpRequest *, const KeyScope keyScope = ksDefault);
 const cache_key *storeKeyPublicByRequestMethod(HttpRequest *, const HttpRequestMethod&, const KeyScope keyScope = ksDefault);
 const cache_key *storeKeyPrivate();
 int storeKeyHashBuckets(int);
 int storeKeyNull(const cache_key *);
 void storeKeyInit(void);
 
 extern HASHHASH storeKeyHashHash;
 extern HASHCMP storeKeyHashCmp;
 
 #endif /* SQUID_STORE_KEY_MD5_H_ */
 

_______________________________________________
squid-dev mailing list
[email protected]
http://lists.squid-cache.org/listinfo/squid-dev

Reply via email to