From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 97E3613933E for ; Mon, 5 Jul 2021 12:20:39 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 846FDE09E5; Mon, 5 Jul 2021 12:20:37 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 4104EE09E5 for ; Mon, 5 Jul 2021 12:20:37 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D3ACE335D7B for ; Mon, 5 Jul 2021 12:20:35 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id EA97563F for ; Mon, 5 Jul 2021 12:20:33 +0000 (UTC) From: "Lars Wendler" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Lars Wendler" Message-ID: <1625487624.020a3783272ae302333d167a3ce37dc4bdfcffec.polynomial-c@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/gptfdisk/files/, sys-apps/gptfdisk/ X-VCS-Repository: repo/gentoo X-VCS-Files: sys-apps/gptfdisk/files/gptfdisk-1.0.7-remove_byteswap.patch sys-apps/gptfdisk/gptfdisk-1.0.7.ebuild X-VCS-Directories: sys-apps/gptfdisk/files/ sys-apps/gptfdisk/ X-VCS-Committer: polynomial-c X-VCS-Committer-Name: Lars Wendler X-VCS-Revision: 020a3783272ae302333d167a3ce37dc4bdfcffec X-VCS-Branch: master Date: Mon, 5 Jul 2021 12:20:33 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 2e849fbc-1932-4d59-8b74-3396c551814d X-Archives-Hash: 81c74e86ef6576376a05662aea390348 commit: 020a3783272ae302333d167a3ce37dc4bdfcffec Author: Lars Wendler gentoo org> AuthorDate: Mon Jul 5 12:19:53 2021 +0000 Commit: Lars Wendler gentoo org> CommitDate: Mon Jul 5 12:20:24 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=020a3783 sys-apps/gptfdisk: Added a patch to remove byteswap Closes: https://bugs.gentoo.org/797412 Signed-off-by: Lars Wendler gentoo.org> .../files/gptfdisk-1.0.7-remove_byteswap.patch | 50 ++++++++++++++++++++++ sys-apps/gptfdisk/gptfdisk-1.0.7.ebuild | 4 ++ 2 files changed, 54 insertions(+) diff --git a/sys-apps/gptfdisk/files/gptfdisk-1.0.7-remove_byteswap.patch b/sys-apps/gptfdisk/files/gptfdisk-1.0.7-remove_byteswap.patch new file mode 100644 index 00000000000..c1874d6edd7 --- /dev/null +++ b/sys-apps/gptfdisk/files/gptfdisk-1.0.7-remove_byteswap.patch @@ -0,0 +1,50 @@ +From fded770b55fdb3a201ad515d785c17ac35705652 Mon Sep 17 00:00:00 2001 +From: Erik Larsson +Date: Tue, 8 Jun 2021 16:11:21 +0300 +Subject: [PATCH] gptpart.cc: Remove byteswap commands in + GPTPart::SetName(const string&). + +The byteswapping done in GPTPart::SetName(const string&) was reversed +later when GPTPart::ReversePartBytes() was called. + +The intended design seems to have been to keep the fields in native +endianness until just before the partition is written to disk when all +the GPTPart data is byteswapped all at once with a call to +GPTPart::ReversePartBytes(). +However this was defeated by leaving the original byteswaps in there and +effectively the name was swapped back to the native-endian form. For big +endian systems this meant that a UTF-16BE string was written to disk, +violating the specification and causing interoperability problems. + +Fixed by removing these inline byteswaps in GPTPart::SetName(const +string&). +--- + gptpart.cc | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/gptpart.cc b/gptpart.cc +index 81bbcf0..841140a 100644 +--- a/gptpart.cc ++++ b/gptpart.cc +@@ -242,7 +242,6 @@ void GPTPart::SetName(const string & theName) { + // then to utf16le + if ( uni < 0x10000 ) { + name[ pos ] = (uint16_t) uni ; +- if ( ! IsLittleEndian() ) ReverseBytes( name + pos , 2 ) ; + pos ++ ; + } // if + else { +@@ -252,10 +251,8 @@ void GPTPart::SetName(const string & theName) { + } // if + uni -= 0x10000 ; + name[ pos ] = (uint16_t)( uni >> 10 ) | 0xd800 ; +- if ( ! IsLittleEndian() ) ReverseBytes( name + pos , 2 ) ; + pos ++ ; + name[ pos ] = (uint16_t)( uni & 0x3ff ) | 0xdc00 ; +- if ( ! IsLittleEndian() ) ReverseBytes( name + pos , 2 ) ; + pos ++ ; + } + } // for +-- +2.32.0 + diff --git a/sys-apps/gptfdisk/gptfdisk-1.0.7.ebuild b/sys-apps/gptfdisk/gptfdisk-1.0.7.ebuild index 9093cf2c58d..d34745b703b 100644 --- a/sys-apps/gptfdisk/gptfdisk-1.0.7.ebuild +++ b/sys-apps/gptfdisk/gptfdisk-1.0.7.ebuild @@ -30,6 +30,10 @@ DEPEND=" " BDEPEND="virtual/pkgconfig" +PATCHES=( + "${FILESDIR}/${P}-remove_byteswap.patch" #797412 +) + src_prepare() { default