diff --git a/dos2unix-3.1-preserve-file-modes.patch b/dos2unix-3.1-preserve-file-modes.patch new file mode 100644 index 0000000..7e8f3bd --- /dev/null +++ b/dos2unix-3.1-preserve-file-modes.patch @@ -0,0 +1,28 @@ +--- dos2unix-3.1/dos2unix.c.mode 2003-05-21 08:09:08.000000000 -0700 ++++ dos2unix-3.1/dos2unix.c 2003-05-21 08:09:56.000000000 -0700 +@@ -345,11 +345,14 @@ int ConvertDosToUnixOldFile(char* ipInFN + char TempPath[16]; + struct stat StatBuf; + struct utimbuf UTimeBuf; ++ mode_t mode = S_IRUSR | S_IWUSR; + int fd; + + /* retrieve ipInFN file date stamp */ +- if ((ipFlag->KeepDate) && stat(ipInFN, &StatBuf)) ++ if (stat(ipInFN, &StatBuf)) + RetVal = -1; ++ else ++ mode = StatBuf.st_mode; + + strcpy (TempPath, "./u2dtmpXXXXXX"); + if((fd=mkstemp (TempPath))<0) { +@@ -357,6 +360,9 @@ int ConvertDosToUnixOldFile(char* ipInFN + RetVal = -1; + } + ++ if (!RetVal && fchmod (fd, mode) && fchmod (fd, S_IRUSR | S_IWUSR)) ++ RetVal = -1; ++ + #ifdef DEBUG + fprintf(stderr, "dos2unix: using %s as temp file\n", TempPath); + #endif DEBUG diff --git a/dos2unix.spec b/dos2unix.spec index 81c6752..c1dfbf6 100644 --- a/dos2unix.spec +++ b/dos2unix.spec @@ -1,7 +1,7 @@ Summary: Text file format converter Name: dos2unix Version: 3.1 -Release: 19 +Release: 20 Group: Applications/Text License: Freely distributable Source: %{name}-%{version}.tar.bz2 @@ -9,6 +9,7 @@ Patch0: %{name}-%{version}.patch Patch1: dos2unix-3.1-segfault.patch Patch2: dos2unix-3.1-safeconv.patch Patch3: dos2unix-3.1-manpage-update-57507.patch +Patch4: dos2unix-3.1-preserve-file-modes.patch Buildroot: %{_tmppath}/%{name}-%{version}-root @@ -21,6 +22,7 @@ Dos2unix converts DOS or MAC text files to UNIX format. %patch1 -p1 -b .segfault %patch2 -p1 -b .safeconv %patch3 -p1 -b .manpage-update-57507 +%patch4 -p1 -b .preserve-file-modes for I in *.[ch]; do sed -e 's,#endif.*,#endif,g' -e 's,#else.*,#else,g' $I > $I.new @@ -54,6 +56,8 @@ rm -rf $RPM_BUILD_ROOT %changelog * Wed Oct 6 2004 Mike A. Harris 3.1-20 - Added dos2unix-3.1-manpage-update-57507.patch to fix manpage (#57507) +- Added dos2unix-3.1-preserve-file-modes.patch to properly preserve file + permissions (#91331,55183,112710,132145) * Sun Sep 26 2004 Rik van Riel 3.1-19 - safer conversion w/ mac2unix (fix from bz #57508)