Your message dated Mon, 05 Jan 2015 09:36:10 +0000 with message-id <[email protected]> and subject line Bug#774611: fixed in geoip 1.6.2-3 has caused the Debian Bug report #774611, regarding geoip-bin: skipping locations if the location ID is not correctly ordered to be marked as done.
This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the Bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact [email protected] immediately.) -- 774611: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=774611 Debian Bug Tracking System Contact [email protected] with problems
--- Begin Message ---Package: geoip-bin Version: 1.6.2-2 Severity: important Tags: patch This patch adds support to skip location IDs, if upstream CSV is not correctly built. diff -Naur '--exclude=.svn' tags/1.6.2-2/debian/src/geoip-csv-to-dat.cpp branches/jessie/debian/src/geoip-csv-to-dat.cpp --- tags/1.6.2-2/debian/src/geoip-csv-to-dat.cpp 2014-10-27 19:31:48.626784609 +0100 +++ branches/jessie/debian/src/geoip-csv-to-dat.cpp 2014-12-30 19:32:51.588379341 +0100 @@ -694,12 +694,15 @@ class city_dat_writer : public dat_writer { public: - // All serialized location information + // All serialized location information, in one big + // undifferentiated block std::stringstream location_stream; // Seek offset of each location within // location_stream (relative to the beginning of - // location_stream) + // location_stream). An offset of -1 means that that + // location is not in the table (can happen if the + // location info's out of order). std::vector<int> location_pos; city_dat_writer(const char *dat_file_name, GeoIPDBTypes database_type); @@ -744,14 +747,22 @@ { if (it->edges[0] == 0x1000000) // No data it->edges[0] = trie_size; - else if (it->edges[0] > 0x1000000) // Ptr to location block - it->edges[0] = location_pos[it->edges[0] - 0x1000000 - 1] + trie_size; + else if (it->edges[0] > 0x1000000) { // Ptr to location block + int loc_id = it->edges[0] - 0x1000000; + if (loc_id >= location_pos.size() || location_pos[loc_id] == -1) + error(EX_DATAERR, 1, "Location %d exists in blocks but not in locations", loc_id); + it->edges[0] = location_pos[loc_id] + trie_size; + } // Any other value would indicate a non-leaf node if (it->edges[1] == 0x1000000) // No data it->edges[1] = trie_size; - else if (it->edges[1] > 0x1000000) // Ptr to location block - it->edges[1] = location_pos[it->edges[1] - 0x1000000 - 1] + trie_size; + else if (it->edges[1] > 0x1000000) { // Ptr to location block + int loc_id = it->edges[1] - 0x1000000; + if (loc_id >= location_pos.size() || location_pos[loc_id] == -1) + error(EX_DATAERR, 1, "Location %d exists in blocks but not in locations", loc_id); + it->edges[1] = location_pos[loc_id] + trie_size; + } // Any other value would indicate a non-leaf node } } @@ -801,19 +812,33 @@ const char *input_file_name, int input_line_number) { - // There's nothing wrong with location info being out of - // order, but currently we don't support it (i.e. the code - // won't work if the info's out of order). Sanity check that - // things are in order. + // First, we save the offset of this location block. int loc_id = ::atoi(info[0].c_str()); - if (loc_id != location_pos.size() + 1) { - error_at_line(EX_DATAERR, 0, input_file_name, input_line_number, - "Location info not in order (currently not supported)"); - return; - } + if (loc_id >= location_pos.size()) { + // We need to add to the location table (this is the + // usual case). + + while(loc_id > location_pos.size()) { + // If some numbers were skipped in the data, + // then we need to add some empty locations to + // the table before we find our spot. + location_pos.push_back(-1); + } - // First, we save the offset of this location block. - location_pos.push_back(location_stream.tellp()); + // Now we have our spot, insert this location. + location_pos.push_back(location_stream.tellp()); + } else { + // We already have a space in the table for this location -- + // if it's not empty, then we have two locations with the same + // ID, and we print an error. + if (location_pos[loc_id] != -1) { + error_at_line(EX_DATAERR, 0, input_file_name, + input_line_number, + "Duplicate location info for ID %d", + loc_id); + } + location_pos[loc_id] = location_stream.tellp(); + } // Country ID int country_id; @@ -1319,8 +1344,8 @@ return; } - const int locid = atoi(csv_fields[CSV_BLOCK_FIELD_LOC].c_str()); - const binary_trie::edge_type leaf = 0x1000000 + locid; + const int loc_id = atoi(csv_fields[CSV_BLOCK_FIELD_LOC].c_str()); + const binary_trie::edge_type leaf = 0x1000000 + loc_id; if (cmdline.address_family != AF_INET) { error(EX_SOFTWARE, 1, "IPv6 with city database is unimplemented."); -- System Information: Debian Release: 7.7 APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 3.2.0-4-amd64 (SMP w/2 CPU cores) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages geoip-bin depends on: ii libc6 2.13-38+deb7u6 ii libgcc1 1:4.7.2-5 ii libgeoip1 1.4.8+dfsg-3 ii libstdc++6 4.7.2-5 geoip-bin recommends no packages. geoip-bin suggests no packages. -- no debconf information
--- End Message ---
--- Begin Message ---Source: geoip Source-Version: 1.6.2-3 We believe that the bug you reported is fixed in the latest version of geoip, which is due to be installed in the Debian FTP archive. A summary of the changes between this version and the previous one is attached. Thank you for reporting the bug, which will now be closed. If you have further comments please address them to [email protected], and the maintainer will reopen the bug report if appropriate. Debian distribution maintenance software pp. Patrick Matthäi <[email protected]> (supplier of updated geoip package) (This message was generated automatically at their request; if you believe that there is a problem with it please contact the archive administrators by mailing [email protected]) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Format: 1.8 Date: Mon, 05 Jan 2015 10:04:40 +0100 Source: geoip Binary: libgeoip1 libgeoip-dev geoip-bin geoip-dbg Architecture: source amd64 Version: 1.6.2-3 Distribution: unstable Urgency: low Maintainer: Patrick Matthäi <[email protected]> Changed-By: Patrick Matthäi <[email protected]> Description: geoip-bin - IP lookup command line tools that use the GeoIP library geoip-dbg - debugging symbols for the GeoIP packages libgeoip-dev - Development files for the GeoIP library libgeoip1 - non-DNS IP-to-country resolver library Closes: 774611 Changes: geoip (1.6.2-3) unstable; urgency=low . * geoip-generator: Add support for skipping locations if the location ID is not correctly ordered in the upstream CSV. Closes: #774611 Checksums-Sha1: 8d822e86adc3de44a42201298f5622ce8f393121 1902 geoip_1.6.2-3.dsc 03531f112e54c6b92a7de9ccda51f7952ff0b565 22052 geoip_1.6.2-3.debian.tar.xz ee78fc39090838d0684f3f63ae2de44214e5c99b 90816 libgeoip1_1.6.2-3_amd64.deb ddc8c7c8e7959c95abe32763841d645272f5ad01 122938 libgeoip-dev_1.6.2-3_amd64.deb 688a534a159772001a1982122cc21d817d6c322a 64456 geoip-bin_1.6.2-3_amd64.deb b6385203e62e2854db5cc6cfb30a80caf1b86fe7 340632 geoip-dbg_1.6.2-3_amd64.deb Checksums-Sha256: 298a1ec4b74e141952287dd21c0bca2bbe11e3160bd3df11d4664cdeaed40059 1902 geoip_1.6.2-3.dsc d90f13ed4a508e49397987a5d3f3a268b2ebe518ce6b7c30e7951c51cd415469 22052 geoip_1.6.2-3.debian.tar.xz cddda80c433484f0474b783d0c987418b7f497ebf5a62ef922cf35b1bc397bc9 90816 libgeoip1_1.6.2-3_amd64.deb cfc4c7c45651a2e5b8401c81eb900a953ca43844198430de8537f6c83ef534d5 122938 libgeoip-dev_1.6.2-3_amd64.deb a68a66008b948a684de92eab832db51a290a11658f70e6afe3fa4d699c8e2238 64456 geoip-bin_1.6.2-3_amd64.deb 0fbb1b6f8e5f59717bc2326357bd9cc9b6d01b4d35b1e0648131ceac98074650 340632 geoip-dbg_1.6.2-3_amd64.deb Files: e382cda7f9d48ba5c43e9e6d3a44b5f7 1902 net optional geoip_1.6.2-3.dsc 92f35b9ddbc5228080b3af2ed0b542c4 22052 net optional geoip_1.6.2-3.debian.tar.xz 9e0511e829f6610226fe38c09f576e88 90816 libs optional libgeoip1_1.6.2-3_amd64.deb 933cf644d3dc7a11f0bcc3f2cbe39f08 122938 libdevel optional libgeoip-dev_1.6.2-3_amd64.deb 50f494ca9d3aa9731471f52beeadc313 64456 net optional geoip-bin_1.6.2-3_amd64.deb 0c21b80252d8cd736d3a05ae1f3950e5 340632 debug extra geoip-dbg_1.6.2-3_amd64.deb -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAEBCAAGBQJUqlcLAAoJEBLZsEqQy9jk9tQP/1h3vMSvJbZnyCUz9JA8KSgj UiAN0M9U+Xq4L+7qqVF6CM6zOYwMKPr/jyr1ItbI/S8j5wssWO1sY/R/WqMolnag S/6NsqCsZJmZTM02xXWjcX8b1Al4sOVPKOiZvy+yoM/esLw0N9VVMdv6I8MSK+0T EY+K4owP/eOpviFp739x/vxY+KRE1H6gFJIBf10DMlyVYdpPac1m9qif5h+XaG+M /Ek2NrxeAWayt83gMu963SeFJXsRs3ctwfE+HskmE+FOiJ31kVx8bMhLGezdz39E dBwixEVdZpu665z38EVEJUt6Yk3gh4TYbGIq0LuA/z7helSe8VRWjVRJMzq9gpsi 92LDqqrIDaNeUPd5Jsxy2bamr2a4cCnmgbPxZgckjgfPqOEoqzqO/nqk8pJErDCd QX9Eu+v0xrxTQ0L50eNHE024bEYiVffabL+AsComnLMPrSti8xC4joV1aLOsdGXZ 7MuUYi9+by7C+UEWOklcJjbfPGCfG+bgA2Nqqr3Z6rJiauPccDVP7p+9UuXbxJQ7 JryfHmDbUWEauOfO4pBG0GmgFwfAh0N67mnN1TUPSrI+UWztPYHJYeSDgLOFfj7G G56U7QxoeR56b8N+BJHvV+HRxRs+SQewcP/Vs73b4v2fcaBA4vZFlbgG2Vedx9A/ vfRf5CRrgh/JqKiksrzk =oe73 -----END PGP SIGNATURE-----
--- End Message ---

