xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: xen-devel@lists.xenproject.org, Ian Jackson <ian.jackson@eu.citrix.com>
Subject: Re: [PATCH v2] xenconsole: add option to avoid escape sequences in log
Date: Tue, 31 Jul 2018 18:11:15 +0200	[thread overview]
Message-ID: <20180731161115.GS1371@mail-itl> (raw)
In-Reply-To: <20180731091010.chflw6m32uqeatsq@citrix.com>


[-- Attachment #1.1: Type: text/plain, Size: 1483 bytes --]

On Tue, Jul 31, 2018 at 10:10:10AM +0100, Wei Liu wrote:
> On Tue, Jul 31, 2018 at 05:15:32AM +0200, Marek Marczykowski-Górecki wrote:
> > Add --replace-escape option to xenconsoled, which replaces ESC with
> > '.' in console output written to log file. This makes it slightly safer
> > to do tail -f on a console output of untrusted guest.
> > The pty output is unaffected by this option.
> > 
> > Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> 
> Acked-by: Wei Liu <wei.liu2@citrix.com>
> 
> ... though I would like to make a minor modification when committing.
> See below.
> 
> >  static int write_all(int fd, const char* buf, size_t len)
> >  {
> > +	char buf_replaced[1024];
> > +	size_t this_round;
> 
> These two can be moved into ... 
> 
> > +
> >  	while (len) {
> > -		ssize_t ret = write(fd, buf, len);
> > +		ssize_t ret;
> > +		if (replace_escape) {
> 
> ... here.
> 
> Let me know if you disagree.

Sure, that's fine with me.

> > +			if (len > sizeof(buf_replaced))
> > +				this_round = sizeof(buf_replaced);
> > +			else
> > +				this_round = len;
> > +			do_replace_escape(buf, buf_replaced, this_round);
> > +			ret = write(fd, buf_replaced, this_round);
> > +		} else
> > +			ret = write(fd, buf, len);

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

      reply	other threads:[~2018-07-31 16:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-31  3:15 [PATCH v2] xenconsole: add option to avoid escape sequences in log Marek Marczykowski-Górecki
2018-07-31  9:10 ` Wei Liu
2018-07-31 16:11   ` Marek Marczykowski-Górecki [this message]

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=20180731161115.GS1371@mail-itl \
    --to=marmarek@invisiblethingslab.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).