[gentoo-commits] repo/gentoo:master commit in: sys-apps/gptfdisk/files/, sys-apps/gptfdisk/

2023-06-13 Thread Marek Szuba
commit: 8fc3c52ac565e36599d32c3e43846cceac8c6e4f
Author: Marek Szuba  gentoo  org>
AuthorDate: Tue Jun 13 07:46:19 2023 +
Commit: Marek Szuba  gentoo  org>
CommitDate: Tue Jun 13 07:51:49 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8fc3c52a

sys-apps/gptfdisk: allow building against musl-1.2.4

Upstream fix backported to 1.0.9 by Violet Purcell
 inventati.org>.

Closes: https://bugs.gentoo.org/906151
Signed-off-by: Marek Szuba  gentoo.org>

 .../gptfdisk/files/gptfdisk-1.0.9-musl-1.2.4.patch | 30 ++
 sys-apps/gptfdisk/gptfdisk-1.0.9-r2.ebuild |  3 ++-
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/sys-apps/gptfdisk/files/gptfdisk-1.0.9-musl-1.2.4.patch 
b/sys-apps/gptfdisk/files/gptfdisk-1.0.9-musl-1.2.4.patch
new file mode 100644
index ..6f019d9eec6f
--- /dev/null
+++ b/sys-apps/gptfdisk/files/gptfdisk-1.0.9-musl-1.2.4.patch
@@ -0,0 +1,30 @@
+Upstream: 
https://sourceforge.net/p/gptfdisk/code/ci/7dfa8984f5a30f313d8675ff6097c8592d636d10/
+
+From 7dfa8984f5a30f313d8675ff6097c8592d636d10 Mon Sep 17 00:00:00 2001
+From: Khem Raj 
+Date: Mon, 12 Dec 2022 12:50:07 -0800
+Subject: [PATCH] Use 64bit time_t on linux as well
+
+Alias 64bit version of stat functions to original functions
+we are already passing -D_FILE_OFFSET_BITS=64 in linux Makefile
+
+Signed-off-by: Khem Raj 
+--- a/diskio-unix.cc
 b/diskio-unix.cc
+@@ -37,8 +37,12 @@
+ 
+ using namespace std;
+ 
+-#ifdef __APPLE__
++#if defined(__APPLE__) || defined(__linux__)
+ #define off64_t off_t
++#define stat64 stat
++#define fstat64 fstat
++#define lstat64 lstat
++#define lseek64 lseek
+ #endif
+ 
+ // Returns the official "real" name for a shortened version of same.
+-- 
+2.41.0
+

diff --git a/sys-apps/gptfdisk/gptfdisk-1.0.9-r2.ebuild 
b/sys-apps/gptfdisk/gptfdisk-1.0.9-r2.ebuild
index e7ed4b517d0d..94027ea21f26 100644
--- a/sys-apps/gptfdisk/gptfdisk-1.0.9-r2.ebuild
+++ b/sys-apps/gptfdisk/gptfdisk-1.0.9-r2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -33,6 +33,7 @@ DEPEND="
 PATCHES=(
"${FILESDIR}/${PN}-1.0.9-libuuid.patch" #844073
"${FILESDIR}/${PN}-1.0.9-popt_segv.patch" #872131
+   "${FILESDIR}"/${PN}-1.0.9-musl-1.2.4.patch
 )
 
 src_prepare() {



[gentoo-commits] repo/gentoo:master commit in: sys-apps/gptfdisk/files/, sys-apps/gptfdisk/

2022-09-21 Thread Marek Szuba
commit: 2dc57d72ada009425ab74d4ff46064a17d477782
Author: Marek Szuba  gentoo  org>
AuthorDate: Thu Sep 22 00:21:53 2022 +
Commit: Marek Szuba  gentoo  org>
CommitDate: Thu Sep 22 00:32:39 2022 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2dc57d72

sys-apps/gptfdisk: fix dev-libs/popt-1.19 incompatibility

Without this, starting gdisk linked against popt-1.19 fails with

Problem opening (garbage) for reading! Error is 2.
The specified file does not exist!

(assuming gptfdisk has been emerged without tests; otherwise this
does get caught by the test suite)

Closes: https://bugs.gentoo.org/872131
Signed-off-by: Marek Szuba  gentoo.org>

 .../gptfdisk/files/gptfdisk-1.0.9-popt_segv.patch  | 22 
 sys-apps/gptfdisk/gptfdisk-1.0.9-r2.ebuild | 61 ++
 2 files changed, 83 insertions(+)

diff --git a/sys-apps/gptfdisk/files/gptfdisk-1.0.9-popt_segv.patch 
b/sys-apps/gptfdisk/files/gptfdisk-1.0.9-popt_segv.patch
new file mode 100644
index ..470defd33cf6
--- /dev/null
+++ b/sys-apps/gptfdisk/files/gptfdisk-1.0.9-popt_segv.patch
@@ -0,0 +1,22 @@
+--- a/gptcl.cc
 b/gptcl.cc
+@@ -156,9 +156,10 @@
+ 
+// Assume first non-option argument is the device filename
+device = (char*) poptGetArg(poptCon);
+-   poptResetContext(poptCon);
+ 
+if (device != NULL) {
++  device = strdup(device);
++  poptResetContext(poptCon);
+   JustLooking(); // reset as necessary
+   BeQuiet(); // Tell called functions to be less verbose & interactive
+   if (LoadPartitions((string) device)) {
+@@ -498,6 +499,7 @@
+  cerr << "Error encountered; not saving changes.\n";
+  retval = 4;
+   } // if
++  free(device);
+} // if (device != NULL)
+poptFreeContext(poptCon);
+return retval;

diff --git a/sys-apps/gptfdisk/gptfdisk-1.0.9-r2.ebuild 
b/sys-apps/gptfdisk/gptfdisk-1.0.9-r2.ebuild
new file mode 100644
index ..5ccaa186a5da
--- /dev/null
+++ b/sys-apps/gptfdisk/gptfdisk-1.0.9-r2.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit flag-o-matic toolchain-funcs
+
+DESCRIPTION="GPT partition table manipulator for Linux"
+HOMEPAGE="https://www.rodsbooks.com/gdisk/;
+SRC_URI="mirror://sourceforge/${PN}/${PN}/${PV}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 
~riscv ~sparc ~x86 ~amd64-linux ~x86-linux"
+IUSE="ncurses static"
+
+# libuuid from util-linux is required.
+RDEPEND="!static? (
+   dev-libs/popt
+   ncurses? ( sys-libs/ncurses:=[unicode(+)] )
+   kernel_linux? ( sys-apps/util-linux )
+   )"
+DEPEND="
+   ${RDEPEND}
+   static? (
+   dev-libs/popt[static-libs(+)]
+   ncurses? ( sys-libs/ncurses:=[unicode(+),static-libs(+)] )
+   kernel_linux? ( sys-apps/util-linux[static-libs(+)] )
+   )
+   virtual/pkgconfig
+"
+
+PATCHES=(
+   "${FILESDIR}/${PN}-1.0.9-libuuid.patch" #844073
+   "${FILESDIR}/${PN}-1.0.9-popt_segv.patch" #872131
+)
+
+src_prepare() {
+   default
+
+   tc-export CXX PKG_CONFIG
+
+   if ! use ncurses ; then
+   sed -i \
+   -e '/^all:/s: cgdisk::' \
+   Makefile || die
+   fi
+
+   sed \
+   -e '/g++/s:=:?=:g' \
+   -e 's:-lncursesw:$(shell $(PKG_CONFIG) --libs ncursesw):g' \
+   -i Makefile || die
+
+   use static && append-ldflags -static
+}
+
+src_install() {
+   dosbin gdisk sgdisk $(usex ncurses cgdisk '') fixparts
+   doman *.8
+   dodoc NEWS README
+}



[gentoo-commits] repo/gentoo:master commit in: sys-apps/gptfdisk/files/, sys-apps/gptfdisk/

2022-05-14 Thread Lars Wendler
commit: 4d4e356d33eccb979a1df3fb79009348ecf4a3ea
Author: Lars Wendler  gentoo  org>
AuthorDate: Sat May 14 13:15:51 2022 +
Commit: Lars Wendler  gentoo  org>
CommitDate: Sat May 14 13:17:07 2022 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4d4e356d

