GNU bug report logs - #31497
27.0.50; vc-hg doesn't separate standard error from standard output

Previous Next

Package: emacs;

Reported by: Philipp Stephani <p.stephani2 <at> gmail.com>

Date: Fri, 18 May 2018 17:43:01 UTC

Severity: minor

Tags: fixed

Found in version 27.0.50

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Philipp Stephani <p.stephani2 <at> gmail.com>
Cc: 31497 <at> debbugs.gnu.org
Subject: bug#31497: 27.0.50; vc-hg doesn't separate standard error from standard output
Date: Wed, 09 Oct 2019 23:57:15 +0200
Philipp Stephani <p.stephani2 <at> gmail.com> writes:

> Create a Mercurial repository owned by root and add a hgrc file, e.g.:
>
> $ mkdir -p /tmp/hg
> $ cd /tmp/hg
> $ sudo -s
> # hg init
> # echo a > a.txt
> # hg addremove
> # hg commit -m 'commit message'
> # touch .hg/hgrc
>
> Then visit a.txt in Emacs as non-root:
>
> $ emacs -Q a.txt
>
> Instead of the revision number, the status line will show
> "Hg-not trusting file /tmp/hg/.hg/hgrc ..."
>
> This is because the status line runs something like
>
> $ hg log -l 1 -r . -T '{rev}'
>
> but that outputs
>
>   not trusting file /tmp/hg/.hg/hgrc from untrusted user root, group root
>   not trusting file /tmp/hg/.hg/hgrc from untrusted user root, group root
>
> on stderr, and Emacs merges stderr and stdout.  Rather it should ignore
> stderr in this case.

I can confirm that this bug is still present in Emacs 27.  The command
is started from vc-doc-command, which uses start-file-process, which
uses start-process, which doesn't even allow separating stderr from
stdin.

(In general, Emacs stderr/stdin handling is very frustrating.)

Would it make sense to alter this function

(defun vc-hg--run-log (template rev path)
  (ignore-errors
    (with-output-to-string
      (if path
          (vc-hg-command
           standard-output 0 nil
           "log" "-f" "-l1" "--template" template path)
        (vc-hg-command
         standard-output 0 nil
         "log" "-r" rev "-l1" "--template" template)))))

to filter out the "not trusting" lines, or is this just one of a
gazillion error messages that can be output here?

not trusting file /tmp/hg/.hg/hgrc from untrusted user root, group root
not trusting file /tmp/hg/.hg/hgrc from untrusted user root, group root
4d872e

I though perhaps we could redirect the error output with "-E", but "hg
log" doesn't seem to support that.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 5 years and 311 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.