Bug#880992: debian-policy should not recommend running editor using absolute path

2017-12-26 Thread Russ Allbery
Control: tags -1 = pending

Sean Whitton  writes:
> On Mon, Dec 25 2017, Russ Allbery wrote:

>>> not set, the commands "editor" and "pager" should be used,
>>> respectively. These commands can be invoked explicitly (e.g.  as
>>> /usr/bin/editor), or through a $PATH search (e.g. as editor).

>>> ?

>> This wording seems fine to me.  Seconded.  (I volunteer to turn this
>> into a Git change if it gets enough seconds.)

> Likewise seconded.

Here's what I applied:

--- a/policy/ch-customized-programs.rst
+++ b/policy/ch-customized-programs.rst
@@ -81,6 +81,8 @@ Thus, every program that launches an editor or pager must use 
the EDITOR
 or PAGER environment variable to determine the editor or pager the user
 wishes to use. If these variables are not set, the programs
 ``/usr/bin/editor`` and ``/usr/bin/pager`` should be used, respectively.
+These commands may be invoked explicitly (e.g., as ``/usr/bin/editor``) or
+via a PATH search (e.g., as ``editor``).
 
 These two files are managed through the ``dpkg`` "alternatives"
 mechanism. Every package providing an editor or pager must call the

-- 
Russ Allbery (r...@debian.org)   



Bug#880992: debian-policy should not recommend running editor using absolute path

2017-12-26 Thread Sean Whitton
Hello,

On Mon, Dec 25 2017, Russ Allbery wrote:

>>  not set, the commands "editor" and "pager" should be used,
>>  respectively. These commands can be invoked explicitly (e.g.  as
>>  /usr/bin/editor), or through a $PATH search (e.g. as editor).
>
>> ?
>
> This wording seems fine to me.  Seconded.  (I volunteer to turn this
> into a Git change if it gets enough seconds.)

Likewise seconded.

-- 
Sean Whitton


signature.asc
Description: PGP signature


Bug#880992: debian-policy should not recommend running editor using absolute path

2017-12-25 Thread Russ Allbery
Control: tags -1 patch

Jonathan Nieder  writes:

