diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0079df0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +wmfrog-0.2.1.tgz +/wmfrog-0.2.2.tgz +/wmfrog-0.3.1.tgz diff --git a/dead.package b/dead.package deleted file mode 100644 index 5204a84..0000000 --- a/dead.package +++ /dev/null @@ -1 +0,0 @@ -Orphaned for 6+ weeks diff --git a/sources b/sources new file mode 100644 index 0000000..33ab76d --- /dev/null +++ b/sources @@ -0,0 +1 @@ +de4975f2c6a7931fdf5faa3c263aaf5f wmfrog-0.3.1.tgz diff --git a/wmfrog-0.3.1-Fix-parsing-wmfrog-arguments.patch b/wmfrog-0.3.1-Fix-parsing-wmfrog-arguments.patch new file mode 100644 index 0000000..d2f0eeb --- /dev/null +++ b/wmfrog-0.3.1-Fix-parsing-wmfrog-arguments.patch @@ -0,0 +1,163 @@ +From 529c79dcfb0dc20c123865d1caf1142b085080d5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Wed, 15 Feb 2017 15:05:35 +0100 +Subject: [PATCH] Fix parsing wmfrog arguments +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +A command like "wmfrog -s KSEA -o 7 -tmp /home/stela010/tmp/wmfrog" +crashed because the -tmp argument was bigger than a static buffer used +for storing the argument value. There were similar issues with other +argument values. + +This patch fixes it. It also fixes the fact that -tmp argument was +always ignored and user's home directory was used instead. + + + +Signed-off-by: Petr Písař +--- + Src/wmFrog.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++----------- + 1 file changed, 54 insertions(+), 12 deletions(-) + +diff --git a/Src/wmFrog.c b/Src/wmFrog.c +index 24f795c..c422e55 100644 +--- a/Src/wmFrog.c ++++ b/Src/wmFrog.c +@@ -12,6 +12,7 @@ + /* + * Includes + */ ++#define _XOPEN_SOURCE 500 /* For strdup(3) */ + #include + #include + #include +@@ -74,7 +75,7 @@ int NeedsUpdate = 1; + int maxWind = MAX_WIND; + int timeOffset = TIME_OFFSET; + long UpdateDelay; +-char* folder; ++char* folder = NULL; + int needsUpdate = 1; + + /* +@@ -91,7 +92,9 @@ int main(int argc, char *argv[]) { + */ + ParseCMDLine(argc, argv); + +- folder = GetTempDir(".wmapps"); ++ if (NULL == folder) { ++ folder = GetTempDir(".wmapps"); ++ } + + initXwindow(argc, argv); + +@@ -343,7 +346,11 @@ void ParseCMDLine(int argc, char *argv[]) { + print_usage(); + exit(-1); + } +- strcpy(folder, argv[++i]); ++ folder = strdup(argv[++i]); ++ if (NULL == folder) { ++ fprintf(stderr, "Not enough memory to copy -tmp argument.\n"); ++ exit(-1); ++ } + + + } else if ((!strcmp(argv[i], "-station")) || (!strcmp(argv[i], "-s"))) { +@@ -352,6 +359,10 @@ void ParseCMDLine(int argc, char *argv[]) { + print_usage(); + exit(-1); + } ++ if (strlen(argv[i + 1]) >= sizeof(StationID)/sizeof(*StationID) - 1) { ++ fprintf(stderr, "METAR station ID is too long.\n"); ++ exit(-1); ++ } + strcpy(StationID, StringToUpper(argv[++i])); + strcpy(Label, StationID); + } else if (!strcmp(argv[i], "-delay")) { +@@ -377,6 +388,10 @@ void ParseCMDLine(int argc, char *argv[]) { + print_usage(); + exit(-1); + } ++ if (strlen(argv[i + 1]) >= sizeof(Label)/sizeof(*Label) - 1) { ++ fprintf(stderr, "Station label is too long.\n"); ++ exit(-1); ++ } + strcpy(Label, StringToUpper(argv[++i])); + } + } +@@ -454,7 +469,8 @@ double UT; + // Will be called at regular interval to update the weather data (alarm) + + void UpdateData() { +- char command[1024], Line[512], FileName[128]; ++ char *command, Line[512], *FileName; ++ const char weatherPlScript[] = "/usr/lib/wmfrog/weather.pl"; + int ign; + char* igns; + igns = (char*) malloc(512); +@@ -492,13 +508,29 @@ void UpdateData() { + /* + * Execute Perl script to grab the Latest METAR Report + */ +- snprintf(command, 1024, "/usr/lib/wmfrog/weather.pl %s %s", StationID, folder); +- //printf("Retrieveing data\n"); +- ign = system(command); +- snprintf(FileName, 128, "%s/%s", folder, StationID); +- //fprintf(stderr,"%s\n\n",FileName); ++ command = malloc(strlen(weatherPlScript) + 1 + strlen(StationID) + 1 ++ + strlen(folder) + 1); ++ if (NULL == command) { ++ fprintf(stderr, "Not enough memory to build wheater.pl command.\n"); ++ } else { ++ sprintf(command, "%s %s %s", weatherPlScript, StationID, folder); ++ //printf("Retrieveing data\n"); ++ ign = system(command); ++ free(command); ++ } ++ ++ FileName = malloc(strlen(folder) + 1 + strlen(StationID) + 1); ++ if (NULL == FileName) { ++ fprintf(stderr, "Not enough memory to build staion ID file name.\n"); ++ fp = NULL; ++ } else { ++ sprintf(FileName, "%s/%s", folder, StationID); ++ //fprintf(stderr,"%s\n\n",FileName); ++ fp = fopen(FileName, "r"); ++ free(FileName); ++ } + +- if ((fp = fopen(FileName, "r")) != NULL) { ++ if (fp != NULL) { + ign = fscanf(fp, "Hour:%d", &weather.hour); + igns = fgets(Line, 512, fp); //h + ign = fscanf(fp, "Minute:%d", &weather.min); +@@ -620,11 +652,21 @@ void UpdateData() { + char *GetTempDir(char *suffix) { + uid_t id; + struct passwd *userEntry; +- static char userHome[128]; ++ char *userHome; + + id = getuid(); + userEntry = getpwuid(id); +- snprintf(userHome, 128, "%s/%s", userEntry->pw_dir, suffix); ++ if (NULL == userEntry) { ++ perror("Could not retrieve user's passwd entry"); ++ exit(-1); ++ } ++ ++ userHome = malloc(strlen(userEntry->pw_dir) + 1 + strlen(suffix) + 1); ++ if (NULL == userHome) { ++ fprintf(stderr, "Not enough memory for building temporary path.\n"); ++ exit(-1); ++ } ++ sprintf(userHome, "%s/%s", userEntry->pw_dir, suffix); + return userHome; + } + +-- +2.7.4 + diff --git a/wmfrog-0.3.1-Skip-warning.patch b/wmfrog-0.3.1-Skip-warning.patch new file mode 100644 index 0000000..5e29f35 --- /dev/null +++ b/wmfrog-0.3.1-Skip-warning.patch @@ -0,0 +1,28 @@ +From a1011efd4be1d960e2a145f15ad8e7aa92b31fea Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Tue, 15 May 2012 20:31:22 +0200 +Subject: [PATCH] Skip warning + +NOAA started to warn about redirect to new URL +. This patch skips the warning. +We need to move to the new URL soon. +--- + Src/weather.pl | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/Src/weather.pl b/Src/weather.pl +index 5ceeccd..c556950 100755 +--- a/Src/weather.pl ++++ b/Src/weather.pl +@@ -40,7 +40,7 @@ if($mode eq "http") + $line=; + } + $i=0; +- while($i!=12 && !eof(DATA)) ++ while($i!=21 && !eof(DATA)) + { + $line=; + $i++; +-- +1.7.3.4 + diff --git a/wmfrog.spec b/wmfrog.spec new file mode 100644 index 0000000..dfca955 --- /dev/null +++ b/wmfrog.spec @@ -0,0 +1,126 @@ +Name: wmfrog +Version: 0.3.1 +Release: 20%{?dist} +Summary: A weather application, it shows the weather in a graphical way +Group: Amusements/Graphics +License: GPLv2+ +URL: http://wiki.colar.net/wmfrog_dockapp +Source0: http://bitbucket.org/tcolar/%{name}/downloads/%{name}-%{version}.tgz +# Bug 822219, submitted to upstream. +Patch0: %{name}-0.3.1-Skip-warning.patch +# Fix a crash with overlong wmfrog -tmp argument, bug #1422319, +# mailed to upstream. +Patch1: %{name}-0.3.1-Fix-parsing-wmfrog-arguments.patch +BuildRequires: make +BuildRequires: gcc +BuildRequires: libX11-devel +BuildRequires: libXext-devel +BuildRequires: libXpm-devel +BuildRequires: perl-generators +BuildRequires: sed +Requires: wget + +%description +This is a weather application, it shows the weather in a graphical way. The +artwork looks like a kiddo did it, but that's part of the charm… Ok, I did it +when I was 25, I'm a programmer not a designer :) + +%prep +%setup -q -c +%patch0 -p1 -b .warning +%patch1 -p1 +sed -i -e 's|/lib/wmfrog|/libexec/wmfrog|' Src/Makefile +sed -i -e 's|/usr/lib/|%{_libexecdir}/|' Src/wmFrog.c +# Remove prebuilt binaries +make -C Src clean + +%build +cd Src +make CFLAGS="${RPM_OPT_FLAGS}" %{?_smp_mflags} + +%install +cd Src +make install DESTDIR=$RPM_BUILD_ROOT + +%files +%license COPYING +%doc CHANGES HINTS +%{_bindir}/%{name} +%{_libexecdir}/%{name} + +%changelog +* Thu Aug 03 2017 Fedora Release Engineering - 0.3.1-20 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Thu Jul 27 2017 Fedora Release Engineering - 0.3.1-19 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Wed Feb 15 2017 Petr Pisar - 0.3.1-18 +- Fix a crash with overlong wmfrog -tmp argument (bug #1422319) + +* Sat Feb 11 2017 Fedora Release Engineering - 0.3.1-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Sat May 14 2016 Jitka Plesnikova - 0.3.1-16 +- Perl 5.24 rebuild + +* Fri Feb 05 2016 Fedora Release Engineering - 0.3.1-15 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Fri Jun 19 2015 Fedora Release Engineering - 0.3.1-14 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Wed Jun 03 2015 Jitka Plesnikova - 0.3.1-13 +- Perl 5.22 rebuild + +* Wed Aug 27 2014 Jitka Plesnikova - 0.3.1-12 +- Perl 5.20 rebuild + +* Mon Aug 18 2014 Fedora Release Engineering - 0.3.1-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sun Jun 08 2014 Fedora Release Engineering - 0.3.1-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Sun Aug 04 2013 Fedora Release Engineering - 0.3.1-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Wed Jul 17 2013 Petr Pisar - 0.3.1-8 +- Perl 5.18 rebuild + +* Fri Feb 15 2013 Fedora Release Engineering - 0.3.1-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Sun Jul 22 2012 Fedora Release Engineering - 0.3.1-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Fri Jun 08 2012 Petr Pisar - 0.3.1-5 +- Perl 5.16 rebuild + +* Thu May 17 2012 Petr Pisar - 0.3.1-4 +- Adjust to NOAA web page change (bug #822219) +- Depend on perl ABI +- Clean spec file + +* Sat Jan 14 2012 Fedora Release Engineering - 0.3.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Mon Feb 07 2011 Fedora Release Engineering - 0.3.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Thu Dec 02 2010 Petr Pisar - 0.3.1-1 +- 0.3.1 bump +- Fixed clouds/wind parsing issues + +* Wed Sep 01 2010 Petr Pisar - 0.2.2-1 +- 0.2.2 bump + +* Mon Aug 09 2010 Petr Pisar - 0.2.1-2 +- Change RPM group to Amusements/Graphics + +* Thu Aug 05 2010 Petr Pisar - 0.2.1-1 +- 0.2.1 bump +- Fix METAR parser + +* Tue Aug 03 2010 Petr Pisar - 0.2.0-1 +- 0.2.0 import