sys-apps/gptfdisk: Revbump to fix build against recent libuuid

Reported-by: Andreas  gmail.com>
Thanks-to: Mike Gilbert  gentoo.org>
Closes: https://bugs.gentoo.org/844073
Signed-off-by: Lars Wendler  gentoo.org>

 .../gptfdisk/files/gptfdisk-1.0.9-libuuid.patch| 37 ++
 ...fdisk-1.0.9.ebuild => gptfdisk-1.0.9-r1.ebuild} |  4 +++
 2 files changed, 41 insertions(+)

diff --git a/sys-apps/gptfdisk/files/gptfdisk-1.0.9-libuuid.patch 
b/sys-apps/gptfdisk/files/gptfdisk-1.0.9-libuuid.patch
new file mode 100644
index ..e7a5f68e19ee
--- /dev/null
+++ b/sys-apps/gptfdisk/files/gptfdisk-1.0.9-libuuid.patch
@@ -0,0 +1,37 @@
+From e67faca2c0ca955f56cbd22e90941cdcbdc12597 Mon Sep 17 00:00:00 2001
+From: Rod Smith 
+Date: Sat, 16 Apr 2022 09:32:04 -0400
+Subject: [PATCH] Updated guid.cc to deal with minor change in libuuid
+
+---
+ NEWS| 3 +++
+ guid.cc | 2 +-
+ 2 files changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/NEWS b/NEWS
+index c7add56..3d90d9a 100644
+--- a/NEWS
 b/NEWS
+@@ -1,3 +1,6 @@
++
++- Updated guid.cc to deal with minor change in libuuid.
++
+ 1.0.9 (4/14/2022):
+ --
+ 
+diff --git a/guid.cc b/guid.cc
+index 1e73ab7..d3e4fd5 100644
+--- a/guid.cc
 b/guid.cc
