Although gentoo already provides fixdos for unix/dos line endings conversion I'm used to use the tradional unix2dos and dos2unix which are found in so many environments. The ebuilds below were based on ftp://ftp.redhat.com/pub/redhat/linux/8.0/en/os/i386/SRPMS/dos2unix-3.1-12.src.rpm and ftp://ftp.redhat.com/pub/redhat/linux/8.0/en/os/i386/SRPMS/unix2dos-2.2-17.src.rpm I've made a tarball of everything - ebuilds, patches, and the source itself since there isn't a single homepage for these utilities, but several versions scatered on the web. I hope you find these ebuilds an usefull addition to Gentoo.
Created attachment 5962 [details] dos2unix-unix2dos.tar.bz2 Contents of the tarball: app-misc/ app-misc/dos2unix/ app-misc/dos2unix/dos2unix-3.1.ebuild app-misc/dos2unix/files/ app-misc/dos2unix/files/dos2unix-3.1.patch app-misc/dos2unix/files/dos2unix-3.1-segfault.patch app-misc/dos2unix/files/digest-dos2unix-3.1 app-misc/unix2dos/ app-misc/unix2dos/unix2dos-2.2.ebuild app-misc/unix2dos/files/ app-misc/unix2dos/files/unix2dos-2.2-manpage.patch app-misc/unix2dos/files/unix2dos-2.2-segfault.patch app-misc/unix2dos/files/unix2dos-mkstemp.patch app-misc/unix2dos/files/digest-unix2dos-2.2 distfiles/ distfiles/dos2unix-3.1.tar.bz2 distfiles/unix2dos-2.2.src.tar.gz
root@rux0r root # qpkg -f /usr/bin/dos2unix app-text/hd2u *
localhost root # qpkg -f /usr/bin/unix2dos localhost root #
Jose, did you actually emerge hd2u?
Of course, Seemant. This is a fragment of the hd2u emerge log: >>> Merging app-text/hd2u-0.8.0 to / --- /usr/ --- /usr/bin/ >>> /usr/bin/dos2unix --- /usr/share/ --- /usr/share/doc/ --- /usr/share/doc/hd2u-0.8.0/ >>> /usr/share/doc/hd2u-0.8.0/AUTHORS.gz >>> /usr/share/doc/hd2u-0.8.0/CREDITS.gz >>> /usr/share/doc/hd2u-0.8.0/INSTALL.gz >>> /usr/share/doc/hd2u-0.8.0/ChangeLog.gz >>> /usr/share/doc/hd2u-0.8.0/NEWS.gz >>> /usr/share/doc/hd2u-0.8.0/README.gz >>> /usr/share/doc/hd2u-0.8.0/TODO.gz >>> /usr/share/doc/hd2u-0.8.0/COPYING.gz As you can see above, although hd2u could be a replacement for dos2unix it doesn't include a unix2dos binary/symlink (this is not a problem in the hd2u ebuild but in the program source itself, which doesn't look to argv[0]). That functionality is still provided by hd2u's --u2d command line, but this bug wasn't meant to add new functionality (since that already exists in hd2u, fixdos, sed, and perhaps more), but to actually provide these two particular utilities, which are very common and have no command-line equivalent in Gentoo (unix2dos at least AFAIK). Another unrelated thing is that when emerging hd2u, gcc says "the use of `tmpnam' is dangerous, better use `mkstemp'". In my two ebuilds already are included patches (from RedHat) to fix this security vulnerability in dos2unix and unix2dos.
jose: fair enough :)
I've originally chosen app-misc category because it was where fixdos was, but app-text actually makes much more sense for these.
commits/changes now in cvs, check out the following http://cvs.gentoo.org/cgi-bin/viewcvs.cgi/gentoo-x86/app-text/dos2unix/dos2unix-3.1.ebuild?rev=1.1&content-type=text/vnd.viewcvs-markup http://cvs.gentoo.org/cgi-bin/viewcvs.cgi/gentoo-x86/app-text/unix2dos/unix2dos-2.2.ebuild?rev=1.1&content-type=text/vnd.viewcvs-markup http://cvs.gentoo.org/cgi-bin/viewcvs.cgi/gentoo-x86/app-text/hd2u/hd2u-0.8.0.ebuild.diff?r1=1.5&r2=1.6
Just a few comments to the changes: - The perl line in the ebuilds (that removes unenclosed comments after #endif in the sources) was removed, but when I do the same here I get alot of gcc warnings like: warning: extra tokens at end of #endif directive - You added a reverse dependency between hd2u and unix2dos, but it's actually hd2u and dos2unix which conflict for the /usr/bin/dos2unix executable file.
you're right, i messed up the deps http://cvs.gentoo.org/cgi-bin/viewcvs.cgi/gentoo-x86/app-text/hd2u/hd2u-0.8.0.ebuild.diff?r1=1.6&r2=1.7 http://cvs.gentoo.org/cgi-bin/viewcvs.cgi/gentoo-x86/app-text/dos2unix/dos2unix-3.1.ebuild.diff?r1=1.1&r2=1.2 http://cvs.gentoo.org/cgi-bin/viewcvs.cgi/gentoo-x86/app-text/unix2dos/unix2dos-2.2.ebuild.diff?r1=1.1&r2=1.2 as for the perl thing, i meant to comment that putting a dependency on perl just to remove warnings isnt really a Good Thing imo also, it was just to remove warnings and warnings are ... well they arent errors ;)
It's a matter of opinion, but I personally agree with RedHat here: it's preferable to depend on something (especially like perl that almost everybody has) than to have so may warnings that can mask other eventual problems. Anyway, there is no need to choose between perl or fix the warnings. A simple patch can do exactly the same. If you whish I can prepare it for you.
i would accept a simple 'sed' cmd if you wish to prep one of those
The problem with sed is that until version 4.0 it had no ability to do inplace file modifications, i.e., you need to do for *each* file mv file file.orig sed -e '...' file.orig > file because you can't assume people have sed 4.0 (so I was told in another bug). Are you sure you don't prefer a patch?
*shrug* whatever you want ;)
Ok. I've made the patches (attached below). Put patch -p1 < ${FILESDIR}/${P}-cpp.patch || die where was previously the perl one-liner.
Created attachment 6158 [details, diff] dos2unix-3.1-cpp.patch
Created attachment 6159 [details, diff] unix2dos-2.2-cpp.patch