From: Martin Pitt <martin.pitt@ubuntu.com>
To: Neil Horman <nhorman@tuxdriver.com>
Cc: Martin Pitt <martin.pitt@ubuntu.com>,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
jeremy@goop.org, wwoods@redhat.com,
Ben Collins <ben.collins@ubuntu.com>
Subject: Re: [PATCH 2/3] core_pattern: allow passing of arguments to user mode helper when core_pattern is a pipe
Date: Sat, 28 Jul 2007 18:17:25 +0200 [thread overview]
Message-ID: <20070728161725.GA5836@piware.de> (raw)
In-Reply-To: <20070728134627.GA10006@hmsreliant.homelinux.net>
[-- Attachment #1: Type: text/plain, Size: 3603 bytes --]
Hi Neil,
Neil Horman [2007-07-28 9:46 -0400]:
> > I just want to mention a potential problem with this: If you first
> > expand the macros (from pattern to corename) and then split
> > corename into an argv, then this breaks macro expansions
> > containing spaces. This mostly affects the executable name, of
> > course.
> >
> I never intended for this core_pattern argument passing to be able
> to expand macros, other than the macros specified by the
> core_pattern code. If you want it to do that, we can address that
> with a later patch.
No, I specifically mean the standard ones provided by
format_corename(), such as %p (pid), %s (signal), or %e (executable
name). I don't see a reason to provide additional functionality.
> > In fact we considered this macro approach when doing the original
> > patches in the Ubuntu kernel, but we eventually used environment
> > variables because they are much easier and more robust to
> > implement than doing a robust macro expansion (i. e. first split
> > core_pattern into an argv and then call the macro expansion for
> > each element).
> >
> I disagree. While it might be nice to be able to specify environment
> variables as command line arguments, it would be much easier to just
> let the core_pattern executable inherit the crashing processes
> environment. we don't do that currently, but we easily could. That
> way any information that the crashing process wants the dying
> process to know can be inherited and vetted easily by apport (or
> whatever the core_pattern points to). I'll do a patch later for
> that if you don't like it.
I don't think that this will be necessary. After all, the crash
handler can read all the environment from /proc/<pid>/ (and that's
indeed what apport does to figure out relevant parts from the
environment like the locale).
It seems we misunderstood each other, I don't expect or want any new
functionality in core_pattern. AN example might make it more clear:
The original problem that we are trying to solve is the current
behaviour of core_pattern expansion with pipes:
|/bin/crash --pid %p
would try to execute the program '/bin/crash --pid 1234' instead of
calling /bin/crash with ['--pid', '1234'] as argv, right? Your patch
achieves the latter by splitting the formatted core dump string into
an array (at spaces).
I pointed out that this leads to problems when macro values contain
spaces. This currently affects hostname (%h) (although this really
should not happen in practice) and executable name (%e) (rare, but at
least valid). I. e. for an executable name "foo bar" your patch would
expand
|/bin/crash %e
to ['/bin/crash', 'foo', 'bar'] instead of ['/bin/crash', 'foo bar'].
Of course this is a corner case, and personally I don't really care.
I strive to keep the assumptions about the interface at a minimum, so
right now Apport's only required input is the core dump itself (over
stdin); signal and pid can be read from the environment, and if not
present, they are read from the core dump.
I did not defend Ubuntu's usage of environment variables, on the
contrary. Using the standard macros is more explicit and elegant, and
I welcome that change. I just pointed out the reason why we chose the
environment variable approach initially.
I just wanted to mention this little problem for the sake of
correctness.
Thank you, and have a nice weekend!
Martin
--
Martin Pitt http://www.piware.de
Ubuntu Developer http://www.ubuntu.com
Debian Developer http://www.debian.org
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2007-07-28 16:17 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-27 20:08 [PATCH 2/3] core_pattern: allow passing of arguments to user mode helper when core_pattern is a pipe Neil Horman
2007-07-27 20:54 ` Jeremy Fitzhardinge
2007-07-28 0:46 ` Neil Horman
2007-07-28 9:23 ` Martin Pitt
2007-07-28 13:46 ` Neil Horman
2007-07-28 16:17 ` Martin Pitt [this message]
2007-07-28 17:21 ` Neil Horman
2007-07-28 22:52 ` Jeremy Fitzhardinge
2007-07-29 2:21 ` Neil Horman
2007-07-29 8:53 ` Aneesh Kumar K.V
2007-07-29 12:16 ` Neil Horman
2007-07-29 9:34 ` Martin Pitt
2007-07-29 12:19 ` Neil Horman
2007-07-29 13:03 ` Eugene Teo
2007-07-29 21:58 ` Neil Horman
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=20070728161725.GA5836@piware.de \
--to=martin.pitt@ubuntu.com \
--cc=akpm@linux-foundation.org \
--cc=ben.collins@ubuntu.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=wwoods@redhat.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox