man: MANPATH environment variable list too long(手动路径列表太长)
man: MANPATH environment variable list too long (manpath list too long)
当 MANPATH
env-vars 过长时,我最终遇到了这个错误的问题:
$> man <any command>
man: manpath list too long
为了找出手动路径列表何时过长,我创建了这个小脚本:
#!/bin/bash
export MANPATH=
for i in $(seq 50 10000)
do
export MANPATH=/usr:$MANPATH
man -k gcc > /dev/null
[ $? -ne 0 ] && echo "$i ${#MANPATH}" && exit 0
done
它似乎在 ${#MANPATH}
接近 500 时中断。
而且 man -d
没有给我任何我可以使用的信息...:(
我从来没有听说过(也没有发现)对 env-vars 中条目数量的限制(除了环境变量的最大长度,我离它还很远)。
有没有解决这个问题的方法?最好是非 root 修复 ;)
我是 运行 Debian 9.6.
编辑:这是上游报告并修复的!
基于manp.c starting at line 786:
else if (sscanf (bp, "MANDATORY_MANPATH %511s", key) == 1)
add_mandatory (key);
else if (sscanf (bp, "MANPATH_MAP %511s %511s",
key, cont) == 2)
add_manpath_map (key, cont);
else if ((c = sscanf (bp, "MANDB_MAP %511s %511s",
key, cont)) > 0)
add_mandb_map (key, cont, c, user);
else if ((c = sscanf (bp, "DEFINE %511s %511[^\n]",
key, cont)) > 0)
add_def (key, cont, c, user);
else if (sscanf (bp, "SECTION %511[^\n]", cont) == 1)
add_sections (cont, user);
else if (sscanf (bp, "SECTIONS %511[^\n]", cont) == 1)
/* Since I keep getting it wrong ... */
...
我认为门槛是 511 个字符。有趣的是,有一条评论说这应该被修复。
/* TODO: would like a (limited) replacement for sscanf()
* here that allocates its own memory. At that point check
* everything that sprintf()s manpath et al!
*/
参考资料
当 MANPATH
env-vars 过长时,我最终遇到了这个错误的问题:
$> man <any command>
man: manpath list too long
为了找出手动路径列表何时过长,我创建了这个小脚本:
#!/bin/bash
export MANPATH=
for i in $(seq 50 10000)
do
export MANPATH=/usr:$MANPATH
man -k gcc > /dev/null
[ $? -ne 0 ] && echo "$i ${#MANPATH}" && exit 0
done
它似乎在 ${#MANPATH}
接近 500 时中断。
而且 man -d
没有给我任何我可以使用的信息...:(
我从来没有听说过(也没有发现)对 env-vars 中条目数量的限制(除了环境变量的最大长度,我离它还很远)。
有没有解决这个问题的方法?最好是非 root 修复 ;)
我是 运行 Debian 9.6.
编辑:这是上游报告并修复的!
基于manp.c starting at line 786:
else if (sscanf (bp, "MANDATORY_MANPATH %511s", key) == 1)
add_mandatory (key);
else if (sscanf (bp, "MANPATH_MAP %511s %511s",
key, cont) == 2)
add_manpath_map (key, cont);
else if ((c = sscanf (bp, "MANDB_MAP %511s %511s",
key, cont)) > 0)
add_mandb_map (key, cont, c, user);
else if ((c = sscanf (bp, "DEFINE %511s %511[^\n]",
key, cont)) > 0)
add_def (key, cont, c, user);
else if (sscanf (bp, "SECTION %511[^\n]", cont) == 1)
add_sections (cont, user);
else if (sscanf (bp, "SECTIONS %511[^\n]", cont) == 1)
/* Since I keep getting it wrong ... */
...
我认为门槛是 511 个字符。有趣的是,有一条评论说这应该被修复。
/* TODO: would like a (limited) replacement for sscanf()
* here that allocates its own memory. At that point check
* everything that sprintf()s manpath et al!
*/