> If read strictly, this says that I must use "/usr/bin/editor" instead of
> invoking "editor" from the $PATH.  (I'm not sure I agree with that
> interpretation, but it came up in https://bugs.debian.org/682347.)
> Running "editor" from the $PATH instead of using that full path should
> be perfectly acceptable and IMHO is a better behavior, since it allows
> the user to put a custom editor in /usr/local/bin or $HOME/bin.

> Could this say something like

>   not set, the commands "editor" and "pager" should be used,
>   respectively. These commands can be invoked explicitly (e.g.
>   as /usr/bin/editor), or through a $PATH search (e.g. as
>   editor).

> ?

This wording seems fine to me.  Seconded.  (I volunteer to turn this into
a Git change if it gets enough seconds.)

-- 
Russ Allbery (r...@debian.org)   



Bug#880992: debian-policy should not recommend running editor using absolute path

2017-11-08 Thread Sean Whitton
Hello Jonathan,

On Wed, Nov 08 2017, Jonathan Nieder wrote:

> I understand and agree, but that doesn't mean that packages should
> invoke editor using an absolute path.
>
> Policy describes package behavior, not user behavior.

Right.  In this case, though, it describes package behaviour meant to
avoid getting in the way of user behaviour.

> Further, a sysadmin on a shared machine doesn't have a way to set
> EDITOR for all users, but they can install an editor command to
> /usr/local/bin/.  I've seen sysadmins at a university do something
> similar for e.g. a custom build of gcc.  It would be more robust for
> the sysadmin to use alternatives instead, but I'm just saying it's
> more polite for a package to respect what the user was trying to do.

That's a good point about /usr/local/bin/, and I think it defeats my
suggestion.  Enabling local admins to make use of /usr/local/bin/editor
is more important than enabling (unusual) users to have ~/bin/editor not
be an editor.

>>This seems sensible because 'editor' and
>> 'pager' are fairly generic terms and a user might have things in
>> ~/bin/editor or ~/bin/pager that don't edit or page, respectively.
>
> Really?  That would be a reason for the 'editor' and 'pager' commands
> to be named something else.  But on the contrary, I find 'editor' and
> 'pager' to be pretty clear names for what they do.
>
> Is there additional information or context I can provide to change
> your mind?

I should be clear that I'm not really objecting, just trying to
understand why the current wording is the way it is.

-- 
Sean Whitton


signature.asc
Description: PGP signature


Bug#880992: debian-policy should not recommend running editor using absolute path

2017-11-08 Thread Bill Allombert
On Wed, Nov 08, 2017 at 12:31:09PM -0800, Jonathan Nieder wrote:
> Hi,
> 
> Sean Whitton wrote:
> > On Mon, Nov 06 2017, Jonathan Nieder wrote:
> 
> >>Thus, every program that launches an editor or pager must use
> >>the EDITOR or PAGER environment variable to determine the editor
> >>or pager the user wishes to use. If these variables are not set,
> >>the programs /usr/bin/editor and /usr/bin/pager should be used,
> >>respectively.
> >>
> >> If read strictly, this says that I must use "/usr/bin/editor" instead
> >> of invoking "editor" from the $PATH.  (I'm not sure I agree with that
> >> interpretation, but it came up in https://bugs.debian.org/682347.)
> >> Running "editor" from the $PATH instead of using that full path should
> >> be perfectly acceptable and IMHO is a better behavior, since it allows
> >> the user to put a custom editor in /usr/local/bin or $HOME/bin.
> >
> > ISTM that the intention is for the user to set EDITOR and PAGER to
> > select an editor or pager, rather than putting things called 'editor'
> > and 'pager' into PATH.
> 
> I understand and agree, but that doesn't mean that packages should
> invoke editor using an absolute path.
> 
> Policy describes package behavior, not user behavior.
> 
> Further, a sysadmin on a shared machine doesn't have a way to set
> EDITOR for all users,

Why not ? PAM can do it, see /etc/environment?

Cheers,
-- 
Bill. 

Imagine a large red swirl here. 



Bug#880992: debian-policy should not recommend running editor using absolute path

2017-11-08 Thread Jonathan Nieder
Hi,

Sean Whitton wrote:
> On Mon, Nov 06 2017, Jonathan Nieder wrote:

>>  Thus, every program that launches an editor or pager must use
>>  the EDITOR or PAGER environment variable to determine the editor
>>  or pager the user wishes to use. If these variables are not set,
>>  the programs /usr/bin/editor and /usr/bin/pager should be used,
>>  respectively.
>>
>> If read strictly, this says that I must use "/usr/bin/editor" instead
>> of invoking "editor" from the $PATH.  (I'm not sure I agree with that
>> interpretation, but it came up in https://bugs.debian.org/682347.)
>> Running "editor" from the $PATH instead of using that full path should
>> be perfectly acceptable and IMHO is a better behavior, since it allows
>> the user to put a custom editor in /usr/local/bin or $HOME/bin.
>
> ISTM that the intention is for the user to set EDITOR and PAGER to
> select an editor or pager, rather than putting things called 'editor'
> and 'pager' into PATH.

I understand and agree, but that doesn't mean that packages should
invoke editor using an absolute path.

Policy describes package behavior, not user behavior.

Further, a sysadmin on a shared machine doesn't have a way to set
EDITOR for all users, but they can install an editor command to
/usr/local/bin/.  I've seen sysadmins at a university do something
similar for e.g. a custom build of gcc.  It would be more robust for
the sysadmin to use alternatives instead, but I'm just saying it's
more polite for a package to respect what the user was trying to do.

>This seems sensible because 'editor' and 'pager'
> are fairly generic terms and a user might have things in ~/bin/editor or
> ~/bin/pager that don't edit or page, respectively.

Really?  That would be a reason for the 'editor' and 'pager' commands
to be named something else.  But on the contrary, I find 'editor' and
'pager' to be pretty clear names for what they do.

Is there additional information or context I can provide to change
your mind?  Note that the change I am proposing is to allow packages
to invoke 'editor' from $PATH, not to require them to do so.  There
are existing packages (e.g., Git) that already do this.  This is
similar to upstream packages invoking "less" or "more" from the $PATH
instead of relying on it to be at a particular path.

Jonathan



Bug#880992: debian-policy should not recommend running editor using absolute path

2017-11-07 Thread Sean Whitton
Hello Jonathan,

On Mon, Nov 06 2017, Jonathan Nieder wrote:

>   Thus, every program that launches an editor or pager must use
>   the EDITOR or PAGER environment variable to determine the editor
>   or pager the user wishes to use. If these variables are not set,
>   the programs /usr/bin/editor and /usr/bin/pager should be used,
>   respectively.
>
> If read strictly, this says that I must use "/usr/bin/editor" instead
> of invoking "editor" from the $PATH.  (I'm not sure I agree with that
> interpretation, but it came up in https://bugs.debian.org/682347.)
> Running "editor" from the $PATH instead of using that full path should
> be perfectly acceptable and IMHO is a better behavior, since it allows
> the user to put a custom editor in /usr/local/bin or $HOME/bin.

ISTM that the intention is for the user to set EDITOR and PAGER to
select an editor or pager, rather than putting things called 'editor'
and 'pager' into PATH.  This seems sensible because 'editor' and 'pager'
are fairly generic terms and a user might have things in ~/bin/editor or
~/bin/pager that don't edit or page, respectively.

-- 
Sean Whitton


signature.asc
Description: PGP signature


Bug#880992: debian-policy should not recommend running editor using absolute path

2017-11-06 Thread Jonathan Nieder
Package: debian-policy
Version: 4.1.0.0

Policy 11.4 sayeth:

11.4. Editors and pagers

Some programs have the ability to launch an editor or pager
program to edit or display a text document. Since there are
lots of different editors and pagers available in the Debian
distribution, the system administrator and each user should
have the possibility to choose their preferred editor and pager.

In addition, every program should choose a good default
editor/pager if none is selected by the user or system
administrator.

Thus, every program that launches an editor or pager must use
the EDITOR or PAGER environment variable to determine the
editor or pager the user wishes to use. If these variables are
not set, the programs /usr/bin/editor and /usr/bin/pager
should be used, respectively.

If read strictly, this says that I must use "/usr/bin/editor" instead
of invoking "editor" from the $PATH.  (I'm not sure I agree with that
interpretation, but it came up in https://bugs.debian.org/682347.)
Running "editor" from the $PATH instead of using that full path should
be perfectly acceptable and IMHO is a better behavior, since it allows
the user to put a custom editor in /usr/local/bin or $HOME/bin.

Could this say something like

not set, the commands "editor" and "pager" should be used,
respectively. These commands can be invoked explicitly (e.g.
as /usr/bin/editor), or through a $PATH search (e.g. as
editor).

?