all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Philipp Stephani <p.stephani2@gmail.com>
Cc: 31497@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	[thread overview]
Message-ID: <87d0f51t1g.fsf@gnus.org> (raw)
In-Reply-To: <wvr4in7ksvwo.fsf@a.muc.corp.google.com> (Philipp Stephani's message of "Fri, 18 May 2018 19:42:15 +0200")

Philipp Stephani <p.stephani2@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





  reply	other threads:[~2019-10-09 21:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-18 17:42 bug#31497: 27.0.50; vc-hg doesn't separate standard error from standard output Philipp Stephani
2019-10-09 21:57 ` Lars Ingebrigtsen [this message]
2019-10-10  7:30   ` Eli Zaretskii
2019-10-11  7:27     ` Lars Ingebrigtsen
2019-10-10 11:11 ` Andrii Kolomoiets
2019-10-14 23:54 ` bug#31497: [Andrii Kolomoiets] " Lars Ingebrigtsen
2019-10-15  0:33   ` Lars Ingebrigtsen
2019-10-16  7:32     ` Andrii Kolomoiets
2019-10-17  2:26       ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d0f51t1g.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=31497@debbugs.gnu.org \
    --cc=p.stephani2@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.