* GPT writing of unknown partition uuids @ 2015-07-14 20:16 Scott Moser 2015-07-15 0:37 ` Dale R. Worley 2015-07-15 13:42 ` Karel Zak 0 siblings, 2 replies; 8+ messages in thread From: Scott Moser @ 2015-07-14 20:16 UTC (permalink / raw) To: util-linux Hi, I came to send the previous patch after realizing that the following is a lossy operation if the GUID type for the partition is not known to sfdisk. $ img="/tmp/my.img" $ size="100M" $ rm -f "$img" $ truncate --size "$size" "$img" $ GPT_PREP="9E1A2D38-C612-4316-AA26-8B49521E5A8B" $ PT1_UUID="7EB5EBCA-1611-431B-9C80-D87300B41B3B" $ LABEL_UUID="3C5AD185-CFBF-480D-B80C-AD089E073AC9" $ sfdisk "$img" <<EOF label: gpt label-id: $LABEL_UUID unit: sectors 1 : start=2048, size=16384, type=$GPT_PREP, uuid=$PT1_UUID EOF If sfdisk does not know the uuid provided, it silently falls back to 0FC63DAF-8483-4772-8E79-3D69D8477DE4 (Linux filesystem). It seems like if the user provided you with a GUID, sfdisk should trust them, or at very least exit failure if it refuses to use the provided GUID. Thoughts? Scott ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: GPT writing of unknown partition uuids 2015-07-14 20:16 GPT writing of unknown partition uuids Scott Moser @ 2015-07-15 0:37 ` Dale R. Worley 2015-07-15 13:28 ` Scott Moser 2015-07-15 13:42 ` Karel Zak 1 sibling, 1 reply; 8+ messages in thread From: Dale R. Worley @ 2015-07-15 0:37 UTC (permalink / raw) To: Scott Moser; +Cc: util-linux Scott Moser <smoser@ubuntu.com> writes: > If sfdisk does not know the uuid provided, it silently falls back to > 0FC63DAF-8483-4772-8E79-3D69D8477DE4 (Linux filesystem). > > It seems like if the user provided you with a GUID, sfdisk should trust > them, or at very least exit failure if it refuses to use the provided > GUID. Ugh, you're right! Silent disobedience is pernicious. Dale ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: GPT writing of unknown partition uuids 2015-07-15 0:37 ` Dale R. Worley @ 2015-07-15 13:28 ` Scott Moser 0 siblings, 0 replies; 8+ messages in thread From: Scott Moser @ 2015-07-15 13:28 UTC (permalink / raw) To: Dale R. Worley; +Cc: util-linux On Tue, 14 Jul 2015, Dale R. Worley wrote: > Scott Moser <smoser@ubuntu.com> writes: > > If sfdisk does not know the uuid provided, it silently falls back to > > 0FC63DAF-8483-4772-8E79-3D69D8477DE4 (Linux filesystem). > > > > It seems like if the user provided you with a GUID, sfdisk should trust > > them, or at very least exit failure if it refuses to use the provided > > GUID. > > Ugh, you're right! Silent disobedience is pernicious. My hack / "will this work" to fdisk_label_parse_parttype seemed to get a functional fdisk_new_unknown_parttype that would be used. diff --git a/libfdisk/src/parttype.c b/libfdisk/src/parttype.c index aedf4e8..bda850a 100644 --- a/libfdisk/src/parttype.c +++ b/libfdisk/src/parttype.c @@ -335,6 +335,7 @@ struct fdisk_parttype *fdisk_label_parse_parttype( if (ret) goto done; + typestr = str; /* maybe specified by order number */ errno = 0; i = strtol(str, &end, 0); @@ -347,7 +348,7 @@ struct fdisk_parttype *fdisk_label_parse_parttype( ret = fdisk_new_unknown_parttype(code, typestr); done: - DBG(PARTTYPE, ul_debugobj(ret, "returns parsed '%s' partition type", ret->name)); + DBG(PARTTYPE, ul_debugobj(ret, "returns parsed '%s' partition type (%s)", ret->name, ret->typestr)); return ret; } ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: GPT writing of unknown partition uuids 2015-07-14 20:16 GPT writing of unknown partition uuids Scott Moser 2015-07-15 0:37 ` Dale R. Worley @ 2015-07-15 13:42 ` Karel Zak 2015-07-15 14:56 ` Scott Moser 1 sibling, 1 reply; 8+ messages in thread From: Karel Zak @ 2015-07-15 13:42 UTC (permalink / raw) To: Scott Moser; +Cc: util-linux On Tue, Jul 14, 2015 at 04:16:56PM -0400, Scott Moser wrote: > It seems like if the user provided you with a GUID, sfdisk should trust > them, or at very least exit failure if it refuses to use the provided > GUID. > > Thoughts? It's bug, the "unknown" partition type is expected. Fixed in git tree: # sfdisk -ql /dev/sdc Device Start End Sectors Size Type /dev/sdc1 2048 1023966 1021919 499M Linux filesystem # sfdisk --part-type /dev/sdc 1 $(uuidgen) ... # sfdisk -ql /dev/sdc Device Start End Sectors Size Type /dev/sdc1 2048 1023966 1021919 499M unknown Thanks for your report! Karel -- Karel Zak <kzak@redhat.com> http://karelzak.blogspot.com ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: GPT writing of unknown partition uuids 2015-07-15 13:42 ` Karel Zak @ 2015-07-15 14:56 ` Scott Moser 2015-07-15 15:02 ` Karel Zak 2015-07-15 15:09 ` Vadim Kochan 0 siblings, 2 replies; 8+ messages in thread From: Scott Moser @ 2015-07-15 14:56 UTC (permalink / raw) To: Karel Zak; +Cc: util-linux On Wed, 15 Jul 2015, Karel Zak wrote: > On Tue, Jul 14, 2015 at 04:16:56PM -0400, Scott Moser wrote: > > It seems like if the user provided you with a GUID, sfdisk should trust > > them, or at very least exit failure if it refuses to use the provided > > GUID. > > > > Thoughts? > > It's bug, the "unknown" partition type is expected. Fixed in git tree: > > # sfdisk -ql /dev/sdc > Device Start End Sectors Size Type > /dev/sdc1 2048 1023966 1021919 499M Linux filesystem > > > # sfdisk --part-type /dev/sdc 1 $(uuidgen) > ... > > > # sfdisk -ql /dev/sdc > Device Start End Sectors Size Type > /dev/sdc1 2048 1023966 1021919 499M unknown > > > Thanks for your report! Thanks for the quick fix. Is it sane for me to assume this is fixed in any version of util-linux > 2.26.2 ? ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: GPT writing of unknown partition uuids 2015-07-15 14:56 ` Scott Moser @ 2015-07-15 15:02 ` Karel Zak 2015-07-15 15:09 ` Vadim Kochan 1 sibling, 0 replies; 8+ messages in thread From: Karel Zak @ 2015-07-15 15:02 UTC (permalink / raw) To: Scott Moser; +Cc: util-linux On Wed, Jul 15, 2015 at 10:56:48AM -0400, Scott Moser wrote: > Is it sane for me to assume this is fixed in any version of > util-linux > 2.26.2 ? Sure, I'd like to release v2.27 in Aug. Karel -- Karel Zak <kzak@redhat.com> http://karelzak.blogspot.com ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: GPT writing of unknown partition uuids 2015-07-15 14:56 ` Scott Moser 2015-07-15 15:02 ` Karel Zak @ 2015-07-15 15:09 ` Vadim Kochan 2015-07-15 15:12 ` Vadim Kochan 1 sibling, 1 reply; 8+ messages in thread From: Vadim Kochan @ 2015-07-15 15:09 UTC (permalink / raw) To: Scott Moser; +Cc: Karel Zak, util-linux On Wed, Jul 15, 2015 at 10:56:48AM -0400, Scott Moser wrote: > On Wed, 15 Jul 2015, Karel Zak wrote: > > > On Tue, Jul 14, 2015 at 04:16:56PM -0400, Scott Moser wrote: > > > It seems like if the user provided you with a GUID, sfdisk should trust > > > them, or at very least exit failure if it refuses to use the provided > > > GUID. > > > > > > Thoughts? > > > > It's bug, the "unknown" partition type is expected. Fixed in git tree: > > > > # sfdisk -ql /dev/sdc > > Device Start End Sectors Size Type > > /dev/sdc1 2048 1023966 1021919 499M Linux filesystem > > > > > > # sfdisk --part-type /dev/sdc 1 $(uuidgen) > > ... > > > > > > # sfdisk -ql /dev/sdc > > Device Start End Sectors Size Type > > /dev/sdc1 2048 1023966 1021919 499M unknown > > > > > > Thanks for your report! > Thanks for the quick fix. > > Is it sane for me to assume this is fixed in any version of > util-linux > 2.26.2 ? > -- > To unsubscribe from this list: send the line "unsubscribe util-linux" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Would you please test a following fix ? diff --git a/misc/ss.c b/misc/ss.c index 03f92fa..3a826e4 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -683,8 +683,8 @@ static inline void sock_addr_set_str(inet_prefix *prefix, char **ptr) static inline char *sock_addr_get_str(const inet_prefix *prefix) { - char *tmp ; - memcpy(&tmp, prefix->data, sizeof(char *)); + char *tmp; + memcpy(&tmp, &prefix->data[0], sizeof(char *)); return tmp; } ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: GPT writing of unknown partition uuids 2015-07-15 15:09 ` Vadim Kochan @ 2015-07-15 15:12 ` Vadim Kochan 0 siblings, 0 replies; 8+ messages in thread From: Vadim Kochan @ 2015-07-15 15:12 UTC (permalink / raw) To: Scott Moser; +Cc: Karel Zak, util-linux oops wrong place ... On Wed, Jul 15, 2015 at 6:09 PM, Vadim Kochan <vadim4j@gmail.com> wrote: > On Wed, Jul 15, 2015 at 10:56:48AM -0400, Scott Moser wrote: >> On Wed, 15 Jul 2015, Karel Zak wrote: >> >> > On Tue, Jul 14, 2015 at 04:16:56PM -0400, Scott Moser wrote: >> > > It seems like if the user provided you with a GUID, sfdisk should trust >> > > them, or at very least exit failure if it refuses to use the provided >> > > GUID. >> > > >> > > Thoughts? >> > >> > It's bug, the "unknown" partition type is expected. Fixed in git tree: >> > >> > # sfdisk -ql /dev/sdc >> > Device Start End Sectors Size Type >> > /dev/sdc1 2048 1023966 1021919 499M Linux filesystem >> > >> > >> > # sfdisk --part-type /dev/sdc 1 $(uuidgen) >> > ... >> > >> > >> > # sfdisk -ql /dev/sdc >> > Device Start End Sectors Size Type >> > /dev/sdc1 2048 1023966 1021919 499M unknown >> > >> > >> > Thanks for your report! >> Thanks for the quick fix. >> >> Is it sane for me to assume this is fixed in any version of >> util-linux > 2.26.2 ? >> -- >> To unsubscribe from this list: send the line "unsubscribe util-linux" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html > Would you please test a following fix ? > > diff --git a/misc/ss.c b/misc/ss.c > index 03f92fa..3a826e4 100644 > --- a/misc/ss.c > +++ b/misc/ss.c > @@ -683,8 +683,8 @@ static inline void sock_addr_set_str(inet_prefix *prefix, char **ptr) > > static inline char *sock_addr_get_str(const inet_prefix *prefix) > { > - char *tmp ; > - memcpy(&tmp, prefix->data, sizeof(char *)); > + char *tmp; > + memcpy(&tmp, &prefix->data[0], sizeof(char *)); > return tmp; > } > ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-07-15 15:12 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-07-14 20:16 GPT writing of unknown partition uuids Scott Moser 2015-07-15 0:37 ` Dale R. Worley 2015-07-15 13:28 ` Scott Moser 2015-07-15 13:42 ` Karel Zak 2015-07-15 14:56 ` Scott Moser 2015-07-15 15:02 ` Karel Zak 2015-07-15 15:09 ` Vadim Kochan 2015-07-15 15:12 ` Vadim Kochan
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox