diff --git a/.hdparm.metadata b/.hdparm.metadata index 00c7ee3..f86bd1d 100644 --- a/.hdparm.metadata +++ b/.hdparm.metadata @@ -1 +1 @@ -b3425a141f1c0fe9f53b18631437129c2155ee45 SOURCES/hdparm-9.58.tar.gz +141f1c0fe9f53b18631437129c2155ee45 SOURCES/hdparm-9.62.tar.gz diff --git a/0001-Rebase-hdparm-to-CentOS-Stream-9-version-9.62.patch b/0001-Rebase-hdparm-to-CentOS-Stream-9-version-9.62.patch new file mode 100644 index 0000000..97e6f88 --- /dev/null +++ b/0001-Rebase-hdparm-to-CentOS-Stream-9-version-9.62.patch @@ -0,0 +1,295 @@ +From 398305a92484dfc3475e90da8fdce7e26fa62a1e Mon Sep 17 00:00:00 2001 +From: Justin Vreeland +Date: Mon, 7 Jun 2021 14:56:26 -0700 +Subject: [PATCH 1/1] Rebase hdparm to CentOS Stream 9 version 9.62 + +--- + .hdparm.metadata | 2 +- + SOURCES/hdparm-9.54-dco_calc.patch | 12 --- + .../hdparm-9.54-resourceleak-fixes-2.patch | 23 ++++++ + SOURCES/hdparm-9.54-resourceleak-fixes.patch | 81 +++++++++++++++++++ + ...atch => hdparm-9.60-ditch_dead_code.patch} | 11 ++- + SOURCES/hdparm-9.60-sysfs-fclose.patch | 13 +++ + SPECS/hdparm.spec | 43 ++++++---- + 7 files changed, 151 insertions(+), 34 deletions(-) + delete mode 100644 SOURCES/hdparm-9.54-dco_calc.patch + create mode 100644 SOURCES/hdparm-9.54-resourceleak-fixes-2.patch + create mode 100644 SOURCES/hdparm-9.54-resourceleak-fixes.patch + rename SOURCES/{hdparm-9.43-ditch_dead_code.patch => hdparm-9.60-ditch_dead_code.patch} (80%) + create mode 100644 SOURCES/hdparm-9.60-sysfs-fclose.patch + +diff --git a/.hdparm.metadata b/.hdparm.metadata +index 00c7ee3..f86bd1d 100644 +--- a/.hdparm.metadata ++++ b/.hdparm.metadata +@@ -1 +1 @@ +-b3425a141f1c0fe9f53b18631437129c2155ee45 SOURCES/hdparm-9.58.tar.gz ++141f1c0fe9f53b18631437129c2155ee45 SOURCES/hdparm-9.62.tar.gz +diff --git a/SOURCES/hdparm-9.54-dco_calc.patch b/SOURCES/hdparm-9.54-dco_calc.patch +deleted file mode 100644 +index 3f1c659..0000000 +--- a/SOURCES/hdparm-9.54-dco_calc.patch ++++ /dev/null +@@ -1,12 +0,0 @@ +-diff --color -u hdparm-9.54.orig/identify.c hdparm-9.54/identify.c +---- hdparm-9.54.orig/identify.c 2016-10-17 11:06:28.000000001 -0700 +-+++ hdparm-9.54/identify.c 2021-04-28 06:19:01.005819050 -0700 +-@@ -1488,7 +1488,7 @@ +- else if (dco[2] & (1<<0)) printf(" udma0"); +- putchar('\n'); +- +-- lba = ((((__u64)dco[5]) << 32) | (dco[4] << 16) | dco[3]) + 1; +-+ lba = ((((__u64)dco[5]) << 32) | ((__u64)dco[4] << 16) |(__u64)dco[3]) + 1U; +- printf("\tReal max sectors: %llu\n", lba); +- +- printf("\tATA command/feature sets:"); +diff --git a/SOURCES/hdparm-9.54-resourceleak-fixes-2.patch b/SOURCES/hdparm-9.54-resourceleak-fixes-2.patch +new file mode 100644 +index 0000000..2fac03a +--- /dev/null ++++ b/SOURCES/hdparm-9.54-resourceleak-fixes-2.patch +@@ -0,0 +1,23 @@ ++diff -up hdparm-9.54/hdparm.c.bak hdparm-9.54/hdparm.c ++--- hdparm-9.54/hdparm.c.bak 2020-06-01 17:56:47.257520643 +0200 +++++ hdparm-9.54/hdparm.c 2020-06-01 17:57:29.285084217 +0200 ++@@ -461,12 +461,15 @@ static void dump_identity (__u16 *idw) ++ { ++ int i; ++ char pmodes[64] = {0,}, dmodes[128]={0,}, umodes[128]={0,}; ++- char *model = strip(strndup((char *)&idw[27], 40)); ++- char *fwrev = strip(strndup((char *)&idw[23], 8)); ++- char *serno = strip(strndup((char *)&idw[10], 20)); +++ char *model = strndup((char *)&idw[27], 40); +++ char *model_s = strip(model); +++ char *fwrev = strndup((char *)&idw[23], 8); +++ char *fwrev_s = strip(fwrev); +++ char *serno = strndup((char *)&idw[10], 20); +++ char *serno_s = strip(serno); ++ __u8 tPIO; ++ ++- printf("\n Model=%.40s, FwRev=%.8s, SerialNo=%.20s", model, fwrev, serno); +++ printf("\n Model=%.40s, FwRev=%.8s, SerialNo=%.20s", model_s, fwrev_s, serno_s); ++ printf("\n Config={"); ++ for (i = 0; i <= 15; i++) { ++ if (idw[0] & (1< +@@ -22,7 +21,7 @@ Index: hdparm-9.43/sgio.c + + if (tf->command == ATA_OP_PIDENTIFY) + prefer12 = 0; +-@@ -302,14 +306,16 @@ int sg16 (int fd, int rw, int dma, struc ++@@ -306,14 +310,16 @@ int sg16 (int fd, int rw, int dma, struc + + desc = sb + 8; + if (io_hdr.driver_status != SG_DRIVER_SENSE) { +@@ -44,4 +43,4 @@ Index: hdparm-9.43/sgio.c + +#endif + } + } else if (sb[0] != 0x72 || sb[7] < 14 || desc[0] != 0x09 || desc[1] < 0x0c) { +- dump_bytes("SG_IO: bad/missing sense data, sb[]", sb, sizeof(sb)); ++ if (verbose || tf->command != ATA_OP_IDENTIFY) +diff --git a/SOURCES/hdparm-9.60-sysfs-fclose.patch b/SOURCES/hdparm-9.60-sysfs-fclose.patch +new file mode 100644 +index 0000000..0828da8 +--- /dev/null ++++ b/SOURCES/hdparm-9.60-sysfs-fclose.patch +@@ -0,0 +1,13 @@ ++diff -up hdparm-9.60/sysfs.c.bak hdparm-9.60/sysfs.c ++--- hdparm-9.60/sysfs.c.bak 2021-04-15 15:48:56.806354847 +0200 +++++ hdparm-9.60/sysfs.c 2021-04-16 14:44:42.520395436 +0200 ++@@ -61,7 +61,8 @@ static int sysfs_write_attr (char *path, ++ if (count < 0) ++ err = errno; ++ } ++- fclose(fp); +++ if (fp) +++ fclose(fp); ++ if (err && verbose) perror(path); ++ *pathtail = '\0'; ++ return err; +diff --git a/SPECS/hdparm.spec b/SPECS/hdparm.spec +index da001e7..d1f34e8 100644 +--- a/SPECS/hdparm.spec ++++ b/SPECS/hdparm.spec +@@ -1,18 +1,22 @@ + Summary: A utility for displaying and/or setting hard disk parameters + Name: hdparm +-Version: 9.58 +-Release: 2%{?dist} ++Version: 9.62 ++Release: 1%{?dist} + License: BSD + URL: https://sourceforge.net/projects/%{name}/ + Source: https://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz +-Patch0: %{name}-9.43-ditch_dead_code.patch ++Patch0: %{name}-9.60-ditch_dead_code.patch + Patch1: %{name}-9.43-close_fd.patch + Patch2: %{name}-9.43-get_geom.patch +-Patch3: %{name}-9.54-dco_calc.patch ++Patch3: %{name}-9.54-resourceleak-fixes.patch ++Patch4: %{name}-9.54-resourceleak-fixes-2.patch ++Patch5: %{name}-9.60-sysfs-fclose.patch + + BuildRequires: gcc + BuildRequires: make + ++Provides: /sbin/hdparm ++ + %description + Hdparm is a useful system utility for setting (E)IDE hard drive + parameters. For example, hdparm can be used to tweak hard drive +@@ -25,27 +29,36 @@ performance and to spin down hard drives for power conservation. + CFLAGS="$RPM_OPT_FLAGS" %make_build STRIP=/bin/true LDFLAGS="$RPM_LD_FLAGS" + + %install +-mkdir -p $RPM_BUILD_ROOT/sbin +-mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man8 +-install -c -m 755 hdparm $RPM_BUILD_ROOT/sbin/hdparm +-install -c -m 644 hdparm.8 $RPM_BUILD_ROOT/%{_mandir}/man8 ++mkdir -p $RPM_BUILD_ROOT%{_sbindir} ++mkdir -p $RPM_BUILD_ROOT%{_mandir}/man8 ++install -c -m 755 hdparm $RPM_BUILD_ROOT%{_sbindir}/hdparm ++install -c -m 644 hdparm.8 $RPM_BUILD_ROOT%{_mandir}/man8 + + + %files + %doc hdparm.lsm Changelog README.acoustic TODO + %license LICENSE.TXT +-/sbin/hdparm ++%{_sbindir}/hdparm + %{_mandir}/man8/hdparm.8* + + %changelog +-* Tue May 18 2021 Justin Vreeland - 9.58-2 +-- add dco-calc.path https://bugzilla.redhat.com/show_bug.cgi?id=1959918 ++* Mon Jun 7 2021 Justin Vreeland - 9.62-1 ++- CentOS 8 Stream Hyperscale SIG release ++ ++* Thu May 20 2021 Tomas Bzatek - 9.62-1 ++- New upstream version 9.62 (#1961841) ++ ++* Fri Apr 16 2021 Tomas Bzatek - 9.60-4 ++- Fix fclose() on sysfs file write ++ ++* Fri Apr 16 2021 Mohan Boddu - 9.60-3 ++- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 + +-* Tue Mar 2 2021 Justin Vreeland - 9.58-1 +-- Reset release to 1 for hyperscale sig ++* Thu Apr 15 2021 Tomas Bzatek - 9.60-2 ++- Move hdparm binary to /usr/sbin + +-* Tue Mar 2 2021 Justin Vreeland - 9.58-5 +-- Rebuild for CentOS-8-Stream Hyperscale ++* Fri Apr 09 2021 Tomas Bzatek - 9.60-1 ++- New upstream version 9.60 (#1947860) + + * Tue Jan 26 2021 Fedora Release Engineering - 9.58-5 + - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild +-- +2.32.0 + diff --git a/SOURCES/hdparm-9.43-ditch_dead_code.patch b/SOURCES/hdparm-9.43-ditch_dead_code.patch deleted file mode 100644 index 4f4f177..0000000 --- a/SOURCES/hdparm-9.43-ditch_dead_code.patch +++ /dev/null @@ -1,47 +0,0 @@ -Index: hdparm-9.43/sgio.c -=================================================================== ---- hdparm-9.43.orig/sgio.c -+++ hdparm-9.43/sgio.c -@@ -17,6 +17,10 @@ - - #include - -+#ifndef DEMAND_SENSE_DATA -+ #define DEMAND_SENSE_DATA 0 -+#endif -+ - extern int verbose; - extern int prefer_ata12; - -@@ -193,7 +197,7 @@ int sg16 (int fd, int rw, int dma, struc - unsigned char cdb[SG_ATA_16_LEN]; - unsigned char sb[32], *desc; - struct scsi_sg_io_hdr io_hdr; -- int prefer12 = prefer_ata12, demanded_sense = 0; -+ int prefer12 = prefer_ata12; - - if (tf->command == ATA_OP_PIDENTIFY) - prefer12 = 0; -@@ -302,14 +306,16 @@ int sg16 (int fd, int rw, int dma, struc - - desc = sb + 8; - if (io_hdr.driver_status != SG_DRIVER_SENSE) { -- if (sb[0] | sb[1] | sb[2] | sb[3] | sb[4] | sb[5] | sb[6] | sb[7] | sb[8] | sb[9]) { -- static int second_try = 0; -- if (!second_try++) -+ static int second_try = 0; -+ if (!second_try++) { -+ if (sb[0] | sb[1] | sb[2] | sb[3] | sb[4] | sb[5] | sb[6] | sb[7] | sb[8] | sb[9]) { - fprintf(stderr, "SG_IO: questionable sense data, results may be incorrect\n"); -- } else if (demanded_sense) { -- static int second_try = 0; -- if (!second_try++) -+ } -+#if DEMAND_SENSE_DATA -+ else { - fprintf(stderr, "SG_IO: missing sense data, results may be incorrect\n"); -+ } -+#endif - } - } else if (sb[0] != 0x72 || sb[7] < 14 || desc[0] != 0x09 || desc[1] < 0x0c) { - dump_bytes("SG_IO: bad/missing sense data, sb[]", sb, sizeof(sb)); diff --git a/SOURCES/hdparm-9.54-dco_calc.patch b/SOURCES/hdparm-9.54-dco_calc.patch deleted file mode 100644 index 3f1c659..0000000 --- a/SOURCES/hdparm-9.54-dco_calc.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --color -u hdparm-9.54.orig/identify.c hdparm-9.54/identify.c ---- hdparm-9.54.orig/identify.c 2016-10-17 11:06:28.000000001 -0700 -+++ hdparm-9.54/identify.c 2021-04-28 06:19:01.005819050 -0700 -@@ -1488,7 +1488,7 @@ - else if (dco[2] & (1<<0)) printf(" udma0"); - putchar('\n'); - -- lba = ((((__u64)dco[5]) << 32) | (dco[4] << 16) | dco[3]) + 1; -+ lba = ((((__u64)dco[5]) << 32) | ((__u64)dco[4] << 16) |(__u64)dco[3]) + 1U; - printf("\tReal max sectors: %llu\n", lba); - - printf("\tATA command/feature sets:"); diff --git a/SOURCES/hdparm-9.54-resourceleak-fixes-2.patch b/SOURCES/hdparm-9.54-resourceleak-fixes-2.patch new file mode 100644 index 0000000..2fac03a --- /dev/null +++ b/SOURCES/hdparm-9.54-resourceleak-fixes-2.patch @@ -0,0 +1,23 @@ +diff -up hdparm-9.54/hdparm.c.bak hdparm-9.54/hdparm.c +--- hdparm-9.54/hdparm.c.bak 2020-06-01 17:56:47.257520643 +0200 ++++ hdparm-9.54/hdparm.c 2020-06-01 17:57:29.285084217 +0200 +@@ -461,12 +461,15 @@ static void dump_identity (__u16 *idw) + { + int i; + char pmodes[64] = {0,}, dmodes[128]={0,}, umodes[128]={0,}; +- char *model = strip(strndup((char *)&idw[27], 40)); +- char *fwrev = strip(strndup((char *)&idw[23], 8)); +- char *serno = strip(strndup((char *)&idw[10], 20)); ++ char *model = strndup((char *)&idw[27], 40); ++ char *model_s = strip(model); ++ char *fwrev = strndup((char *)&idw[23], 8); ++ char *fwrev_s = strip(fwrev); ++ char *serno = strndup((char *)&idw[10], 20); ++ char *serno_s = strip(serno); + __u8 tPIO; + +- printf("\n Model=%.40s, FwRev=%.8s, SerialNo=%.20s", model, fwrev, serno); ++ printf("\n Model=%.40s, FwRev=%.8s, SerialNo=%.20s", model_s, fwrev_s, serno_s); + printf("\n Config={"); + for (i = 0; i <= 15; i++) { + if (idw[0] & (1< + ++#ifndef DEMAND_SENSE_DATA ++ #define DEMAND_SENSE_DATA 0 ++#endif ++ + extern int verbose; + extern int prefer_ata12; + +@@ -193,7 +197,7 @@ int sg16 (int fd, int rw, int dma, struc + unsigned char cdb[SG_ATA_16_LEN]; + unsigned char sb[32], *desc; + struct scsi_sg_io_hdr io_hdr; +- int prefer12 = prefer_ata12, demanded_sense = 0; ++ int prefer12 = prefer_ata12; + + if (tf->command == ATA_OP_PIDENTIFY) + prefer12 = 0; +@@ -306,14 +310,16 @@ int sg16 (int fd, int rw, int dma, struc + + desc = sb + 8; + if (io_hdr.driver_status != SG_DRIVER_SENSE) { +- if (sb[0] | sb[1] | sb[2] | sb[3] | sb[4] | sb[5] | sb[6] | sb[7] | sb[8] | sb[9]) { +- static int second_try = 0; +- if (!second_try++) ++ static int second_try = 0; ++ if (!second_try++) { ++ if (sb[0] | sb[1] | sb[2] | sb[3] | sb[4] | sb[5] | sb[6] | sb[7] | sb[8] | sb[9]) { + fprintf(stderr, "SG_IO: questionable sense data, results may be incorrect\n"); +- } else if (demanded_sense) { +- static int second_try = 0; +- if (!second_try++) ++ } ++#if DEMAND_SENSE_DATA ++ else { + fprintf(stderr, "SG_IO: missing sense data, results may be incorrect\n"); ++ } ++#endif + } + } else if (sb[0] != 0x72 || sb[7] < 14 || desc[0] != 0x09 || desc[1] < 0x0c) { + if (verbose || tf->command != ATA_OP_IDENTIFY) diff --git a/SOURCES/hdparm-9.60-sysfs-fclose.patch b/SOURCES/hdparm-9.60-sysfs-fclose.patch new file mode 100644 index 0000000..0828da8 --- /dev/null +++ b/SOURCES/hdparm-9.60-sysfs-fclose.patch @@ -0,0 +1,13 @@ +diff -up hdparm-9.60/sysfs.c.bak hdparm-9.60/sysfs.c +--- hdparm-9.60/sysfs.c.bak 2021-04-15 15:48:56.806354847 +0200 ++++ hdparm-9.60/sysfs.c 2021-04-16 14:44:42.520395436 +0200 +@@ -61,7 +61,8 @@ static int sysfs_write_attr (char *path, + if (count < 0) + err = errno; + } +- fclose(fp); ++ if (fp) ++ fclose(fp); + if (err && verbose) perror(path); + *pathtail = '\0'; + return err; diff --git a/SPECS/hdparm.spec b/SPECS/hdparm.spec index da001e7..d1f34e8 100644 --- a/SPECS/hdparm.spec +++ b/SPECS/hdparm.spec @@ -1,18 +1,22 @@ Summary: A utility for displaying and/or setting hard disk parameters Name: hdparm -Version: 9.58 -Release: 2%{?dist} +Version: 9.62 +Release: 1%{?dist} License: BSD URL: https://sourceforge.net/projects/%{name}/ Source: https://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz -Patch0: %{name}-9.43-ditch_dead_code.patch +Patch0: %{name}-9.60-ditch_dead_code.patch Patch1: %{name}-9.43-close_fd.patch Patch2: %{name}-9.43-get_geom.patch -Patch3: %{name}-9.54-dco_calc.patch +Patch3: %{name}-9.54-resourceleak-fixes.patch +Patch4: %{name}-9.54-resourceleak-fixes-2.patch +Patch5: %{name}-9.60-sysfs-fclose.patch BuildRequires: gcc BuildRequires: make +Provides: /sbin/hdparm + %description Hdparm is a useful system utility for setting (E)IDE hard drive parameters. For example, hdparm can be used to tweak hard drive @@ -25,27 +29,36 @@ performance and to spin down hard drives for power conservation. CFLAGS="$RPM_OPT_FLAGS" %make_build STRIP=/bin/true LDFLAGS="$RPM_LD_FLAGS" %install -mkdir -p $RPM_BUILD_ROOT/sbin -mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man8 -install -c -m 755 hdparm $RPM_BUILD_ROOT/sbin/hdparm -install -c -m 644 hdparm.8 $RPM_BUILD_ROOT/%{_mandir}/man8 +mkdir -p $RPM_BUILD_ROOT%{_sbindir} +mkdir -p $RPM_BUILD_ROOT%{_mandir}/man8 +install -c -m 755 hdparm $RPM_BUILD_ROOT%{_sbindir}/hdparm +install -c -m 644 hdparm.8 $RPM_BUILD_ROOT%{_mandir}/man8 %files %doc hdparm.lsm Changelog README.acoustic TODO %license LICENSE.TXT -/sbin/hdparm +%{_sbindir}/hdparm %{_mandir}/man8/hdparm.8* %changelog -* Tue May 18 2021 Justin Vreeland - 9.58-2 -- add dco-calc.path https://bugzilla.redhat.com/show_bug.cgi?id=1959918 +* Mon Jun 7 2021 Justin Vreeland - 9.62-1 +- CentOS 8 Stream Hyperscale SIG release + +* Thu May 20 2021 Tomas Bzatek - 9.62-1 +- New upstream version 9.62 (#1961841) + +* Fri Apr 16 2021 Tomas Bzatek - 9.60-4 +- Fix fclose() on sysfs file write + +* Fri Apr 16 2021 Mohan Boddu - 9.60-3 +- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 -* Tue Mar 2 2021 Justin Vreeland - 9.58-1 -- Reset release to 1 for hyperscale sig +* Thu Apr 15 2021 Tomas Bzatek - 9.60-2 +- Move hdparm binary to /usr/sbin -* Tue Mar 2 2021 Justin Vreeland - 9.58-5 -- Rebuild for CentOS-8-Stream Hyperscale +* Fri Apr 09 2021 Tomas Bzatek - 9.60-1 +- New upstream version 9.60 (#1947860) * Tue Jan 26 2021 Fedora Release Engineering - 9.58-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild