Browse Source

initial package creation

Signed-off-by: Toshaan Bharvani <toshaan@powerel.org>
master
Toshaan Bharvani 10 months ago
commit
b373d06172
  1. 50
      SOURCES/0001-src-pamix_ui.cpp-always-use-s-style-format-for-print.patch
  2. 43
      SOURCES/0002-src-pamix_ui.cpp-fix-d-zu-printf-confusion.patch
  3. 70
      SPECS/pamix.spec

50
SOURCES/0001-src-pamix_ui.cpp-always-use-s-style-format-for-print.patch

@ -0,0 +1,50 @@ @@ -0,0 +1,50 @@
From 3400b9c048706c572373e4617b4d5fcdb8dd2505 Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyich@gmail.com>
Date: Mon, 6 Dec 2021 08:02:22 +0000
Subject: [PATCH 1/2] src/pamix_ui.cpp: always use "%s"-style format for
printf()-style functions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

`ncuses-6.3` added printf-style function attributes and now makes
it easier to catch cases when user input is used in palce of format
string when built with CFLAGS=-Werror=format-security:

PAmix/src/pamix_ui.cpp:106:52:
error: format not a string literal and no format arguments [-Werror=format-security]
106 | mvprintw(lineNumber++, 1, applicationName.c_str());
| ^

Let's wrap all the missing places with "%s" format.

Signed-off-by: Petr Šabata <contyk@redhat.com>
---
src/pamix_ui.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/pamix_ui.cpp b/src/pamix_ui.cpp
index c1acb2b..423d2ba 100644
--- a/src/pamix_ui.cpp
+++ b/src/pamix_ui.cpp
@@ -103,7 +103,7 @@ void pamix_ui::redrawAll() {
string_maxlen_pct(applicationName, 0.4);
if (isSelectedEntry)
attron(A_STANDOUT);
- mvprintw(lineNumber++, 1, applicationName.c_str());
+ mvprintw(lineNumber++, 1, "%s", applicationName.c_str());
attroff(A_STANDOUT);
bool isMuted = entry->m_Mute || averageVolume == PA_VOLUME_MUTED;
@@ -121,7 +121,7 @@ void pamix_ui::redrawAll() {
remainingChars -= displayName.length();
}
- mvprintw(curY, curX + remainingChars + 1, displayName.c_str());
+ mvprintw(curY, curX + remainingChars + 1, "%s", displayName.c_str());
lineNumber++;
}
--
2.38.1

43
SOURCES/0002-src-pamix_ui.cpp-fix-d-zu-printf-confusion.patch

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
From 5ef67fc5ef6fc0dc0b48ff07ba48093881561d9c Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyich@gmail.com>
Date: Mon, 6 Dec 2021 08:04:49 +0000
Subject: [PATCH 2/2] src/pamix_ui.cpp: fix %d/%zu printf() confusion
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

`ncuses-6.3` added printf-style function attributes and now makes
it easier to catch cases when user input is used in palce of format
string. Current PAmix warns as:

PAmix/src/pamix_ui.cpp: In member function 'void pamix_ui::drawHeader() const':
PAmix/src/pamix_ui.cpp:187:22: warning: format '%d' expects argument of type 'int', but argument 5 has type 'std::map<unsigned int, std::unique_ptr<Entry> >::size_type' {aka 'long unsigned int'} [-Wformat=]
187 | mvprintw(0, 1, "%d/%d", m_Entries->empty() ? 0 : m_SelectedEntry + 1, m_Entries->size());
| ~^ ~~~~~~~~~~~~~~~~~
| | |
| int std::map<unsigned int, std::unique_ptr<Entry> >::size_type {aka long unsigned int}
| %ld

Let's match both numbers to use %d.

Signed-off-by: Petr Šabata <contyk@redhat.com>
---
src/pamix_ui.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pamix_ui.cpp b/src/pamix_ui.cpp
index 423d2ba..ff5bc61 100644
--- a/src/pamix_ui.cpp
+++ b/src/pamix_ui.cpp
@@ -184,7 +184,7 @@ void pamix_ui::redrawVolumeBars() {
}
void pamix_ui::drawHeader() const {
- mvprintw(0, 1, "%d/%d", m_Entries->empty() ? 0 : m_SelectedEntry + 1, m_Entries->size());
+ mvprintw(0, 1, "%d/%d", m_Entries->empty() ? 0 : m_SelectedEntry + 1, (unsigned)m_Entries->size());
mvprintw(0, 10, "%s", entryTypeNames[m_EntriesType]);
}
--
2.38.1

70
SPECS/pamix.spec

@ -0,0 +1,70 @@ @@ -0,0 +1,70 @@
Name: pamix
Version: 1.6
Release: 10%{?dist}
Summary: PulseAudio terminal mixer
License: MIT
URL: https://github.com/patroclos/PAmix
Source0: https://github.com/patroclos/PAmix/archive/%{version}.tar.gz
# ncurses 6.3 fixes, thanks to Sergei Trofimovich
# commit 3400b9c
Patch0: 0001-src-pamix_ui.cpp-always-use-s-style-format-for-print.patch
# commit 5ef67fc
Patch1: 0002-src-pamix_ui.cpp-fix-d-zu-printf-confusion.patch
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: ncurses-devel
BuildRequires: pulseaudio-libs-devel
# Libs are required automatically, server can be remote
Recommends: pulseaudio

%description
PAmix is a simple, terminal-based mixer for PulseAudio inspired by pavucontrol.

%prep
%autosetup -n PAmix-%{version} -p1

%build
%cmake -DCMAKE_BUILD_TYPE=RELEASE -DWITH_UNICODE=1
%cmake_build

%install
%cmake_install

%files
%license LICENSE
%doc README.md
%{_bindir}/%{name}
%{_mandir}/man1/%{name}.1*
%config(noreplace) %{_sysconfdir}/%{name}.conf

%changelog
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Tue Jan 24 2023 Petr Šabata <contyk@redhat.com> - 1.6-7
- Fix FTBFS with current ncurses
- SPDX migration

* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Sat Nov 14 2020 Petr Šabata <contyk@redhat.com> - 1.6-1
- Initial packaging
Loading…
Cancel
Save