public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] rfc: openrc init scripts taking command line arguments
@ 2012-07-18 19:41 William Hubbs
  2012-07-18 19:49 ` Peter Stuge
  2012-07-18 20:10 ` Michał Górny
  0 siblings, 2 replies; 14+ messages in thread
From: William Hubbs @ 2012-07-18 19:41 UTC (permalink / raw
  To: gentoo development

[-- Attachment #1: Type: text/plain, Size: 509 bytes --]

All,

I have received a request to allow OpenRC's init scripts to take command
line arguments [1]. As noted on the bug, there are some advantages to
this, but implementing it would have to break backward compatibility,
for example:

/etc/init.d/foo stop start

would no longer work the way you might expect because there would be no
way to tell whether start is a command or an argument to stop.

What are your thoughts about this change?

Thanks,

William

[1] https://bugs.gentoo.org/show_bug.cgi?id=427144

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [gentoo-dev] rfc: openrc init scripts taking command line arguments
  2012-07-18 19:41 [gentoo-dev] rfc: openrc init scripts taking command line arguments William Hubbs
@ 2012-07-18 19:49 ` Peter Stuge
  2012-07-18 19:53   ` Ian Stakenvicius
  2012-07-18 19:58   ` Michael Mol
  2012-07-18 20:10 ` Michał Górny
  1 sibling, 2 replies; 14+ messages in thread
From: Peter Stuge @ 2012-07-18 19:49 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 431 bytes --]

William Hubbs wrote:
> /etc/init.d/foo stop start
> 
> would no longer work the way you might expect because there would be no
> way to tell whether start is a command or an argument to stop.
> 
> What are your thoughts about this change?

/etc/init.d/foo stop start

along with all other commands can work like before.

/etc/init.d/foo stop -- start

can pass start as an argument to the stop command.


//Peter

[-- Attachment #2: Type: application/pgp-signature, Size: 190 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [gentoo-dev] rfc: openrc init scripts taking command line arguments
  2012-07-18 19:49 ` Peter Stuge
@ 2012-07-18 19:53   ` Ian Stakenvicius
  2012-07-18 19:58   ` Michael Mol
  1 sibling, 0 replies; 14+ messages in thread
From: Ian Stakenvicius @ 2012-07-18 19:53 UTC (permalink / raw
  To: gentoo-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 18/07/12 03:49 PM, Peter Stuge wrote:
> William Hubbs wrote:
>> /etc/init.d/foo stop start
>> 
>> would no longer work the way you might expect because there would
>> be no way to tell whether start is a command or an argument to
>> stop.
>> 
>> What are your thoughts about this change?
> 
> /etc/init.d/foo stop start
> 
> along with all other commands can work like before.
> 
> /etc/init.d/foo stop -- start
> 
> can pass start as an argument to the stop command.
> 
> 
> //Peter


I posted a response about this to the bug, but I don't see why, given
that all 'commands' are predefined anyways, the commandline couldn't
be parsed and split between commands..


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)

iF4EAREIAAYFAlAHFCkACgkQ2ugaI38ACPANyAEAnF7ngFvy/lcHPo0A4vEyN0zS
5QFTRmOiFG+GS8cRkyEBAL3ABkRD9M44sVHGs52ioctce+tsBSfLU9bawmBQuuJf
=dzvV
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [gentoo-dev] rfc: openrc init scripts taking command line arguments
  2012-07-18 19:49 ` Peter Stuge
  2012-07-18 19:53   ` Ian Stakenvicius
@ 2012-07-18 19:58   ` Michael Mol
  2012-07-18 20:06     ` Michał Górny
                       ` (2 more replies)
  1 sibling, 3 replies; 14+ messages in thread
From: Michael Mol @ 2012-07-18 19:58 UTC (permalink / raw
  To: gentoo-dev

On Wed, Jul 18, 2012 at 3:49 PM, Peter Stuge <peter@stuge.se> wrote:
> William Hubbs wrote:
>> /etc/init.d/foo stop start
>>
>> would no longer work the way you might expect because there would be no
>> way to tell whether start is a command or an argument to stop.
>>
>> What are your thoughts about this change?
>
> /etc/init.d/foo stop start
>
> along with all other commands can work like before.
>
> /etc/init.d/foo stop -- start
>
> can pass start as an argument to the stop command.

I like this approach, because its use of -- continues expected
commandline parsing behaviors from other commands, making it
intuitive.

I.e.

touch -- -an-ugly-filename
ls -l -- -an-ugly-filename
rm -- -an-ugly-filename

-- 
:wq



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [gentoo-dev] rfc: openrc init scripts taking command line arguments
  2012-07-18 19:58   ` Michael Mol
@ 2012-07-18 20:06     ` Michał Górny
  2012-07-18 20:07     ` Fabian Groffen
  2012-07-18 20:09     ` [gentoo-dev] " William Hubbs
  2 siblings, 0 replies; 14+ messages in thread
From: Michał Górny @ 2012-07-18 20:06 UTC (permalink / raw
  To: gentoo-dev; +Cc: mikemol

[-- Attachment #1: Type: text/plain, Size: 1422 bytes --]

On Wed, 18 Jul 2012 15:58:18 -0400
Michael Mol <mikemol@gmail.com> wrote:

> On Wed, Jul 18, 2012 at 3:49 PM, Peter Stuge <peter@stuge.se> wrote:
> > William Hubbs wrote:
> >> /etc/init.d/foo stop start
> >>
> >> would no longer work the way you might expect because there would
> >> be no way to tell whether start is a command or an argument to
> >> stop.
> >>
> >> What are your thoughts about this change?
> >
> > /etc/init.d/foo stop start
> >
> > along with all other commands can work like before.
> >
> > /etc/init.d/foo stop -- start
> >
> > can pass start as an argument to the stop command.
> 
> I like this approach, because its use of -- continues expected
> commandline parsing behaviors from other commands, making it
> intuitive.

No, it's not intuitive. It's rather counter-intuitive.

GNU command line parsers use '--' to separate options from random
arguments. It's '--' because options start with '-'. For arguments
starting with any other character, GNU option parsers treat them
equally before and after '--'.

And yes, some tools actually use '--' to separate arguments to the tool
itself from arguments which are passed to some other tool. This is not
very intuitive as well, and I really prefer having
'--subtool-one-arguments "--foo --bar"' instead, with embedded
splitting logic. Of course, this is harder to implement.

-- 
Best regards,
Michał Górny

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [gentoo-dev] rfc: openrc init scripts taking command line arguments
  2012-07-18 19:58   ` Michael Mol
  2012-07-18 20:06     ` Michał Górny
@ 2012-07-18 20:07     ` Fabian Groffen
  2012-07-19  3:39       ` [gentoo-dev] " Duncan
  2012-07-18 20:09     ` [gentoo-dev] " William Hubbs
  2 siblings, 1 reply; 14+ messages in thread
From: Fabian Groffen @ 2012-07-18 20:07 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1078 bytes --]

On 18-07-2012 15:58:18 -0400, Michael Mol wrote:
> > along with all other commands can work like before.
> >
> > /etc/init.d/foo stop -- start
> >
> > can pass start as an argument to the stop command.
> 
> I like this approach, because its use of -- continues expected
> commandline parsing behaviors from other commands, making it
> intuitive.
> 
> I.e.
> 
> touch -- -an-ugly-filename
> ls -l -- -an-ugly-filename
> rm -- -an-ugly-filename

yeah, but it means something like "don't treat the '-' as anything
special any more", so if you don't have something starting with -, you
don't need --.  Hence, following your "expected" behaviour argument,

/etc/init.d/foo stop start

would do the same as

/etc/init.d/foo stop -- start

or

/etc/init.d/foo -- stop start


Perhaps, one better makes it explicit, inspired by gdb

/etc/init.d/foo stop --args aggressive-kill=yes
(and when using --args, I'd probably disallow using multiple commands to
keep it clear what's going on)


Fabian

-- 
Fabian Groffen
Gentoo on a different level

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [gentoo-dev] rfc: openrc init scripts taking command line arguments
  2012-07-18 19:58   ` Michael Mol
  2012-07-18 20:06     ` Michał Górny
  2012-07-18 20:07     ` Fabian Groffen
@ 2012-07-18 20:09     ` William Hubbs
  2012-07-18 20:16       ` Ian Stakenvicius
  2 siblings, 1 reply; 14+ messages in thread
From: William Hubbs @ 2012-07-18 20:09 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1233 bytes --]

On Wed, Jul 18, 2012 at 03:58:18PM -0400, Michael Mol wrote:
> On Wed, Jul 18, 2012 at 3:49 PM, Peter Stuge <peter@stuge.se> wrote:
> > William Hubbs wrote:
> >> /etc/init.d/foo stop start
> >>
> >> would no longer work the way you might expect because there would be no
> >> way to tell whether start is a command or an argument to stop.
> >>
> >> What are your thoughts about this change?
> >
> > /etc/init.d/foo stop start
> >
> > along with all other commands can work like before.
> >
> > /etc/init.d/foo stop -- start
> >
> > can pass start as an argument to the stop command.
> 
> I like this approach, because its use of -- continues expected
> commandline parsing behaviors from other commands, making it
> intuitive.
> 
> I.e.
> 
> touch -- -an-ugly-filename
> ls -l -- -an-ugly-filename
> rm -- -an-ugly-filename

Theis still breaks backward compatibility though, e.g.

/etc/init.d/foo command1 -- arg1 arg2 command2

has issues.

The other approach, which is on the bug, still has this issue, e.g.

/etc/init.d/foo command1 arg1 arg2 command2 arg3 arg4 command3 arg5

gets pretty ugly pretty quick. which arguments go with which commands is
subject to interpretation.

William


[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [gentoo-dev] rfc: openrc init scripts taking command line arguments
  2012-07-18 19:41 [gentoo-dev] rfc: openrc init scripts taking command line arguments William Hubbs
  2012-07-18 19:49 ` Peter Stuge
@ 2012-07-18 20:10 ` Michał Górny
  2012-07-18 20:35   ` William Hubbs
  1 sibling, 1 reply; 14+ messages in thread
From: Michał Górny @ 2012-07-18 20:10 UTC (permalink / raw
  To: gentoo-dev; +Cc: williamh

[-- Attachment #1: Type: text/plain, Size: 1475 bytes --]

On Wed, 18 Jul 2012 14:41:52 -0500
William Hubbs <williamh@gentoo.org> wrote:

> I have received a request to allow OpenRC's init scripts to take
> command line arguments [1]. As noted on the bug, there are some
> advantages to this, but implementing it would have to break backward
> compatibility, for example:
> 
> /etc/init.d/foo stop start
> 
> would no longer work the way you might expect because there would be
> no way to tell whether start is a command or an argument to stop.
> 
> What are your thoughts about this change?

As I see that the discussion is now in two places, I'd shortly repeat
what I said on the bug.

First of all, I believe that you are focusing too much on your proposed
solution and too little on the actual problem. For example, in this
mail the actual problem is just linked as a footnote. This means that
we are starting to discuss the solution not knowing what it will be for.

As I mentioned there, I see that the problem covers a wide case of
script 'multiplexing', 'templates' or 'virtual script generators',
however you want to call it. I don't really think command-line
arguments can handle that. They will just add complexity to the issue.

For example, how would you consider the state of such a script? Will
every status check require passing additional arguments? Will every
script using this technique be required to re-invent the whole
multiplexing concept?

-- 
Best regards,
Michał Górny

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [gentoo-dev] rfc: openrc init scripts taking command line arguments
  2012-07-18 20:09     ` [gentoo-dev] " William Hubbs
@ 2012-07-18 20:16       ` Ian Stakenvicius
  0 siblings, 0 replies; 14+ messages in thread
From: Ian Stakenvicius @ 2012-07-18 20:16 UTC (permalink / raw
  To: gentoo-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 18/07/12 04:09 PM, William Hubbs wrote:
> 
> The other approach, which is on the bug, still has this issue,
> e.g.
> 
> /etc/init.d/foo command1 arg1 arg2 command2 arg3 arg4 command3
> arg5
> 
> gets pretty ugly pretty quick. which arguments go with which
> commands is subject to interpretation.

..i don't see how...?  anything to the right of [command] but before
{[other-command],$END} is an argument to [command] ...

ie, the above would roll out to:

/etc/init.d/foo command1 arg1 arg2 && \
/etc/init.d/foo command2 arg3 arg4 && \
/etc/init.d/foo command3 arg5

(assuming subsequent commands do not execute if the previous one fails
now, which tbh I have no idea about)

It's not the most pretty syntax ever, but given i doubt it will be
humans running such a commandline I don't see the issue with this..
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)

iF4EAREIAAYFAlAHGZUACgkQ2ugaI38ACPCXNAD8DR8qHFOQnGCt2W+sOXYJDsXu
H6pnnFt09ssbuKjKHZwA/2pZxnGnXJTWGVdPySoIsJtr8Pe6Za9yeL4yQ0WHPocr
=G3H9
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [gentoo-dev] rfc: openrc init scripts taking command line arguments
  2012-07-18 20:10 ` Michał Górny
@ 2012-07-18 20:35   ` William Hubbs
  2012-07-18 21:03     ` Peter Stuge
  0 siblings, 1 reply; 14+ messages in thread
From: William Hubbs @ 2012-07-18 20:35 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 123 bytes --]

Folks,

let's move all of the discussion of this to the bug if possible so that
it is all in one place.

Thanks,

William


[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [gentoo-dev] rfc: openrc init scripts taking command line arguments
  2012-07-18 20:35   ` William Hubbs
@ 2012-07-18 21:03     ` Peter Stuge
  2012-07-18 21:09       ` Michał Górny
  0 siblings, 1 reply; 14+ messages in thread
From: Peter Stuge @ 2012-07-18 21:03 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 586 bytes --]

William Hubbs wrote:
> let's move all of the discussion of this to the bug if possible so
> that it is all in one place.

That's fine and probably good.

Note that you were the one inviting email discussion about the
change. I guess you wanted rather to focus on the question if
breaking compatibility was cool or not.

Anything web is *way* too inconvenient for me to participate without
strong interest. That may be a good thing. Anyway I've mentally
abandoned init script including openrc long ago. :)

systemd is the future, and truly a leap ahead for systems world wide.


//Peter

[-- Attachment #2: Type: application/pgp-signature, Size: 190 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [gentoo-dev] rfc: openrc init scripts taking command line arguments
  2012-07-18 21:03     ` Peter Stuge
@ 2012-07-18 21:09       ` Michał Górny
  2012-07-19  1:32         ` Jorge Manuel B. S. Vicetto
  0 siblings, 1 reply; 14+ messages in thread
From: Michał Górny @ 2012-07-18 21:09 UTC (permalink / raw
  To: gentoo-dev; +Cc: peter

[-- Attachment #1: Type: text/plain, Size: 774 bytes --]

On Wed, 18 Jul 2012 23:03:14 +0200
Peter Stuge <peter@stuge.se> wrote:

> William Hubbs wrote:
> > let's move all of the discussion of this to the bug if possible so
> > that it is all in one place.
> 
> That's fine and probably good.
> 
> Note that you were the one inviting email discussion about the
> change. I guess you wanted rather to focus on the question if
> breaking compatibility was cool or not.
> 
> Anything web is *way* too inconvenient for me to participate without
> strong interest. That may be a good thing. Anyway I've mentally
> abandoned init script including openrc long ago. :)
> 
> systemd is the future, and truly a leap ahead for systems world wide.

No, it's not. But it's a step ahead.

-- 
Best regards,
Michał Górny

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [gentoo-dev] rfc: openrc init scripts taking command line arguments
  2012-07-18 21:09       ` Michał Górny
@ 2012-07-19  1:32         ` Jorge Manuel B. S. Vicetto
  0 siblings, 0 replies; 14+ messages in thread
From: Jorge Manuel B. S. Vicetto @ 2012-07-19  1:32 UTC (permalink / raw
  To: gentoo-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 18-07-2012 21:09, Michał Górny wrote:
> On Wed, 18 Jul 2012 23:03:14 +0200 Peter Stuge <peter@stuge.se>
> wrote:
> 
>> William Hubbs wrote:
>>> let's move all of the discussion of this to the bug if possible
>>> so that it is all in one place.
>> 
>> That's fine and probably good.
>> 
>> Note that you were the one inviting email discussion about the 
>> change. I guess you wanted rather to focus on the question if 
>> breaking compatibility was cool or not.
>> 
>> Anything web is *way* too inconvenient for me to participate
>> without strong interest. That may be a good thing. Anyway I've
>> mentally abandoned init script including openrc long ago. :)
>> 
>> systemd is the future, and truly a leap ahead for systems world
>> wide.
> 
> No, it's not. But it's a step ahead.

It's obvious that to its supporters systemd is fantastic. It's also
obvious that to everyone else it's probably far from that.
Let's please try to leave systemd off this ml for some days - I for
one am getting tired of all the systemd related emails in this ml.

- -- 
Regards,

Jorge Vicetto (jmbsvicetto) - jmbsvicetto at gentoo dot org
Gentoo- forums / Userrel / Devrel / KDE / Elections / RelEng


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJQB2O/AAoJEC8ZTXQF1qEPfPsP/R5+BIZVP7qKQn5MSsmCspnC
vDPSf3CWP1OjQ6D1yeaDKWoPCSBqYg308DIgFWscR0URruC/Jd+Vdkl8B1ZztTWv
YjuJp9tiIsrhb+gAg84tbxy5YE5I+xFwAH6pfhVb5xWX9DOwNMK2KW8C41L2GArP
jPK6xtxbTWdRlElpymaskhEftVVXeNe7V48QERG26d3YXpz7D1cmSpjIeJdp7evS
rkpleFRQHSAVVfr95KIol3gi/8LSY5M5HqnuxHqJ4NwnOna2WccFY68dK71qi4Gs
ah38h7LxWwTLsaoD83Dbmu+nOzNwA07CDA7Sf2GIhHmHbd6PoJQ4D1bGUzppry9r
NvbJKmIJdut55IHNpA9QPGTWfKO116o/1caQeiIWW0j9bmPj7YaWASBLJGNkO22e
OgJT6WedFj5jWYAH4hANZLZov8s/KvtKXvyiA1Sq6fkFZi7LBhcEf7OpcaQgSBHu
NK/MiruF1kRELrbbp5yuh/KKwZDnZQY1gNW/PZuUAfe+/DGA7ZVzmFh8UquIalNR
fuLbGqViiyd06czxlnVHvscgZZ4K1dXMT0mFF6ZpmiSEboIeoKu/H3IdiZhTCyPJ
zp5w6B2MXlNkPLQQjfkPyuRkSRpbCkFxlQIN2TDWbdfJQwIVDkZ47EGyXHCN6sc6
+/IW3MuPUHS4pEoqKnJp
=pGgy
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 14+ messages in thread

* [gentoo-dev] Re: rfc: openrc init scripts taking command line arguments
  2012-07-18 20:07     ` Fabian Groffen
@ 2012-07-19  3:39       ` Duncan
  0 siblings, 0 replies; 14+ messages in thread
From: Duncan @ 2012-07-19  3:39 UTC (permalink / raw
  To: gentoo-dev

Fabian Groffen posted on Wed, 18 Jul 2012 22:07:50 +0200 as excerpted:

> Perhaps, one better makes it explicit, inspired by gdb
> 
> /etc/init.d/foo stop --args aggressive-kill=yes (and when using --args,
> I'd probably disallow using multiple commands to keep it clear what's
> going on)

++

This makes sense, especially the single command when using --args bit.

-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman




^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-07-19  3:40 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-18 19:41 [gentoo-dev] rfc: openrc init scripts taking command line arguments William Hubbs
2012-07-18 19:49 ` Peter Stuge
2012-07-18 19:53   ` Ian Stakenvicius
2012-07-18 19:58   ` Michael Mol
2012-07-18 20:06     ` Michał Górny
2012-07-18 20:07     ` Fabian Groffen
2012-07-19  3:39       ` [gentoo-dev] " Duncan
2012-07-18 20:09     ` [gentoo-dev] " William Hubbs
2012-07-18 20:16       ` Ian Stakenvicius
2012-07-18 20:10 ` Michał Górny
2012-07-18 20:35   ` William Hubbs
2012-07-18 21:03     ` Peter Stuge
2012-07-18 21:09       ` Michał Górny
2012-07-19  1:32         ` Jorge Manuel B. S. Vicetto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox