Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8230507

Findings in Debian packaging

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: internal
    • Fix Version/s: internal
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      linux

      Description

      Feedback from Mark Reinhold:

      - The resulting package does not depend upon any others, i.e., the
      `Depends:` line in its control file is empty. This can’t possibly be
      right, since the embedded JDK depends on many system libraries for
      proper operation (`libc`, `libfreetype`, `libpthread`, etc.).

      - The resulting package would install into `/opt/hello`, as expected,
      but the `/opt/hello/bin` directory would contain not just the `hello`
      application launcher but also `hello.desktop`, `hello.png`, and
      `libapplauncher.so`. These aren’t appropriate for a `bin` directory
      and should be placed elsewhere, most likely `/opt/hello/lib`.

      - The resulting package would install `/opt/hello/app` and
      `/opt/hello/runtime` directories. These are not strictly forbidden
      by the Linux FHS [1], but it’d be better to put both of them under
      `/opt/hello/lib`, per convention.

      - The resulting package would install the copyright file into
      `/usr/share/doc/hello/copyright`, which is wrong -- a package that
      installs into `/opt` should never touch anything under /usr [1]. This
      file should be at `/opt/hello/share/doc/copyright`.

      - I attempted to install the package on a fresh Ubuntu 18.04 machine:

      # dpkg -i hello-1.0.deb Selecting previously unselected package hello.
      (Reading database ... 135670 files and directories currently installed.)
      Preparing to unpack hello-1.0.deb ...
      Unpacking hello (1.0) ...
      Setting up hello (1.0) ...
      Adding shortcut to the menu
      /var/lib/dpkg/info/hello.postinst: 25: /var/lib/dpkg/info/hello.postinst: xdg-desktop-menu: not found
      dpkg: error processing package hello (--install):
      installed hello package post-installation script subprocess returned error exit status 127
      Errors were encountered while processing:
      hello
      mr-dev # uname -a
      Linux mr-dev 4.15.0-1018-oracle #20-Ubuntu SMP Wed Jul 3 06:46:12 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
      mr-dev # cat /etc/lsb-release DISTRIB_ID=Ubuntu
      DISTRIB_RELEASE=18.04
      DISTRIB_CODENAME=bionic
      DISTRIB_DESCRIPTION="Ubuntu 18.04.3 LTS"
      #
      Apparently the package should depend upon `xdg-utils`, so that its
      post-install script can find `xdg-desktop-menu`. Even better,
      though, would be for this trivial non-graphical application not to
      depend upon any desktop utilities, per my comment above.

      - Installing the package succeeded despite the above error.

      - Then I tried to uninstall it:

      mr-dev # dpkg --remove hello
      (Reading database ... 135923 files and directories currently installed.)
      Removing hello (1.0) ...
      Removing shortcut
      /var/lib/dpkg/info/hello.prerm: 25: /var/lib/dpkg/info/hello.prerm: xdg-desktop-menu: not found
      dpkg: error processing package hello (--remove):
      installed hello package pre-removal script subprocess returned error exit status 127
      Errors were encountered while processing:
      hello
      mr-dev #

      I installed `xdg-utils` by hand to get `xdg-desktop-menu`, but it still
      didn’t work:

      mr-dev # dpkg --remove hello
      (Reading database ... 136878 files and directories currently installed.)
      Removing hello (1.0) ...
      Removing shortcut
      xdg-desktop-menu: No writable system menu directory found.
      dpkg: error processing package hello (--remove):
      installed hello package pre-removal script subprocess returned error exit status 3
      Errors were encountered while processing:
      hello
      mr-dev #
      I eventually figured out how to create a fake writable system menu
      directory and was then able to remove the package.

      - The `--linux-deb-copyright` option is confusing. Its description
      should mention that if this option is specified then the `--license`
      option is, so far as I can tell, ignored.

      - The `--identifier` option appears to have no use for Debian packages.
      Perhaps this option should be package-type specific? Or at least its
      description should mention that it’s irrelevant to Debian packages.

      - I tried to create a package that would install into the `/usr`
      hierarchy by adding `--install-dir /usr` to the above command line.
      The resulting package would create a `/usr/hello` directory, with
      `app`, `bin`, and `runtime` directories under that. That’s not
      right. To install an application in the `/usr` hierarchy its command
      should go into `/usr/bin`, and libraries and other files should go
      into `/usr/lib/$APPNAME`, and documentation and copyright files
      should go into `/usr/share/doc/$APPNAME`.

      - Many of the above observations could also apply to RPM packages

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              asemenyuk Alexey Semenyuk
              Reporter:
              asemenyuk Alexey Semenyuk
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: