Accepting request 254950 from home:jengelh:dev

- Resolve rpmlint warnings

OBS-URL: https://build.opensuse.org/request/show/254950
OBS-URL: https://build.opensuse.org/package/show/Education/garlic?expand=0&rev=7
This commit is contained in:
Atri Bhattacharya 2014-10-11 02:08:02 +00:00 committed by Git OBS Bridge
parent b7532f3a07
commit 6a29db527b
3 changed files with 74 additions and 2 deletions

35
garlic-1.6-undef.patch Normal file
View File

@ -0,0 +1,35 @@
Date: 2014-10-10 08:41:40.775804353 +0200
From: Jan Engelhardt <jengelh@inai.de>
gcc-4.8 emits this warning:
openfile_r.c: In function 'OpenFileForReading_':
openfile_r.c:123:13: warning: array subscript is below array bounds [-Warray-bounds]
path_nameA[n] = '\0';
^
Not exactly sure why it does that; maybe it considers the hypothetical
case where strlen()'s result is sufficiently large to be truncated when
converted to int (during assignment to @n).
So, check if that happened by looking at negative numbers.
This crap code should have used (s)size_t, but I don't want to
fix it and carry around a huge patch.
---
openfile_r.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: garlic-1.6/openfile_r.c
===================================================================
--- garlic-1.6.orig/openfile_r.c
+++ garlic-1.6/openfile_r.c
@@ -115,7 +115,7 @@ else if (*file_nameP == '~')
/* Copy this string, but reverted: */
n = strlen (env_valueP);
- if (n == 0) return NULL;
+ if (n <= 0) return NULL;
for (i = 0; i < n; i++)
{
path_nameA[i] = *(env_valueP + n - 1 - i);

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Oct 10 06:42:48 UTC 2014 - jengelh@inai.de
- Resolve rpmlint warnings files-duplicate, install-file-in-docs,
package-with-huge-docs, macro-in-comment.
- Add garlic-1.6-undef.patch to fix rpmlint warning arraysubscript.
-------------------------------------------------------------------
Wed Oct 8 11:15:54 UTC 2014 - jengelh@inai.de

View File

@ -28,7 +28,9 @@ Source1: %{name}-%{version}-doc.tar.bz2
Source2: %{name}.1.gz
Patch: %{name}-%{version}.patch
Patch1: garlic-%{version}-libpath.patch
Patch2: garlic-1.6-undef.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: fdupes
BuildRequires: update-desktop-files
BuildRequires: xorg-x11
BuildRequires: xorg-x11-devel
@ -42,7 +44,6 @@ BuildRequires: xorg-x11-devel
%define _xorg7_termcap /usr/lib/X11/etc
%define _xorg7_serverincl /usr/include/xorg
%define _xorg7_fonts /usr/share/fonts
#%define _xorg7_config /usr/share/X11/config #use libshare macro
%define _xorg7_prefix /usr
%description
@ -50,11 +51,25 @@ Garlic is an X Window System tool intended for the molecular
visualization of protein structure, DNA structure, and biological
macromolecules. It reads Brookhaven Protein Database (PDB) files.
%package doc
Summary: Documentation for Garlic, a molecular graphics visualization tool
Group: Documentation/HTML
%if 0%{?suse_version} >= 1120
BuildArch: noarch
%endif
%description doc
Garlic is an X Window System tool intended for the molecular
visualization of protein structure, DNA structure, and biological
macromolecules.
This subpackage contains the full documentation to Garlic.
%prep
%setup -b 0
%setup -T -D -a 1
%patch -p 1
%patch1
%patch2 -p 1
# fix executable permission on text files
cd garlic-1.6
chmod -x README favicon.ico tolower.script garlic.gif cookbook/garlic.gif precompiled_packages/garlic.gif
@ -77,9 +92,19 @@ rm -rf html/source html/mouse/.xvpics
chmod 644 html/{README,bold_statement.html,docs.html,favicon.ico,garlic.gif,index.html,monster.gif,versions.html}
%suse_update_desktop_file -n -c %name "Garlic" Garlic garlic garlic Education Science Chemistry
# Can't do this via %%doc in %%files, because that runs too late,
# after %%fdupes.
mkdir -p "%buildroot/%_defaultdocdir/%name"
cp -a html 1mal.script 2fcp.script 2omf.script 2por.script \
BUGS COPYING ENVIRONMENT HISTORY README TODO \
"%buildroot/%_defaultdocdir/%name"
%fdupes %buildroot/%_prefix
%files
%defattr(-,root,root)
%doc html 1mal.script 2fcp.script 2omf.script 2por.script BUGS COPYING ENVIRONMENT HISTORY INSTALL README TODO
%dir %_defaultdocdir/%name/
%_defaultdocdir/%name/COPYING
%doc %{_xorg7_mandir}/man1/*
%config /etc/garlicrc
/usr/%{_xorg7bin}/%{name}
@ -88,4 +113,9 @@ chmod 644 html/{README,bold_statement.html,docs.html,favicon.ico,garlic.gif,inde
/usr/share/applications/%{name}.desktop
/usr/share/pixmaps/garlic.xpm
%files doc
%defattr(-,root,root)
%_defaultdocdir/%name/
%exclude %_defaultdocdir/%name/COPYING
%changelog