Xterm

Xterm 日誌文件名的資源名稱

  • September 24, 2016

Xterm 支持以下命令行選項:

-lf filename                 logging filename

為了在文件中指定文件名,此選項的資源名稱是什麼.Xdefaults

在過去的美好時光中,我使用了該資源

XTerm*VT100.logFile

但是,現在 xterm 通常編譯時沒有此功能,作為安全預防措施,因此這可能沒有效果。

要看的地方在xterm 手冊中,上面寫著

  -l      Turn logging on, unless disabled by the logInhibit resource.

          Some versions of xterm may have logging enabled.  However,
          normally logging is not supported, due to security concerns in
          the early 1990s.  That was a problem in X11R4 xterm (1989)
          which was addressed by a patch to X11R5 late in 1993.  X11R6
          included these fixes.  The older version (when running with
          root privilege) would create the log-file using root privilege.
          The reason why xterm ran with root privileges was to open
          pseudo-terminals.  Those privileges are now needed only on very
          old systems: Unix98 pseudo-terminals made the BSD scheme
          unnecessary.

          Unless overridden by the -lf option or the logFile resource:

          o   The logfile is written to the directory from which xterm is
              invoked.

          o   The filename is generated, of the form

                  XtermLog.XXXXXX

              or

                  Xterm.log.hostname.yyyy.mm.dd.hh.mm.ss.XXXXXX

              depending on how xterm was built.

並且(對於建構xterm 的人,例如,用於打包)該INSTALL文件解釋了相關的配置腳本選項:

–enable-logging 啟用日誌記錄

   Compile-in code that allows logging.

   Logging was disabled in X11R5 xterm because of security problems.
   They were addressed in X11R6, but the feature was not reinstated.

X11R6 是 20 年前發布的,您不太可能使用 xterm 的 X11R5 版本。

但是……手冊頁沒有提到相關資源。為此,您必須閱讀原始碼,從資源表開始:

#ifdef ALLOWLOGGING
   Bres(XtNlogInhibit, XtCLogInhibit, misc.logInhibit, False),
   Bres(XtNlogging, XtCLogging, misc.log_on, False),
   Sres(XtNlogFile, XtCLogfile, screen.logfile, NULL),
#endif

也就是說,有 3 個相關資源logInhibit日誌記錄logFile. 最後一個允許為日誌文件指定一個名稱,該名稱會覆蓋生成的名稱。

我總是把這個特性編譯進去,用於偶爾的測試。Debian 包啟用它,Fedora 包沒有(一些打包者閱讀說明,有些則不閱讀)。

該功能預設不開啟的原因與**大多數功能預設不開啟的原因相同:對使用程序來說不是必需的。大多數新功能都添加了預設的“關閉”設置。該規則的最新例外是在 2014 年,添加了--disable-wide-attr配置選項。

引用自:https://unix.stackexchange.com/questions/302544