diff options
author | Yorhel <git@yorhel.nl> | 2016-11-20 16:41:08 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2016-11-20 16:41:08 +0100 |
commit | de28175cd31f6af26de968d608ec9b42a42cdb16 (patch) | |
tree | 98f8b21ca7873b24c8747f45b51f92586b856cc6 | |
parent | 46a6e2ff7c2afa73bcaf0fd01f79bf2b8ad928ca (diff) |
Misc. indexing fixes
-rw-r--r-- | indexer/src/pkg.rs | 8 | ||||
-rw-r--r-- | util/common.sh | 2 | ||||
-rwxr-xr-x | util/debian.sh | 3 |
3 files changed, 10 insertions, 3 deletions
diff --git a/indexer/src/pkg.rs b/indexer/src/pkg.rs index 1975cee..b70ccca 100644 --- a/indexer/src/pkg.rs +++ b/indexer/src/pkg.rs @@ -102,11 +102,17 @@ fn insert_man_row(tr: &postgres::GenericConnection, verid: i32, path: &str, enc: fn insert_man(tr: &postgres::GenericConnection, verid: i32, paths: &[&str], ent: &mut Read) { - let (dig, enc, cont) = match man::decode(paths, ent) { + let (dig, enc, mut cont) = match man::decode(paths, ent) { Err(e) => { error!("Error decoding {}: {}", paths[0], e); return }, Ok(x) => x, }; + // Postgres doesn't like the 0-byte in UTF-8 (and rightly so). + if cont.contains(0 as char) { + warn!("Removing 0-byte in man page contents"); + cont = cont.replace(0 as char, ""); + } + // Overwrite entry if the contents are different. It's possible that earlier decoding // implementations didn't properly detect the encoding. (On the other hand, due to differences // in filenames it's also possible that THIS decoding step went wrong, but that's slightly less diff --git a/util/common.sh b/util/common.sh index 85e9cad..a902ab6 100644 --- a/util/common.sh +++ b/util/common.sh @@ -1,4 +1,4 @@ -test -f .config && source .config +test -f .config && source ./.config index() { diff --git a/util/debian.sh b/util/debian.sh index 4768557..0595ea0 100755 --- a/util/debian.sh +++ b/util/debian.sh @@ -74,5 +74,6 @@ case "$1" in ;; all) $0 old - $0 active + $0 current + ;; esac |