+@@ -141,7 +141,7 @@ void GUIDData::Zero(void) {
+ void GUIDData::Randomize(void) {
+int i, uuidGenerated = 0;
+ 
+-#ifdef _UUID_UUID_H
++#if defined (_UUID_UUID_H) || defined (_UL_LIBUUID_UUID_H)
+uuid_generate(uuidData);
+ReverseBytes([0], 4);
+ReverseBytes([4], 2);
+-- 
+2.36.1
+

diff --git a/sys-apps/gptfdisk/gptfdisk-1.0.9.ebuild 
b/sys-apps/gptfdisk/gptfdisk-1.0.9-r1.ebuild
similarity index 95%
rename from sys-apps/gptfdisk/gptfdisk-1.0.9.ebuild
rename to sys-apps/gptfdisk/gptfdisk-1.0.9-r1.ebuild
index 62367d7e3bbc..1972d8a5a783 100644
--- a/sys-apps/gptfdisk/gptfdisk-1.0.9.ebuild
+++ b/sys-apps/gptfdisk/gptfdisk-1.0.9-r1.ebuild
@@ -30,6 +30,10 @@ DEPEND="
virtual/pkgconfig
 "
 
+PATCHES=(
+   "${FILESDIR}/${P}-libuuid.patch" #844073
+)
+
 src_prepare() {
default
 



[gentoo-commits] repo/gentoo:master commit in: sys-apps/gptfdisk/files/, sys-apps/gptfdisk/

2022-05-14 Thread Lars Wendler
commit: b2079544204ab5db3c2a576179ffd876bc38c4c9
Author: Lars Wendler  gentoo  org>
AuthorDate: Sat May 14 13:08:27 2022 +
Commit: Lars Wendler  gentoo  org>
CommitDate: Sat May 14 13:17:07 2022 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b2079544

sys-apps/gptfdisk: Removed old

Signed-off-by: Lars Wendler  gentoo.org>

 sys-apps/gptfdisk/Manifest |  1 -
 .../files/gptfdisk-1.0.7-remove_byteswap.patch | 50 --
 sys-apps/gptfdisk/gptfdisk-1.0.7-r2.ebuild | 60 --
 3 files changed, 111 deletions(-)

diff --git a/sys-apps/gptfdisk/Manifest b/sys-apps/gptfdisk/Manifest
index 7496e2b9a19b..ad42d3ca860a 100644
--- a/sys-apps/gptfdisk/Manifest
+++ b/sys-apps/gptfdisk/Manifest
@@ -1,3 +1,2 @@
-DIST gptfdisk-1.0.7.tar.gz 207723 BLAKE2B 
cebb0375294b4ff8f8eb522a4ae23259714d07d670a7bfbf8664586c948c1c8bee2674649a181a7c5d22f9dfe177feb7a9648ca9936c388b419faf7b52e789d8
 SHA512 
8a2067523479e34c76392571692b36e6c9eadcd0aca979f1ba09904930ed92a709bfdcdfa3369230a5ab2b5a751682dc7fb4645fb5f7f1c361ee8d28e104214c
 DIST gptfdisk-1.0.8.tar.gz 208958 BLAKE2B 
03c74c43fead13e90ff6cd42405e15db726f527801a9e3f1d5f6a83d3fa58f0f8e58b35edc1b12b0b2e6c7849b657ce4493ac67204d25309e6f63fe7f57f766b
 SHA512 
0818a238e57cf6de893da7c161e8aaf2d30ad917a47750de09967ce1d83d1abfa043465abaffdc293d058acc3fa87f8bc93a4b03c7c5d9a9ceb8f5b07331
 DIST gptfdisk-1.0.9.tar.gz 215065 BLAKE2B 
1939ffd75972a4d7f92af2bfab90c7b0223825b5478b6b808dd35af943c687d38ba81663cd7ba5e0f9400656db4dac019c13a9f75d90b7bd716568c676c24dd2
 SHA512 
c2489ac7e196cb53b9fdb18d0e421571eca43c366de8922c5c7f550aadf192558e7af69b181c30747d6cf607c1670126223465eaa5e231cc589402d94a4e97a2

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
deleted file mode 100644
index c1874d6edd7c..
--- a/sys-apps/gptfdisk/files/gptfdisk-1.0.7-remove_byteswap.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-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 < 0x1 ) {
-  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 -= 0x1 ;
-  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-r2.ebuild 
b/sys-apps/gptfdisk/gptfdisk-1.0.7-r2.ebuild
deleted file mode 100644
index df490f526b5e..
--- a/sys-apps/gptfdisk/gptfdisk-1.0.7-r2.ebuild
+++ /dev/null
@@ -1,60 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit flag-o-matic toolchain-funcs
-
-DESCRIPTION="GPT partition table manipulator for Linux"
-HOMEPAGE="https://www.rodsbooks.com/gdisk/;
-SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~mips ppc ppc64 sparc x86 
~amd64-linux ~x86-linux"
-IUSE="ncurses static"
-
-# libuuid from util-linux is required.
-RDEPEND="!static? (
-   dev-libs/popt
-   ncurses? ( sys-libs/ncurses:=[unicode(+)] )
-   kernel_linux? ( sys-apps/util-linux )
-   )"
-DEPEND="
-   ${RDEPEND}
-   static? (
-   dev-libs/popt[static-libs(+)]
-   ncurses? ( sys-libs/ncurses:=[unicode(+),static-libs(+)] )
-   

[gentoo-commits] repo/gentoo:master commit in: sys-apps/gptfdisk/files/, sys-apps/gptfdisk/

2022-04-15 Thread Lars Wendler
commit: f8752f65adb3eea72a7a116a046cb2cbb3db0184
Author: Lars Wendler  gentoo  org>
AuthorDate: Fri Apr 15 18:55:56 2022 +
Commit: Lars Wendler  gentoo  org>
CommitDate: Fri Apr 15 18:56:25 2022 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f8752f65

sys-apps/gptfdisk: Removed old

Signed-off-by: Lars Wendler  gentoo.org>

 sys-apps/gptfdisk/Manifest |  1 -
 .../gptfdisk-1.0.6.1-spurious_mbr_warnings.patch   | 71 --
 sys-apps/gptfdisk/gptfdisk-1.0.6-r2.ebuild | 60 --
 3 files changed, 132 deletions(-)

diff --git a/sys-apps/gptfdisk/Manifest b/sys-apps/gptfdisk/Manifest
index 6e283a95d464..7496e2b9a19b 100644
--- a/sys-apps/gptfdisk/Manifest
+++ b/sys-apps/gptfdisk/Manifest
@@ -1,4 +1,3 @@
-DIST gptfdisk-1.0.6.tar.gz 207017 BLAKE2B 
d00e0f00dc8dce3b6088250aa39e05f41c96bee2218eec1dca34a160e70129d1006abc4341031994c53e77068b5de510b923c69858903627ccf786f3cc848a86
 SHA512 
a3bf95c813f707d9d41513295c3419916301a0e88b4c6ade70ad7d9422a507d519e092e68a3868d53092428d159bdbb248817c4f40d8ac88b0175d5afbd79dbc
 DIST gptfdisk-1.0.7.tar.gz 207723 BLAKE2B 
cebb0375294b4ff8f8eb522a4ae23259714d07d670a7bfbf8664586c948c1c8bee2674649a181a7c5d22f9dfe177feb7a9648ca9936c388b419faf7b52e789d8
 SHA512 
8a2067523479e34c76392571692b36e6c9eadcd0aca979f1ba09904930ed92a709bfdcdfa3369230a5ab2b5a751682dc7fb4645fb5f7f1c361ee8d28e104214c
 DIST gptfdisk-1.0.8.tar.gz 208958 BLAKE2B 
03c74c43fead13e90ff6cd42405e15db726f527801a9e3f1d5f6a83d3fa58f0f8e58b35edc1b12b0b2e6c7849b657ce4493ac67204d25309e6f63fe7f57f766b
 SHA512 
0818a238e57cf6de893da7c161e8aaf2d30ad917a47750de09967ce1d83d1abfa043465abaffdc293d058acc3fa87f8bc93a4b03c7c5d9a9ceb8f5b07331
 DIST gptfdisk-1.0.9.tar.gz 215065 BLAKE2B 
1939ffd75972a4d7f92af2bfab90c7b0223825b5478b6b808dd35af943c687d38ba81663cd7ba5e0f9400656db4dac019c13a9f75d90b7bd716568c676c24dd2
 SHA512 
c2489ac7e196cb53b9fdb18d0e421571eca43c366de8922c5c7f550aadf192558e7af69b181c30747d6cf607c1670126223465eaa5e231cc589402d94a4e97a2

diff --git 
a/sys-apps/gptfdisk/files/gptfdisk-1.0.6.1-spurious_mbr_warnings.patch 
b/sys-apps/gptfdisk/files/gptfdisk-1.0.6.1-spurious_mbr_warnings.patch
deleted file mode 100644
index e60aa9feeffb..
--- a/sys-apps/gptfdisk/files/gptfdisk-1.0.6.1-spurious_mbr_warnings.patch
+++ /dev/null
@@ -1,71 +0,0 @@
-From f063fe08e424c99f133df18bf9dce49c851bcb0a Mon Sep 17 00:00:00 2001
-From: Rod Smith 
-Date: Mon, 1 Feb 2021 10:19:50 -0500
-Subject: [PATCH] Fix spurious warnings of problems on MBR disks
-

- NEWS  |  7 +++
- gpt.cc| 18 +-
- support.h |  2 +-
- 3 files changed, 21 insertions(+), 6 deletions(-)
-
-diff --git a/NEWS b/NEWS
-index f74bad0..a7131aa 100644
 a/NEWS
-+++ b/NEWS
-@@ -1,3 +1,10 @@
-+1.0.7 (?/??/2021):
-+--
-+
-+- Fixed bug that caused spurious warnings about the partition table
-+  header claiming an invalid size of partition entries when reading
-+  some MBR disks.
-+
- 1.0.6 (1/13/2021):
- --
- 
-diff --git a/gpt.cc b/gpt.cc
-index 1b4e10f..842dfb1 100644
 a/gpt.cc
-+++ b/gpt.cc
-@@ -1042,11 +1042,19 @@ int GPTData::LoadHeader(struct GPTHeader *header, 
DiskIO & disk, uint64_t sector
-*crcOk = CheckHeaderCRC();
- 
-if (tempHeader.sizeOfPartitionEntries != sizeof(GPTPart)) {
--   cerr << "Warning: Partition table header claims that the size of 
partition table\n";
--   cerr << "entries is " << tempHeader.sizeOfPartitionEntries << " bytes, 
but this program ";
--   cerr << " supports only " << sizeof(GPTPart) << "-byte entries.\n";
--   cerr << "Adjusting accordingly, but partition table may be garbage.\n";
--   tempHeader.sizeOfPartitionEntries = sizeof(GPTPart);
-+  // Print the below warning only if the CRC is OK -- but correct the
-+  // problem either way. The warning is printed only on a valid CRC
-+  // because otherwise this warning will display inappropriately when
-+  // reading MBR disks. If the CRC is invalid, then a warning about
-+  // that will be shown later, so the user will still know that
-+  // something is wrong.
-+  if (*crcOk) {
-+ cerr << "Warning: Partition table header claims that the size of 
partition table\n";
-+ cerr << "entries is " << tempHeader.sizeOfPartitionEntries << " 
bytes, but this program ";
-+ cerr << " supports only " << sizeof(GPTPart) << "-byte entries.\n";
-+ cerr << "Adjusting accordingly, but partition table may be 
garbage.\n";
-+  }
-+  tempHeader.sizeOfPartitionEntries = sizeof(GPTPart);
-}
- 
-if (allOK && (numParts != tempHeader.numParts) && *crcOk) {
-diff --git a/support.h b/support.h
-index d87fe9a..e3e1e12 100644
 a/support.h
-+++ b/support.h
-@@ -8,7 +8,7 @@
- #include 
- #include 
- 
--#define GPTFDISK_VERSION "1.0.6"
-+#define GPTFDISK_VERSION "1.0.6.1"
- 
- #if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined 

[gentoo-commits] repo/gentoo:master commit in: sys-apps/gptfdisk/files/, sys-apps/gptfdisk/

2021-07-05 Thread Lars Wendler
commit: 020a3783272ae302333d167a3ce37dc4bdfcffec
Author: Lars Wendler  gentoo  org>
AuthorDate: Mon Jul  5 12:19:53 2021 +
Commit: Lars Wendler  gentoo  org>
CommitDate: Mon Jul  5 12:20:24 2021 +
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 000..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 < 0x1 ) {
+  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 -= 0x1 ;
+  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
 



[gentoo-commits] repo/gentoo:master commit in: sys-apps/gptfdisk/files/, sys-apps/gptfdisk/

2021-02-14 Thread Lars Wendler
commit: e6c25c10b42a2e0d7c926bded8c7babe93fa320c
Author: Lars Wendler  gentoo  org>
AuthorDate: Sun Feb 14 18:06:17 2021 +
Commit: Lars Wendler  gentoo  org>
CommitDate: Sun Feb 14 18:06:38 2021 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e6c25c10

sys-apps/gptfdisk: Revbump to fix spurious MBR warnings

Package-Manager: Portage-3.0.14, Repoman-3.0.2
Signed-off-by: Lars Wendler  gentoo.org>

 .../gptfdisk-1.0.6.1-spurious_mbr_warnings.patch   | 71 ++
 sys-apps/gptfdisk/gptfdisk-1.0.6-r1.ebuild | 60 ++
 2 files changed, 131 insertions(+)

diff --git 
a/sys-apps/gptfdisk/files/gptfdisk-1.0.6.1-spurious_mbr_warnings.patch 
b/sys-apps/gptfdisk/files/gptfdisk-1.0.6.1-spurious_mbr_warnings.patch
new file mode 100644
index 000..e60aa9feeff
--- /dev/null
+++ b/sys-apps/gptfdisk/files/gptfdisk-1.0.6.1-spurious_mbr_warnings.patch
@@ -0,0 +1,71 @@
+From f063fe08e424c99f133df18bf9dce49c851bcb0a Mon Sep 17 00:00:00 2001
+From: Rod Smith 
+Date: Mon, 1 Feb 2021 10:19:50 -0500
+Subject: [PATCH] Fix spurious warnings of problems on MBR disks
+
+---
+ NEWS  |  7 +++
+ gpt.cc| 18 +-
+ support.h |  2 +-
+ 3 files changed, 21 insertions(+), 6 deletions(-)
+
+diff --git a/NEWS b/NEWS
+index f74bad0..a7131aa 100644
+--- a/NEWS
 b/NEWS
+@@ -1,3 +1,10 @@
++1.0.7 (?/??/2021):
++--
++
++- Fixed bug that caused spurious warnings about the partition table
++  header claiming an invalid size of partition entries when reading
++  some MBR disks.
++
+ 1.0.6 (1/13/2021):
+ --
+ 
+diff --git a/gpt.cc b/gpt.cc
+index 1b4e10f..842dfb1 100644
+--- a/gpt.cc
 b/gpt.cc
+@@ -1042,11 +1042,19 @@ int GPTData::LoadHeader(struct GPTHeader *header, 
DiskIO & disk, uint64_t sector
+*crcOk = CheckHeaderCRC();
+ 
+if (tempHeader.sizeOfPartitionEntries != sizeof(GPTPart)) {
+-   cerr << "Warning: Partition table header claims that the size of 
partition table\n";
+-   cerr << "entries is " << tempHeader.sizeOfPartitionEntries << " bytes, 
but this program ";
+-   cerr << " supports only " << sizeof(GPTPart) << "-byte entries.\n";
+-   cerr << "Adjusting accordingly, but partition table may be garbage.\n";
+-   tempHeader.sizeOfPartitionEntries = sizeof(GPTPart);
++  // Print the below warning only if the CRC is OK -- but correct the
++  // problem either way. The warning is printed only on a valid CRC
++  // because otherwise this warning will display inappropriately when
++  // reading MBR disks. If the CRC is invalid, then a warning about
++  // that will be shown later, so the user will still know that
++  // something is wrong.
++  if (*crcOk) {
++ cerr << "Warning: Partition table header claims that the size of 
partition table\n";
++ cerr << "entries is " << tempHeader.sizeOfPartitionEntries << " 
bytes, but this program ";
++ cerr << " supports only " << sizeof(GPTPart) << "-byte entries.\n";
++ cerr << "Adjusting accordingly, but partition table may be 
garbage.\n";
++  }
++  tempHeader.sizeOfPartitionEntries = sizeof(GPTPart);
+}
+ 
+if (allOK && (numParts != tempHeader.numParts) && *crcOk) {
+diff --git a/support.h b/support.h
+index d87fe9a..e3e1e12 100644
+--- a/support.h
 b/support.h
+@@ -8,7 +8,7 @@
+ #include 
+ #include 
+ 
+-#define GPTFDISK_VERSION "1.0.6"
++#define GPTFDISK_VERSION "1.0.6.1"
+ 
+ #if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined 
(__APPLE__)
+ // Darwin (Mac OS) & FreeBSD: disk IOCTLs are different, and there is no 
lseek64
+-- 
+2.30.1
+

diff --git a/sys-apps/gptfdisk/gptfdisk-1.0.6-r1.ebuild 
b/sys-apps/gptfdisk/gptfdisk-1.0.6-r1.ebuild
new file mode 100644
index 000..ee9f1782ded
--- /dev/null
+++ b/sys-apps/gptfdisk/gptfdisk-1.0.6-r1.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit flag-o-matic toolchain-funcs
+
+DESCRIPTION="GPT partition table manipulator for Linux"
+HOMEPAGE="https://www.rodsbooks.com/gdisk/;
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 
~amd64-linux ~x86-linux"
+IUSE="kernel_linux ncurses static"
+
+# libuuid from util-linux is required.
+RDEPEND="!static? (
+   dev-libs/popt
+   ncurses? ( >=sys-libs/ncurses-5.7-r7:0=[unicode] )
+   kernel_linux? ( sys-apps/util-linux )
+   )"
+DEPEND="
+   ${RDEPEND}
+   static? (
+   dev-libs/popt[static-libs(+)]
+   ncurses? ( >=sys-libs/ncurses-5.7-r7:0=[unicode,static-libs(+)] 
)
+   kernel_linux? ( sys-apps/util-linux[static-libs(+)] )
+   )
+   virtual/pkgconfig
+"
+
+PATCHES=(
+   "${FILESDIR}/${P}.1-spurious_mbr_warnings.patch"
+)
+
+src_prepare() {
+