Bug 606625 - Output of 'plymouth-set-default-theme' is incorrect when no theme is set
Summary: Output of 'plymouth-set-default-theme' is incorrect when no theme is set
Alias: None
Product: Fedora
Classification: Fedora
Component: plymouth   
(Show other bugs)
Version: 13
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Ray Strode [halfline]
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2010-06-22 06:19 UTC by Bruce Jerrick
Modified: 2010-10-19 20:43 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2010-10-19 20:43:49 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
FreeDesktop.org 606634 None None None Never

Description Bruce Jerrick 2010-06-22 06:19:04 UTC
Description of problem:
When no plymouth theme is set, 'plymouth-set-default-theme' returns ".plymouth",
and that causes errors in 'plymouth-populate-initrd', because the latter expects
blank output from 'plymouth-set-default-theme' in this case.

(And when 'plymouth-populate-initrd' soldiers on instead of exiting, the error
message it ultimately produces is somewhat nonsensical.)

Despite the verbosity of this report, the fix is trivial -- see FIX in
"Additional info" below.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
Some conditions have to be met:
    1. The contents of /etc/plymouth/plymouthd.conf have to be original, i.e.:

	# Administrator customizations go in this file

    2. Package plymouth-theme-charge has to be *not* installed (reason is given
       at end of "Additional info" below).

    3. /usr/share/plymouth/themes/default.plymouth must not exist (typically
       a symlink to something like text/text.plymouth, set automagically by
       something I haven't figured out yet; it didn't happen at my F13 OS

Then, run (with no args):
Actual results:

As a result, when 'plymouth-populate-initrd' is run during a kernel upgrade,
it produces:

    grep: /usr/share/plymouth/themes/.plymouth/.plymouth.plymouth: \
	No such file or directory
    The default plymouth plugin () doesn't exist

Expected results:
No output -- that is what 'plymouth-populate-initrd' expects when no default
theme is set (see "Additional info" below).

Additional info:
(I haven't given full pathnames of the scripts involved, for brevity; they're
easily found with 'locate' or 'rpmls'.)

Just add double quotes around the first arg (the readlink return) in
the basename call in the get_default_theme function in
There's a patch attached that does this.  (Just as a matter of coding practice
it also does the same thing to an earlier instance of 'basename', but that's
not strictly necessary.)
Note that in the F12 version there are further instances of 'basename' that
should also be fixed.

For those interested in the pathology:

The problem lies in the following code from 'plymouth-set-default-theme' (in
  function get_default_theme):

  THEME_NAME=$(basename \
    $(readlink ${PLYMOUTH_DATADIR}/plymouth/themes/default.plymouth) .plymouth)

which returns ".plymouth" if .../default.plymouth does not exist (basename sees 
".plymouth" as its only argument).

The problem caused by using ".plymouth" in 'plymouth-populate-initrd' is shown
in the following code from that script.  It does not work as intended; it
expects a blank return from 'plymouth-set-default-theme' when no theme is set:

  ... PLYMOUTH_THEME_NAME=$(plymouth-set-default-theme)
  if [ -z "$PLYMOUTH_THEME_NAME" ]; then
      echo "No default plymouth plugin is set" > /dev/stderr

(BTW, "No default plymouth theme is set" would be more to the point.)
Why the plymouth-theme-charge package has to be not installed:
  If /usr/share/plymouth/themes/charge/charge.plymouth exists,
  that will be reported as the default theme (being set as such
  in /usr/share/plymouth/plymouthd.defaults).


Comment 1 Ray Strode [halfline] 2010-10-19 20:43:49 UTC
This was fixed upstream a while back:


[set-default-theme] Properly quote arguments to basename
It's important to make sure the theme name is properly quoted when passed to the basename command. This is because, if the theme name is empty we want the empty string returned, not the suffix that would otherwise be stripped off. Some discussion here: https://bugzilla.redhat.com/show_bug.cgi?id=606634

Note You need to log in before you can comment on or make changes to this bug.