Merge lp:~jamesodhunt/upstart/add-what-ident into lp:upstart

Proposed by James Hunt
Status: Work in progress
Proposed branch: lp:~jamesodhunt/upstart/add-what-ident
Merge into: lp:upstart
Diff against target: 26 lines (+8/-0)
2 files modified
ChangeLog (+6/-0)
init/main.c (+2/-0)
To merge this branch: bzr merge lp:~jamesodhunt/upstart/add-what-ident
Reviewer Review Type Date Requested Status
Upstart Developers Pending
Review via email: mp+59936@code.launchpad.net

Description of the change

* init/main.c: Added ident to allow init daemon personality to
  be determined the good old fashioned way: via what(1). This is
  in line with the sysvinit package in Debian.

To post a comment you must log in.
Revision history for this message
Scott James Remnant (scott) wrote :

LGTM

On Wed, May 4, 2011 at 7:19 AM, James Hunt <email address hidden> wrote:

> James Hunt has proposed merging lp:~jamesodhunt/upstart/add-what-ident into
> lp:upstart.
>
> Requested reviews:
> Upstart Developers (upstart-devel)
>
> For more details, see:
> https://code.launchpad.net/~jamesodhunt/upstart/add-what-ident/+merge/59936
>
> * init/main.c: Added ident to allow init daemon personality to
> be determined the good old fashioned way: via what(1). This is
> in line with the sysvinit package in Debian.
>
> --
> https://code.launchpad.net/~jamesodhunt/upstart/add-what-ident/+merge/59936
> Your team Upstart Developers is requested to review the proposed merge of
> lp:~jamesodhunt/upstart/add-what-ident into lp:upstart.
>
> === modified file 'ChangeLog'
> --- ChangeLog 2011-03-22 17:53:17 +0000
> +++ ChangeLog 2011-05-04 14:19:22 +0000
> @@ -1,3 +1,9 @@
> +2011-05-04 James Hunt <email address hidden>
> +
> + * init/main.c: Added ident to allow init daemon personality to
> + be determined the good old fashioned way: via what(1). This is
> + in line with the sysvinit package in Debian.
> +
> 2011-03-22 Scott James Remnant <email address hidden>
>
> * configure.ac: Bump version to 1.3
>
> === modified file 'init/main.c'
> --- init/main.c 2011-03-16 22:54:56 +0000
> +++ init/main.c 2011-05-04 14:19:22 +0000
> @@ -103,6 +103,8 @@
> NIH_OPTION_LAST
> };
>
> +static char ident[] __attribute__((unused)) =
> + "@(#) " PACKAGE_NAME " " PACKAGE_VERSION;
>
> int
> main (int argc,
>
>
>

Revision history for this message
Scott James Remnant (scott) wrote :

Out of interest, what's the use for this? Is there some script somewhere
actually expecting to be able to extract the version of the init daemon this
way instead of using "init --version" ?

On Wed, May 4, 2011 at 9:52 AM, Scott James Remnant <email address hidden>wrote:

> LGTM
>
> On Wed, May 4, 2011 at 7:19 AM, James Hunt <email address hidden>
> wrote:
>
> > James Hunt has proposed merging lp:~jamesodhunt/upstart/add-what-ident
> into
> > lp:upstart.
> >
> > Requested reviews:
> > Upstart Developers (upstart-devel)
> >
> > For more details, see:
> >
> https://code.launchpad.net/~jamesodhunt/upstart/add-what-ident/+merge/59936
> >
> > * init/main.c: Added ident to allow init daemon personality to
> > be determined the good old fashioned way: via what(1). This is
> > in line with the sysvinit package in Debian.
> >
> > --
> >
> https://code.launchpad.net/~jamesodhunt/upstart/add-what-ident/+merge/59936
> > Your team Upstart Developers is requested to review the proposed merge of
> > lp:~jamesodhunt/upstart/add-what-ident into lp:upstart.
> >
> > === modified file 'ChangeLog'
> > --- ChangeLog 2011-03-22 17:53:17 +0000
> > +++ ChangeLog 2011-05-04 14:19:22 +0000
> > @@ -1,3 +1,9 @@
> > +2011-05-04 James Hunt <email address hidden>
> > +
> > + * init/main.c: Added ident to allow init daemon personality to
> > + be determined the good old fashioned way: via what(1). This is
> > + in line with the sysvinit package in Debian.
> > +
> > 2011-03-22 Scott James Remnant <email address hidden>
> >
> > * configure.ac: Bump version to 1.3
> >
> > === modified file 'init/main.c'
> > --- init/main.c 2011-03-16 22:54:56 +0000
> > +++ init/main.c 2011-05-04 14:19:22 +0000
> > @@ -103,6 +103,8 @@
> > NIH_OPTION_LAST
> > };
> >
> > +static char ident[] __attribute__((unused)) =
> > + "@(#) " PACKAGE_NAME " " PACKAGE_VERSION;
> >
> > int
> > main (int argc,
> >
> >
> >
>
> --
> https://code.launchpad.net/~jamesodhunt/upstart/add-what-ident/+merge/59936
> Your team Upstart Developers is requested to review the proposed merge of
> lp:~jamesodhunt/upstart/add-what-ident into lp:upstart.
>

Revision history for this message
James Hunt (jamesodhunt) wrote :

Hi Scott,

The intention for this is to allow a non-privileged tool in any environment to identify any of the current init systems purely by doing "what `which init`". Of course you are right that init --version works for Upstart, but that presupposes that every init system supports "--version" and Debian's doesn't. Yeah, a distro could have a script which tried a load of tests for init systems I guess, but I thought the 'what' approach might be easier, particularly since the debian SysV init *does* already encode that detail into the binary.

There is the small matter of what(1) not being available on Debian/Ubuntu, but it can be implemented crudely as:

strings $1|grep '@(#)'|sed 's/^@(#) //g'

Cheers,

James.

Revision history for this message
Scott James Remnant (scott) wrote :

Except of course that this doesn't tell you which init system is running, a
system like Debian might have /sbin/upstart, /sbin/launchd and
/sbin/sysvinit installed with /sbin/init a symlink to one of them - or even
the init selected with init= on the kernel command-line

On Sun, May 15, 2011 at 6:35 AM, James Hunt <email address hidden>wrote:

> Hi Scott,
>
> The intention for this is to allow a non-privileged tool in any environment
> to identify any of the current init systems purely by doing "what `which
> init`". Of course you are right that init --version works for Upstart, but
> that presupposes that every init system supports "--version" and Debian's
> doesn't. Yeah, a distro could have a script which tried a load of tests for
> init systems I guess, but I thought the 'what' approach might be easier,
> particularly since the debian SysV init *does* already encode that detail
> into the binary.
>
> There is the small matter of what(1) not being available on Debian/Ubuntu,
> but it can be implemented crudely as:
>
> strings $1|grep '@(#)'|sed 's/^@(#) //g'
>
> Cheers,
>
> James.
> --
> https://code.launchpad.net/~jamesodhunt/upstart/add-what-ident/+merge/59936
> Your team Upstart Developers is requested to review the proposed merge of
> lp:~jamesodhunt/upstart/add-what-ident into lp:upstart.
>

Unmerged revisions

1280. By James Hunt

* init/main.c: Added ident to allow init daemon personality to
  be determined the good old fashioned way: via what(1). This is
  in line with the sysvinit package in Debian.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2011-03-22 17:53:17 +0000
3+++ ChangeLog 2011-05-04 14:19:22 +0000
4@@ -1,3 +1,9 @@
5+2011-05-04 James Hunt <james.hunt@ubuntu.com>
6+
7+ * init/main.c: Added ident to allow init daemon personality to
8+ be determined the good old fashioned way: via what(1). This is
9+ in line with the sysvinit package in Debian.
10+
11 2011-03-22 Scott James Remnant <scott@netsplit.com>
12
13 * configure.ac: Bump version to 1.3
14
15=== modified file 'init/main.c'
16--- init/main.c 2011-03-16 22:54:56 +0000
17+++ init/main.c 2011-05-04 14:19:22 +0000
18@@ -103,6 +103,8 @@
19 NIH_OPTION_LAST
20 };
21
22+static char ident[] __attribute__((unused)) =
23+ "@(#) " PACKAGE_NAME " " PACKAGE_VERSION;
24
25 int
26 main (int argc,

Subscribers

People subscribed via source and target branches