[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#682347: resurrect editor virtual package name



Russ Allbery <rra@debian.org> writes:

> 2. Document editor and recommend everyone implement it properly.  Since
>    we're going to allow packages to depend on editor, I think providing
>    it would need to be a should, so that's going to be a lot of buggy
>    (but not RC-buggy) editor packages.  But it would get us to a clean
>    dependency system.  (I will leave it to someone else to tackle this
>    for pager if someone really wants to.)

When I let the ball drop on this three years ago, there was a consensus
that this option was the way to go.  Picking this up again, here is a
proposed Policy change to document the editor and default-editor virtual
packages.

Note that this would make quite a few packages buggy (but not RC-buggy)
since they don't Provide: editor although they participate in the
/usr/bin/editor alternative.  This was considered reasonable since it
would be cleaning up the dependency structure and the bug is fairly minor
and can be dealt with when those maintainers have a chance.

I'm looking for seconds for this diff.  It documents the status quo for
/usr/bin/pager; if we want to make a similar cleanup there, we can do that
as a separate bug.

-- 
Russ Allbery (rra@debian.org)              <https://www.eyrie.org/~eagle/>

diff --git a/policy/ch-customized-programs.rst b/policy/ch-customized-programs.rst
index 747df56..27abebd 100644
--- a/policy/ch-customized-programs.rst
+++ b/policy/ch-customized-programs.rst
@@ -93,21 +93,30 @@ alternative should have a slave alternative for
 ``/usr/share/man/man1/pager.1.gz`` pointing to the corresponding manual
 page.
 
-If it is very hard to adapt a program to make use of the EDITOR or PAGER
-variables, that program may be configured to use
-``/usr/bin/sensible-editor`` and ``/usr/bin/sensible-pager`` as the
-editor or pager program respectively. These are two scripts provided in
-the sensible-utils package that check the EDITOR and PAGER variables and
+Packages that register as an alternative for ``/usr/bin/editor`` should
+also provide the virtual package ``editor`` by including it in the
+``Provides`` control field. The package providing the current default
+editor for the Debian base system, and only that package, should also
+provide the ``default-editor`` virtual package. Packages that call
+``editor`` directly (not via ``sensible-editor`` or the EDITOR environment
+variable) should depend on ``default-editor | editor``.
+
+Programs may assume that ``/usr/bin/pager`` is available as a fallback
+without adding an explicit package dependency. There is no ``pager``
+virtual package.
+
+If it is difficult to adapt a program to use the EDITOR or PAGER
+variables, that program may instead be configured to use
+``/usr/bin/sensible-editor`` and ``/usr/bin/sensible-pager`` as the editor
+or pager program respectively. These are scripts provided by the
+``sensible-utils`` package that check the EDITOR and PAGER variables and
 launch the appropriate program, and fall back to ``/usr/bin/editor`` and
-``/usr/bin/pager`` if the variable is not set.
+``/usr/bin/pager`` if the variable is not set. Packages using these
+scripts should declare an appropriate dependency on ``sensible-utils``.
 
 A program may also use the VISUAL environment variable to determine the
 user's choice of editor. If it exists, it should take precedence over
-EDITOR. This is in fact what ``/usr/bin/sensible-editor`` does.
-
-It is not required for a package to depend on ``editor`` and ``pager``,
-nor is it required for a package to provide such virtual
-packages. [#]_
+EDITOR. This is also what ``/usr/bin/sensible-editor`` does.
 
 .. _s-web-appl:
 
@@ -573,10 +582,6 @@ installed in ``/usr/share/man/man6``.
    portion is handled internally by the package system based on the os
    and cpu.
 
-.. [#]
-   The Debian base system already provides an editor and a pager
-   program.
-
 .. [#]
    If it is not possible to establish both locks, the system shouldn't
    wait for the second lock to be established, but remove the first
diff --git a/virtual-package-names-list.yaml b/virtual-package-names-list.yaml
index 2a9857a..6c0b59e 100644
--- a/virtual-package-names-list.yaml
+++ b/virtual-package-names-list.yaml
@@ -100,6 +100,14 @@ virtualPackages:
 
 # System
 
+ - name: default-editor
+   description: default base system /usr/bin/editor
+   alternatives:
+     - /usr/bin/editor
+ - name: editor
+   description: suitable /usr/bin/editor
+   alternatives:
+     - /usr/bin/editor
  - name: flexmem
    description: anything that can access flexible memory via the OBEX Protocol
  - name: foomatic-data
@@ -457,3 +465,7 @@ virtualPackages:
 #               Added default-dbus-session-bus
 #   15 Feb 2019 Added logind
 #               Added default-logind
+#
+# Russ Allbery:
+#   01 Apr 2021 Added editor
+#               Added default-editor

Reply to: