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