From: "Lluís Vilanova" <vilanova@ac.upc.edu>
To: Eric Blake <eblake@redhat.com>
Cc: "Benoît Canet" <benoit.canet@irqsave.net>,
"Markus Armbruster" <armbru@redhat.com>,
qemu-devel@nongnu.org, "Luiz Capitulino" <lcapitulino@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v6 3/4] qapi: Add a primitive to include other files from a QAPI schema file
Date: Tue, 01 Apr 2014 15:46:44 +0200 [thread overview]
Message-ID: <87ob0lrwl7.fsf@fimbulvetr.bsc.es> (raw)
In-Reply-To: <5339C950.8060308@redhat.com> (Eric Blake's message of "Mon, 31 Mar 2014 14:00:16 -0600")
Eric Blake writes:
> On 03/31/2014 01:16 PM, Lluís Vilanova wrote:
[...]
>> + if not os.path.isabs(include_path):
>> + include_path = os.path.join(self.input_dir, include_path)
>> + if not os.path.isfile(include_path):
>> + raise QAPIExprError(
>> + expr_info,
>> + 'Non-existing included file "%s"' %
>> + include_path)
> Is this error necessary, or would you get a sane error message by just
> trying to open the file?
Not catching it would throw a Python exception, with no context of how the user
got there.
[...]
>> + if include_path in self.included:
>> + raise QAPIExprError(expr_info, "Infinite inclusion loop: %s"
>> + % " -> ".join(self.included +
>> + [include_path]))
> Good, include-self-cycle.err covers a one-file loop, and
> include-cycle.err covers a 3-file loop.
> Not so good: your error message is an extremely long line:
> +tests/qapi-schema/include-cycle-c.json:1: Infinite inclusion loop:
> tests/qapi-schema/include-cycle.json ->
> tests/qapi-schema/include-cycle-b.json ->
> tests/qapi-schema/include-cycle-c.json ->
> tests/qapi-schema/include-cycle.json
> The formatting in Benoît's series was a little nicer aesthetically:
> +Inclusion loop detected with file: multi_file_loop_include.json
> +Path to the broken include is:
> + multi_file_loop_include.json
> + multi_loop.json
> Furthermore, it had the benefit of using the spelling provided by the
> user, rather than the absolute path to the files. You want to track
> canonical paths for detecting the loop, but do NOT want to report
> absolute paths back to the user - instead, it's nicer to report back the
> names as they spelled it.
I think it's better reporting absolute paths, otherwise the user has to mentally
keep track of the relative paths to get to the file.
Thanks,
Lluis
--
"And it's much the same thing with knowledge, for whenever you learn
something new, the whole world becomes that much richer."
-- The Princess of Pure Reason, as told by Norton Juster in The Phantom
Tollbooth
next prev parent reply other threads:[~2014-04-01 13:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-31 19:16 [Qemu-devel] [PATCH v6 0/4] qapi: Allow modularization of QAPI schema files Lluís Vilanova
2014-03-31 19:16 ` [Qemu-devel] [PATCH v6 1/4] qapi: [trivial] Break long command lines Lluís Vilanova
2014-03-31 19:32 ` Eric Blake
2014-03-31 19:16 ` [Qemu-devel] [PATCH v6 2/4] qapi: Use an explicit input file Lluís Vilanova
2014-03-31 19:42 ` Eric Blake
2014-04-01 14:05 ` Lluís Vilanova
2014-03-31 19:16 ` [Qemu-devel] [PATCH v6 3/4] qapi: Add a primitive to include other files from a QAPI schema file Lluís Vilanova
2014-03-31 20:00 ` Eric Blake
2014-04-01 13:46 ` Lluís Vilanova [this message]
2014-04-01 14:47 ` Eric Blake
2014-04-01 16:05 ` Lluís Vilanova
2014-03-31 19:16 ` [Qemu-devel] [PATCH v6 4/4] qapi: Add tests for the "include" directive Lluís Vilanova
2014-03-31 20:17 ` Eric Blake
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=87ob0lrwl7.fsf@fimbulvetr.bsc.es \
--to=vilanova@ac.upc.edu \
--cc=armbru@redhat.com \
--cc=benoit.canet@irqsave.net \
--cc=eblake@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=qemu-devel@nongnu.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 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.