From 614a996e50903fce2a94225056c07ee013a3483f Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Tue, 16 Feb 2021 00:00:41 +0100 Subject: pkgs/profpatsch/nman: fix panic if mandir.len() < 3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sometimes share/man contains directories that are not of the form man
which we are checking in build_man_page. However, this check can't deal with directories that are shorter than 3 characters due to the use of split_at() which panics if the index is out of range (for somer reason…). In nixpkgs it is relatively common to have directories like "de" in share/man. This has been resolved. --- pkgs/profpatsch/nman/nman.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkgs/profpatsch') diff --git a/pkgs/profpatsch/nman/nman.rs b/pkgs/profpatsch/nman/nman.rs index d3f60f7a..55293f1f 100644 --- a/pkgs/profpatsch/nman/nman.rs +++ b/pkgs/profpatsch/nman/nman.rs @@ -212,7 +212,7 @@ fn build_man_page<'a>(drv: DrvWithOutput, section: Option<&str>, page: &str, tem for dir in section_dirs { // separate "man" prefix from section indicator, // while validating the particular sub directory - match dir.to_str().map(|d| d.split_at(3)) { + match dir.to_str().filter(|d| d.len() > 3).map(|d| d.split_at(3)) { Some((_, "")) => continue, Some(("man", s)) => { // we have a valid man dir, check if it contains our page -- cgit 1.4.1