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

Regression: rpm install may corrupt /etc/mailcap file

    XMLWordPrintable

    Details

    • Subcomponent:
    • Introduced In Version:
      6
    • Resolved In Build:
      b05
    • CPU:
      x86
    • OS:
      linux
    • Verification:
      Verified

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "1.6.0_10"
        Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
        Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)

        ADDITIONAL OS VERSION INFORMATION :
        Linux localhost 2.4.29-0 #86 SMP Wed Oct 31 11:07:33 MSK 2007 i686 unknown

        A DESCRIPTION OF THE PROBLEM :
        The postin, postun and verify scriptlets of the rpm file declare function UpdateMailcap that contains the following line of code:

         printf "${mc_text}" > "${mailcap_file}"

        where ${mc_text} contains the updated text of /etc/mailcap file.

        If the text of the file contains any symbols that have special meaning or are not allowed in the format argument of the printf command, the file becomes corrupted or truncated.

        It is regression since 1.6.0_07. In 6u7 the line was
         echo -e "${mc_text}" > "${mailcap_file}"

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        The following snippet that is present in our /etc/mailcap file triggers the issue:

        application/pgp; gpg < %s | metamail; needsterminal; test=test %{encapsulation}=entity ; copiousoutput

          To reproduce:
        1. Add the above snippet to an existing /etc/mailcap file
        2. Login as root
        3. Install jre-6u10-linux-i586.rpm
        4. During installation an error message is printed and the file becomes corrupted


        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        1. Installation completes without any error messages.
        2. The following line is added to /etc/mailcap file:
        application/x-java-jnlp-file; /usr/bin/javaws %s
        ACTUAL -
        1. An error message is printed:
         printf: `{': invalid format character
        2. The /etc/mailcap file is truncated after the following words:
         "test=test %"

        Additional note:
        If I replace /etc/mailcap with an empty file and run the installation, it completes without errors, but the file contains the following text:
         application/x-java-jnlp-file; /usr/bin/javaws
        Note, that "%s" is missing from the line.

        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        /var/tmp/rpm-tmp.14051: printf: `{': invalid format character

        REPRODUCIBILITY :
        This bug can be reproduced always.

        CUSTOMER SUBMITTED WORKAROUND :
        1. Before installing or uninstalling JRE 6u10 rename your /etc/mailcap file (create a backup) and create an empty file instead of it.

        2. Run the installation. It should complete without errors.

        3. Restore the backup'ed copy of /etc/mailcap

        4. If you were installing, add the following line to /etc/mailcap file, if it is not already there:
        application/x-java-jnlp-file; /usr/bin/javaws %s

        5. If you were uninstalling, remove the above mentioned line from the file.

        Release Regression From : 6u7
        The above release value was the last known release where this
        bug was not reproducible. Since then there has been a regression.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                herrick Andy Herrick
                Reporter:
                ndcosta Nelson Dcosta (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: