为什么此手册页有今天的日期?


9

为什么man在我nc不对系统进行任何更新的情况下,特定页面(对于我而言,对于命令而言)具有今天的日期?另外,为什么“无人值守更新”日志未显示当天的任何特定活动?

2018-03-14 07:47:38,124 INFO Initial blacklisted packages:
2018-03-14 07:47:38,135 INFO Starting unattended upgrades script
2018-03-14 07:47:38,135 INFO Allowed origins are: ['o=LinuxMint,a=qiana-security', 'o=LinuxMintESM,a=qiana']
2018-03-14 07:47:51,767 INFO No packages found that can be upgraded unattended and no pending auto-removals

这是nc手册页的页脚:

BSD                             March 14, 2018                             BSD

那是在Linux Mint 17(qiana)上,它基于具有groff 1.22.2和man-db 2.6.7.1的Ubuntu 14.04(可信任)。

编辑

请求的命令输出:

  1. man -aw nc

    /usr/share/man/man1/nc_openbsd.1.gz
    
  2. ls -ld $(man -aw nc)

    -rw-r--r-- 1 root root 5.7K Dec  4  2012 /usr/share/man/man1/nc_openbsd.1.gz
    

哪有...

  1. dpkg -S $(man -aw nc)

    netcat-openbsd: /usr/share/man/man1/nc_openbsd.1.gz
    
  2. type -a man

    man is /usr/bin/man
    
  3. zgrep docdate $(man -aw nc)

    .Dd $Mdocdate: February 7 2012 $
    
  4. 添加的脚 strace -f man nc 2>&1 | grep -e '^BSD' -e '"/.*nc'

    ychaouche#ychaouche-PC 14:31:15 ~ $ strace -f man nc 2>&1 | grep -e '^BSD' -e '"/.*nc'
    execve("/usr/bin/man", ["man", "nc"], [/* 87 vars */]) = 0
    lstat("/usr/share/man/man1/nc.1.gz", {st_mode=S_IFLNK|0777, st_size=25, ...}) = 0
    lstat("/usr/share/man/man1/nc.1.gz", {st_mode=S_IFLNK|0777, st_size=25, ...}) = 0
    readlink("/usr/share/man/man1/nc.1.gz", "/etc/alternatives/nc.1.gz", 4095) = 25
    lstat("/etc/alternatives/nc.1.gz", {st_mode=S_IFLNK|0777, st_size=35, ...}) = 0
    readlink("/etc/alternatives/nc.1.gz", "/usr/share/man/man1/nc_openbsd.1"..., 4095) = 35
    lstat("/usr/share/man/man1/nc_openbsd.1.gz", {st_mode=S_IFREG|0644, st_size=5756, ...}) = 0
    stat("/usr/share/man/man1/nc_openbsd.1.gz", {st_mode=S_IFREG|0644, st_size=5756, ...}) = 0
    stat("/usr/share/man/man1/nc_openbsd.1.gz", {st_mode=S_IFREG|0644, st_size=5756, ...}) = 0
    open("/usr/share/man/man1/nc_openbsd.1.gz", O_RDONLY) = 3
    access("/usr/share/man/man1/nc.1.gz", R_OK) = 0
    lstat("/usr/share/man/man1/nc.1.gz", {st_mode=S_IFLNK|0777, st_size=25, ...}) = 0
    lstat("/usr/share/man/man1/nc.1.gz", {st_mode=S_IFLNK|0777, st_size=25, ...}) = 0
    readlink("/usr/share/man/man1/nc.1.gz", "/etc/alternatives/nc.1.gz", 4095) = 25
    lstat("/etc/alternatives/nc.1.gz", {st_mode=S_IFLNK|0777, st_size=35, ...}) = 0
    readlink("/etc/alternatives/nc.1.gz", "/usr/share/man/man1/nc_openbsd.1"..., 4095) = 35
    lstat("/usr/share/man/man1/nc_openbsd.1.gz", {st_mode=S_IFREG|0644, st_size=5756, ...}) = 0
    stat("/usr/share/man/man1/nc_openbsd.1.gz", {st_mode=S_IFREG|0644, st_size=5756, ...}) = 0
    stat("/usr/share/man/man1/nc_openbsd.1.gz", {st_mode=S_IFREG|0644, st_size=5756, ...}) = 0
    open("/usr/share/man/man1/nc_openbsd.1.gz", O_RDONLY) = 3
    stat("/usr/share/man/man1/nc.1.gz", {st_mode=S_IFREG|0644, st_size=5756, ...}) = 0
    stat("/usr/share/man/cat1/nc.1.gz", 0x7fffa49c0940) = -1 ENOENT (No such file or directory)
    stat("/usr/share/man/man1/nc_openbsd.1.gz", {st_mode=S_IFREG|0644, st_size=5756, ...}) = 0
    open("/usr/share/man/man1/nc_openbsd.1.gz", O_RDONLY) = 3
    [pid  3878] stat("/usr/share/man/man1/nc_openbsd.1.gz", {st_mode=S_IFREG|0644, st_size=5756, ...}) = 0
    [pid  3878] access("/usr/share/man/man1/nc_openbsd.1.gz", R_OK <unfinished ...>
    BSD                             March 20, 2018                             BSD
    
  5. strace -f man nc 2>&1 | grep -vwe -1 | grep -o '"/[^"]*"' | sort -u | grep -v /dev/ | xargs sh -c 'zgrep "March 14" "$@"' sh 2> /dev/null

     no output
    

    日期似乎没有硬编码。可能是产生今天日期的巨集。

  6. env | grep -e ROFF -e MAN -e GRO

    SESSION_MANAGER=local/ychaouche-PC:@/tmp/.ICE-unix/2915,unix/ychaouche-PC:/tmp/.ICE-unix/2915
    MANDATORY_PATH=/usr/share/gconf/default.mandatory.path
    
  7. env -i man nc 显示今天的日期(2018年3月20日)

  8. zcat /usr/share/man/man1/nc_openbsd.1.gz | nroff -mandoc | grep BSD

    ychaouche#ychaouche-PC 06:59:53 ~ $ zcat /usr/share/man/man1/nc_openbsd.1.gz | nroff -mandoc | grep BSD
    NC(1)                     BSD General Commands Manual                    NC(1)
    BSD                             March 20, 2018                             BSD
    ychaouche#ychaouche-PC 07:01:41 ~ $
    
  9. strace -f man nc 2>&1 | grep -vwe -1 | grep -o '"/[^"]*tmac/[^"]*"' | sort -u | xargs ls -lrtd

    ychaouche#ychaouche-PC 17:26:08 /usr/share/man/man1 $ unalias ls
    ychaouche#ychaouche-PC 17:26:12 /usr/share/man/man1 $ unalias xargs
    ychaouche#ychaouche-PC 17:26:14 /usr/share/man/man1 $ unalias grep
    ychaouche#ychaouche-PC 17:26:16 /usr/share/man/man1 $ strace -f man nc 2>&1 | grep -vwe -1 | grep -o '"/[^"]*tmac/[^"]*"' | sort -u | xargs ls -lrtd
    -rw-r--r-- 1 root root  4065 Jan 22  2014 /usr/share/groff/1.22.2/tmac/papersize.tmac
    -rw-r--r-- 1 root root  1860 Jan 22  2014 /usr/share/groff/1.22.2/tmac/andoc.tmac
    -rw-r--r-- 1 root root    71 Jan 22  2014 /usr/share/groff/1.22.2/tmac/unicode.tmac
    -rw-r--r-- 1 root root  1552 Jan 22  2014 /usr/share/groff/1.22.2/tmac/tty.tmac
    -rw-r--r-- 1 root root  5183 Jan 22  2014 /usr/share/groff/1.22.2/tmac/tty-char.tmac
    -rw-r--r-- 1 root root  1145 Jan 22  2014 /usr/share/groff/1.22.2/tmac/troffrc-end
    -rw-r--r-- 1 root root  1387 Jan 22  2014 /usr/share/groff/1.22.2/tmac/troffrc
    -rw-r--r-- 1 root root  4729 Jan 22  2014 /usr/share/groff/1.22.2/tmac/pspic.tmac
    -rw-r--r-- 1 root root 22042 Jan 22  2014 /usr/share/groff/1.22.2/tmac/mdoc/doc-syms
    -rw-r--r-- 1 root root  4048 Jan 22  2014 /usr/share/groff/1.22.2/tmac/mdoc/doc-nroff
    -rw-r--r-- 1 root root 29284 Jan 22  2014 /usr/share/groff/1.22.2/tmac/mdoc/doc-common
    -rw-r--r-- 1 root root  2250 Jan 22  2014 /usr/share/groff/1.22.2/tmac/latin1.tmac
    -rw-r--r-- 1 root root 27860 Jan 22  2014 /usr/share/groff/1.22.2/tmac/hyphen.us
    -rw-r--r-- 1 root root 15678 Jan 22  2014 /usr/share/groff/1.22.2/tmac/hyphenex.us
    -rw-r--r-- 1 root root  1362 Jan 22  2014 /usr/share/groff/1.22.2/tmac/fallbacks.tmac
    -rw-r--r-- 1 root root 73807 Jan 22  2014 /usr/share/groff/1.22.2/tmac/doc.tmac
    -rw-r--r-- 1 root root   537 Jan 22  2014 /usr/share/groff/1.22.2/tmac/composite.tmac
    -rw-r--r-- 1 root root   704 Jan 22  2014 /usr/share/groff/site-tmac/mdoc.local
    ychaouche#ychaouche-PC 17:26:18 /usr/share/man/man1 $
    

今天是昨天。我更新了帖子描述,以包括请求的命令输出。
ychaouche

联机帮助页的源代码在此处可见(显然是在OP系统上安装的版本)。
史蒂芬·基特

“人”是别名还是被覆盖?type -a man输出会有所帮助。
杰夫·谢勒

2
@Kiwy,好吧,这是一个有趣的问题。并且可能是由更大的问题引起的。
斯特凡Chazelas

1
-0--delimiter='\n'没有意义在一起(一个套分隔符NUL,对方LF)
斯特凡Chazelas

Answers:


10

GNU roff过去不支持那些:

 .Dd $Mdocdate: February 7 2012 $

OpenBSD扩展名(这里$Mdocdate: ...$是CVS / RCS关键字,由CVS扩展(OpenBSD用于对其代码进行版本控制),带有手动修订的日期),导致当前日期被扩展,而不是指定的日期。我可以在Ubuntu 14.04上为所有具有这样的手册页重现它Mdocdate

请参阅https://lists.gnu.org/archive/html/groff-commit/2014-10/msg00092.html(groff版本1.22.3)中实现的https://savannah.gnu.org/bugs/?42968


手册页从MirBSD(现MirOS)喜欢你paxcpio或者mksh,使用相同的$Mdocdate: ...$CVS的关键字,你会发现这个人的网页重新定义(套)的.DdMDOC宏观自己,所以系统的roff宏没有支持它:

.\"
.\" Implement .Dd with the Mdocdate RCS keyword
.\"
.rn Dd xD
.de Dd
.ie ^G\\$1^G$Mdocdate:^G \{\
.       xD \\$2 \\$3, \\$4
.\}
.el .xD \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8
..
.\"
.\" .Dd must come before definition of .Mx, because when called
.\" with -mandoc, it might implement .Mx itself, but we want to
.\" use our own definition. And .Dd must come *first*, always.
.\"
.Dd $Mdocdate: August 16 2017 $

1
那是一次出色的调试。非常感谢。
ychaouche

1
@ychaouche,现在正在寻找落后,本来应该的几件事情来看待之一,但由于某种原因,我想你的薄荷钱啊是基于而不是14.04的Ubuntu 16.04,无法重现它在16.04
斯特凡Chazelas

如您的注释所示,使用zgrep列出了所有带有此“错误”的手册页:gist.github.com/ychaouche/fabe43225d1692dc325826d2be521bc4。我手动验证了其中一些,该错误在那里。但它似乎已在Debian 8中得到修复(在其中一台服务器上使用8.10,但不存在bug。)
ychaouche

man ssh此处显示的是带有groff 1.22.2-8的Debian 8.10系统上的当前日期。也许您是groff从较新的版本中获得的软件包(stretch的版本为1.22.3)。请参阅apt-cache policy groff
斯特凡Chazelas

1
@ychaouche,这并不是一个真正的错误,它是OpenBSD为.Ddmdoc宏添加了新格式(否则接受Month day, year),因此他们可以在$Mdocdate: ... $其中使用CVS关键字(此处由CVS扩展为文档修订日期)。他们mdoc为此更新了自己的宏,然后将这些修改合并到groff中,以便可以在其他系统上正确格式化OpenBSD手册页。
斯特凡Chazelas
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.