Bug 1294407

Summary: /usr/sbin/grub2-setpassword from grub2-tools-2.02-0.25.fc23.x86_64 incorrectly implements the custom output option
Product: [Fedora] Fedora Reporter: major <major>
Component: grub2Assignee: rmarshall
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 23CC: bcl, lkundrak, mads, pjones
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-02-22 20:23:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description major 2015-12-28 04:51:37 UTC
Description of problem:
/usr/sbin/grub2-setpassword from grub2-tools-2.02-0.25.fc23.x86_64 incorrectly implements the custom output option. The following diff changes should be implemented. I have not exhaustively tested the changes.

####################
[root@chariot ~]# diff -u /usr/sbin/grub2-setpassword.BAD /usr/sbin/grub2-setpassword
--- /usr/sbin/grub2-setpassword.BAD     2015-12-10 14:04:26.000000000 -0600
+++ /usr/sbin/grub2-setpassword 2015-12-27 22:35:36.609321870 -0600
@@ -1,7 +1,7 @@
 #!/bin/sh -e
 
 if [ -d /sys/firmware/efi/efivars/ ]; then
-    grubdir=`echo "/boot/efi/EFI/redhat/" | sed 's,//*,/,g'`
+    grubdir=`echo "/boot/efi/EFI/fedora/" | sed 's,//*,/,g'`
 else
     grubdir=`echo "/boot/grub2" | sed 's,//*,/,g'`
 fi
@@ -61,10 +61,10 @@
     -v | --version)
        echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
        exit 0 ;;
-    -o | --output)
+    -o | --output_path)
         OUTPUT_PATH=`argument $option "$@"`; shift ;;
-    --output=*)
-        OUTPUT_PATH=`echo "$option" | sed 's/--output=//'` ;;
+    --output_path=*)
+        OUTPUT_PATH=`echo "$option" | sed 's/--output_path=//'` ;;
     -o=*)
         OUTPUT_PATH=`echo "$option" | sed 's/-o=//'` ;;
     esac
@@ -118,6 +118,6 @@
 
 # on the ESP, these will fail to set the permissions, but it's okay because
 # the directory is protected.
-install -m 0600 /dev/null "${grubdir}/user.cfg" 2>/dev/null || :
-chmod 0600 "${grubdir}/user.cfg" 2>/dev/null || :
-echo "GRUB2_PASSWORD=${MYPASS}" > "${grubdir}/user.cfg"
+install -m 0600 /dev/null "${OUTPUT_PATH}/user.cfg" 2>/dev/null || :
+chmod 0600 "${OUTPUT_PATH}/user.cfg" 2>/dev/null || :
+echo "GRUB2_PASSWORD=${MYPASS}" > "${OUTPUT_PATH}/user.cfg"
####################

Version-Release number of selected component (if applicable):
grub2-tools-2.02-0.25.fc23.x86_64

Comment 1 rmarshall 2016-02-22 20:23:55 UTC

*** This bug has been marked as a duplicate of bug 1292336 ***