Bug 1066184

Summary: sgdisk will not create, name, type a partition in the same command line
Product: [Fedora] Fedora Reporter: Robert Strickler <bugz.to.anomalyst>
Component: gdiskAssignee: Terje Røsten <terje.rosten>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 20CC: orion, rodsmith, terje.rosten
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: gdisk-0.8.10-2.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-03-25 08:18:02 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 Robert Strickler 2014-02-17 23:21:18 UTC
Description of problem:
sgdisk 

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


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:
a new partition with the requested label

Additional info:
There needs to be a metavalue (e.g. "." [dot]") to indicate the last selected partition (especially for a previously given "0:" argument 
Shell Script below demonstrates the failure and a clunky workaround
except partition type is never changed

#!/bin/bash
TDN=/dev/sdc                            #Target Device Name CHANGEME!
TVN=rpial                               #Target Volume Name
TOLD=/tmp/$TVN-old                      #save current partition layout
TNEW=/tmp/$TVN-new                      #save revised layout
PAL="$TDN unit s print"                 #parted arg list

#sgdisk $TDN --zap-all                  #DESTROY existing partitions!
parted -s --machine $PAL >$TOLD         #save current partition

sgdisk --new=0:0:+160M $TDN --change-name=0:$TVN --typecode=0:0700

#The above line should create, label and type the new partition but does not
#======================== result shown by cgdisk =======================
#Part. #     Size        Partition Type            Partition Name
#----------------------------------------------------------------
#   2        160.0 MiB   Linux filesystem

parted -s --machine $PAL >$TNEW
TDP=`diff -e $TOLD $TNEW | cut -s -d ":" -f 1`
sgdisk --change-name=$TDP:$TVN --typecode=$TDP:0700 -p $TDN
partprobe                 #reread partition table
parted -s $TDN print
#partion type is never updated

Comment 1 Terje Røsten 2014-03-02 15:59:24 UTC
Thanks for your report.

Comment 2 Rod Smith 2014-03-02 16:41:31 UTC
This is a wish-list item, not a bug per se. Nonetheless, I've added the ability to accept a "0" value to the -A, -c, -t, and -u options to sgdisk when a -n option existed earlier on the same command line. This is in git right now, and I expect to make a 0.8.10 release later today that will incorporate this improvement.

Comment 3 Robert Strickler 2014-03-02 19:25:17 UTC
sgdisk --change-name=$TDP:$TVN --typecode=$TDP:0700 -p $TDN
partprobe                 #reread partition table
parted -s $TDN print
change/show the 0700 type update now as well?

Comment 4 Rod Smith 2014-03-02 20:12:42 UTC
parted doesn't show most partitition type codes directly. SOME type codes it displays as "flags," but that's true for only a few type codes. The stock parted 3.1 doesn't show flags for what GPT fdisk identifies as type 0700 or type 8300, so the change from one of those to the other doesn't show up in parted. There is a patch to parted that's been languishing for years that will show that up as a flag -- what gdisk calls a type-0700 partition with have a "msftdata" flag set. (See http://lists.gnu.org/archive/html/bug-parted/2011-06/msg00026.html for the parted developers' discussion of this issue.) This patch is present in some distributions' parted releases, but IIRC Fedora hasn't yet picked it up. It should also make it into the next full release of parted. It's been 2 years (to the day! -- I just looked it up) since a regular parted release, so one is definitely overdue.

If you want changes in parted, you should file a bug against it.

Comment 5 Fedora Update System 2014-03-08 14:30:41 UTC
gdisk-0.8.10-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/FEDORA-2014-3330/gdisk-0.8.10-1.fc20

Comment 6 Fedora Update System 2014-03-09 04:32:42 UTC
Package gdisk-0.8.10-1.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing gdisk-0.8.10-1.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-3330/gdisk-0.8.10-1.fc20
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2014-03-25 08:18:02 UTC
gdisk-0.8.10-2.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2014-03-25 08:19:26 UTC
gdisk-0.8.10-2.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Robert Strickler 2014-03-25 08:31:30 UTC
just curious, was the qa unit test revised to test this enhancement to prevent regression? I dont me to be insulting, I am ignorant of the fedora qa loop and seek enlightenment.

Comment 10 Terje Røsten 2014-03-25 17:28:34 UTC
fedora don't add tests, if upstream provides test which are possible to run in the build enviroment (koji) packager normally try to run those tests. did that help you?