commit 906ac63ab35e3b67dc3d87a8b58e5dc9d44c575d Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 10:37:31 2019 -0400 Package init diff --git a/Fixed-a-minor-memory-leak.patch b/Fixed-a-minor-memory-leak.patch new file mode 100644 index 0000000..a54538f --- /dev/null +++ b/Fixed-a-minor-memory-leak.patch @@ -0,0 +1,103 @@ +From a24efac07e0e5fcf8803ab27d03868d46d23fa3d Mon Sep 17 00:00:00 2001 +From: Erwin Waterlander +Date: Mon, 6 Aug 2018 20:53:35 +0200 +Subject: [PATCH 05/11] Fixed a minor memory leak. + +--- + dos2unix/ChangeLog.txt | 7 +++++++ + dos2unix/dos2unix.c | 9 ++++++--- + dos2unix/po/da.po | 4 ++-- + dos2unix/po/de.po | 4 ++-- + dos2unix/po/dos2unix.pot | 4 ++-- + dos2unix/po/eo.po | 4 ++-- + dos2unix/po/es.po | 4 ++-- + dos2unix/po/fr.po | 4 ++-- + dos2unix/po/hu.po | 4 ++-- + dos2unix/po/ja.po | 4 ++-- + dos2unix/po/nb.po | 4 ++-- + dos2unix/po/nl.po | 4 ++-- + dos2unix/po/pl.po | 4 ++-- + dos2unix/po/pt_BR.po | 4 ++-- + dos2unix/po/ru.po | 4 ++-- + dos2unix/po/sr.po | 4 ++-- + dos2unix/po/sv.po | 4 ++-- + dos2unix/po/uk.po | 4 ++-- + dos2unix/po/vi.po | 4 ++-- + dos2unix/po/zh_CN.po | 4 ++-- + dos2unix/po/zh_TW.po | 4 ++-- + dos2unix/unix2dos.c | 9 ++++++--- + 22 files changed, 57 insertions(+), 44 deletions(-) + +diff --git dos2unix/dos2unix.c dos2unix/dos2unix.c +index 65d3850..78410a6 100644 +--- dos2unix/dos2unix.c ++++ dos2unix/dos2unix.c +@@ -7,7 +7,7 @@ + * See also http://www.freebsd.org/copyright/freebsd-license.html + * -------- + * +- * Copyright (C) 2009-2016 Erwin Waterlander ++ * Copyright (C) 2009-2018 Erwin Waterlander + * Copyright (C) 1998 Christian Wurll + * Copyright (C) 1998 Bernd Johannes Wuebben + * Copyright (C) 1994-1995 Benjamin Lin. +@@ -504,6 +504,7 @@ int main (int argc, char *argv[]) + CFlag *pFlag; + char *ptr; + char localedir[1024]; ++ int ret; + # ifdef __MINGW64__ + int _dowildcard = -1; /* enable wildcard expansion for Win64 */ + # endif +@@ -593,9 +594,11 @@ int main (int argc, char *argv[]) + #endif + + #ifdef D2U_UNICODE +- return parse_options(argc_new, argv_new, pFlag, localedir, progname, PrintLicense, ConvertDosToUnix, ConvertDosToUnixW); ++ ret = parse_options(argc_new, argv_new, pFlag, localedir, progname, PrintLicense, ConvertDosToUnix, ConvertDosToUnixW); + #else +- return parse_options(argc_new, argv_new, pFlag, localedir, progname, PrintLicense, ConvertDosToUnix); ++ ret = parse_options(argc_new, argv_new, pFlag, localedir, progname, PrintLicense, ConvertDosToUnix); + #endif ++ free(pFlag); ++ return ret; + } + +diff --git dos2unix/unix2dos.c dos2unix/unix2dos.c +index 7bd17d3..aad827d 100644 +--- dos2unix/unix2dos.c ++++ dos2unix/unix2dos.c +@@ -8,7 +8,7 @@ + * See also http://www.freebsd.org/copyright/freebsd-license.html + * -------- + * +- * Copyright (C) 2009-2016 Erwin Waterlander ++ * Copyright (C) 2009-2018 Erwin Waterlander + * Copyright (C) 1994-1995 Benjamin Lin. + * All rights reserved. + * +@@ -477,6 +477,7 @@ int main (int argc, char *argv[]) + CFlag *pFlag; + char *ptr; + char localedir[1024]; ++ int ret; + # ifdef __MINGW64__ + int _dowildcard = -1; /* enable wildcard expansion for Win64 */ + # endif +@@ -566,9 +567,11 @@ int main (int argc, char *argv[]) + #endif + + #ifdef D2U_UNICODE +- return parse_options(argc_new, argv_new, pFlag, localedir, progname, PrintLicense, ConvertUnixToDos, ConvertUnixToDosW); ++ ret = parse_options(argc_new, argv_new, pFlag, localedir, progname, PrintLicense, ConvertUnixToDos, ConvertUnixToDosW); + #else +- return parse_options(argc_new, argv_new, pFlag, localedir, progname, PrintLicense, ConvertUnixToDos); ++ ret = parse_options(argc_new, argv_new, pFlag, localedir, progname, PrintLicense, ConvertUnixToDos); + #endif ++ free(pFlag); ++ return ret; + } + +-- +2.19.1 + diff --git a/Fixed-issues-reported-by-Coverity-Scan.patch b/Fixed-issues-reported-by-Coverity-Scan.patch new file mode 100644 index 0000000..206f4a4 --- /dev/null +++ b/Fixed-issues-reported-by-Coverity-Scan.patch @@ -0,0 +1,63 @@ +From 48217aee7fb123a753e326cb8e761e14923fa47c Mon Sep 17 00:00:00 2001 +From: Erwin Waterlander +Date: Sat, 1 Dec 2018 16:52:34 +0100 +Subject: [PATCH 09/11] Fixed issues reported by Coverity Scan See + https://sourceforge.net/p/dos2unix/bugs/18/ + +--- + dos2unix/ChangeLog.txt | 4 ++++ + dos2unix/README.txt | 2 ++ + dos2unix/common.c | 11 ++++++++--- + 3 files changed, 14 insertions(+), 3 deletions(-) + +diff --git dos2unix/common.c dos2unix/common.c +index d46db7e..689dc4e 100644 +--- dos2unix/common.c ++++ dos2unix/common.c +@@ -1,5 +1,5 @@ + /* +- * Copyright (C) 2009-2017 Erwin Waterlander ++ * Copyright (C) 2009-2018 Erwin Waterlander + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without +@@ -983,6 +983,7 @@ FILE* MakeTempFileFrom(const char *OutFN, char **fname_ret) + *fname_ret = fname_str; + + free(cpy); ++ cpy = NULL; + + #ifdef NO_MKSTEMP + if ((name = d2u_mktemp(fname_str)) == NULL) +@@ -1001,6 +1002,10 @@ FILE* MakeTempFileFrom(const char *OutFN, char **fname_ret) + return (fp); + + make_failed: ++ if (cpy) { ++ free(cpy); ++ cpy = NULL; ++ } + free(*fname_ret); + *fname_ret = NULL; + return NULL; +@@ -1978,7 +1983,7 @@ void printInfo(CFlag *ipFlag, const char *filename, int bomtype, unsigned int lb + D2U_UTF8_FPRINTF(stdout, "FILE"); + } + if (ipFlag->file_info & INFO_PRINT0) +- fputc(0, stdout); ++ (void) fputc(0, stdout); + else + D2U_UTF8_FPRINTF(stdout, "\n"); + header_done = 1; +@@ -2009,7 +2014,7 @@ void printInfo(CFlag *ipFlag, const char *filename, int bomtype, unsigned int lb + D2U_UTF8_FPRINTF(stdout, "%s",ptr); + } + if (ipFlag->file_info & INFO_PRINT0) +- fputc(0, stdout); ++ (void) fputc(0, stdout); + else + D2U_UTF8_FPRINTF(stdout, "\n"); + } +-- +2.19.1 + diff --git a/dos2unix-7.4.0.tar.gz b/dos2unix-7.4.0.tar.gz new file mode 100644 index 0000000..62fad83 Binary files /dev/null and b/dos2unix-7.4.0.tar.gz differ diff --git a/dos2unix.spec b/dos2unix.spec new file mode 100644 index 0000000..5be2872 --- /dev/null +++ b/dos2unix.spec @@ -0,0 +1,50 @@ +Name: dos2unix +Version: 7.4.0 +Release: 9 +Summary: Text file format converters +License: BSD +URL: http://waterlan.home.xs4all.nl/dos2unix.html +Source0: http://waterlan.home.xs4all.nl/dos2unix/%{name}-%{version}.tar.gz +Patch6000: Fixed-a-minor-memory-leak.patch +Patch6001: Fixed-issues-reported-by-Coverity-Scan.patch + +BuildRequires: gcc gettext +Provides: unix2dos = %{version} +Obsoletes: unix2dos < %{version} + +%description +The dos2unix utility converts characters in the DOS extended character set to the +corresponding ISO standard characters. + +%package_help + +%prep +%autosetup -n %{name}-%{version} -p1 + +%build +%make_build + +%install +%make_install +rm -rf $RPM_BUILD_ROOT%{_docdir} +%find_lang %{name} --with-man --all-name + +%files -f %{name}.lang +%{_bindir}/dos2unix +%{_bindir}/mac2unix +%{_bindir}/unix2dos +%{_bindir}/unix2mac + +%files help +%{_mandir}/man1/*.1.gz + +%changelog +* Fri Sep 27 2019 chengquan - 7.4.0-9 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:add help package + +* Tue Aug 13 2019 openEuler Buildteam - 7.4.0-8 +- Package init +