From: Jilles Tjoelker <jilles@stack.nl>
To: Harald van Dijk <harald@gigawatt.nl>
Cc: dash@vger.kernel.org, Eric Blake <eblake@redhat.com>
Subject: Re: [PATCH] Improved LINENO support
Date: Fri, 12 Nov 2010 22:29:32 +0100 [thread overview]
Message-ID: <20101112212932.GB57806@stack.nl> (raw)
In-Reply-To: <4CDD9095.5070106@gigawatt.nl>
On Fri, Nov 12, 2010 at 08:07:41PM +0059, Harald van Dijk wrote:
> must not write to test-7 and test2-8. It may write to test-1 and
> test2-1, or it may write to test-8 and test2-8. Perhaps even to test-7
> and test2-7. Again, though, LINENO must be the same in both expansions.
> So for dash, the problem doesn't change: storing the line number of each
> word, rather than each command, makes it very hard to get LINENO right.
Hmm, I hadn't thought of that. I considered a LINENO that points to the
affected word most useful and easiest to implement (also because FreeBSD
sh's LINENO works this way).
So some more ideas:
A per-command LINENO does not require adding the number to all of the
node types. Only node types that are commands that perform expansions
need it: NCMD, NREDIR, NBACKGND, NSUBSHELL, NFOR, NCASE.
NFOR and NCASE may be wrapped in an NREDIR node to hold the line number.
This simplifies the code a bit at the cost of some extra memory usage.
A further simplification might be removing the redirect field from
NBACKGND and NSUBSHELL and putting any redirect in an additional NREDIR
node inside the NBACKGND/NSUBSHELL (so that the file is opened in the
child process and job control works correctly). However, NREDIR,
NBACKGND and NSUBSHELL are compatible types so it does not seem to gain
much.
What about making the lineno an element of the redirection list like
NTO? This minimizes changes to eval.c but perhaps it is too contrived.
Second idea: use a per-word LINENO but somehow ensure it is the same for
all words in a command. I think this is wrong, but perhaps I'm wrong.
--
Jilles Tjoelker
next prev parent reply other threads:[~2010-11-12 21:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-08 20:33 [PATCH] Improved LINENO support Harald van Dijk
2010-11-10 22:00 ` Jilles Tjoelker
2010-11-11 20:33 ` Harald van Dijk
2010-11-12 18:17 ` Harald van Dijk
2010-11-12 18:35 ` Eric Blake
2010-11-12 19:08 ` Harald van Dijk
2010-11-12 19:40 ` Harald van Dijk
2010-11-12 21:29 ` Jilles Tjoelker [this message]
2010-11-27 16:56 ` Harald van Dijk
2011-03-10 8:10 ` Herbert Xu
2011-03-11 21:56 ` Harald van Dijk
2011-03-15 7:52 ` Herbert Xu
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=20101112212932.GB57806@stack.nl \
--to=jilles@stack.nl \
--cc=dash@vger.kernel.org \
--cc=eblake@redhat.com \
--cc=harald@gigawatt.nl \
/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.