Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 11242 - dos2unix and unix2dos ebuilds (new)
Summary: dos2unix and unix2dos ebuilds (new)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: x86 Linux
: High enhancement (vote)
Assignee: SpanKY
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-26 07:52 UTC by José Fonseca
Modified: 2003-02-04 19:42 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
dos2unix-unix2dos.tar.bz2 (dos2unix-unix2dos.tar.bz2,21.62 KB, application/octet-stream)
2002-11-26 07:54 UTC, José Fonseca
Details
dos2unix-3.1-cpp.patch (dos2unix-3.1-cpp.patch,1.93 KB, patch)
2002-12-02 19:10 UTC, José Fonseca
Details | Diff
unix2dos-2.2-cpp.patch (unix2dos-2.2-cpp.patch,1.98 KB, patch)
2002-12-02 19:11 UTC, José Fonseca
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description José Fonseca 2002-11-26 07:52:36 UTC
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.
Comment 1 José Fonseca 2002-11-26 07:54:14 UTC
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
Comment 2 SpanKY gentoo-dev 2002-11-26 19:13:43 UTC
root@rux0r root # qpkg -f /usr/bin/dos2unix 
app-text/hd2u * 
Comment 3 José Fonseca 2002-11-26 20:14:22 UTC
localhost root # qpkg -f /usr/bin/unix2dos
localhost root # 
Comment 4 Seemant Kulleen (RETIRED) gentoo-dev 2002-11-26 22:05:57 UTC
Jose, did you actually emerge hd2u?
Comment 5 José Fonseca 2002-11-27 05:55:25 UTC
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.
Comment 6 Seemant Kulleen (RETIRED) gentoo-dev 2002-11-27 14:59:46 UTC
jose: fair enough :)
Comment 7 José Fonseca 2002-11-28 07:43:54 UTC
I've originally chosen app-misc category because it was where fixdos was, but
app-text actually makes much more sense for these.
Comment 9 José Fonseca 2002-12-01 04:35:37 UTC
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.
Comment 10 SpanKY gentoo-dev 2002-12-01 11:00:16 UTC
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 ;) 
 
 
Comment 11 José Fonseca 2002-12-01 11:41:49 UTC
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.
Comment 12 SpanKY gentoo-dev 2002-12-01 11:48:25 UTC
i would accept a simple 'sed' cmd if you wish to prep one of those 
Comment 13 José Fonseca 2002-12-01 12:28:18 UTC
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?
Comment 14 SpanKY gentoo-dev 2002-12-01 12:37:36 UTC
*shrug* whatever you want ;) 
Comment 15 José Fonseca 2002-12-02 19:10:04 UTC
Ok. I've made the patches (attached below). Put

    patch -p1 < ${FILESDIR}/${P}-cpp.patch || die

where was previously the perl one-liner.
Comment 16 José Fonseca 2002-12-02 19:10:42 UTC
Created attachment 6158 [details, diff]
dos2unix-3.1-cpp.patch
Comment 17 José Fonseca 2002-12-02 19:11:22 UTC
Created attachment 6159 [details, diff]
unix2dos-2.2-cpp.patch