FS#6801 - jre breaks my /etc/mailcap and mime.types file

Attached to Project: Arch Linux
Opened by Nagy Gabor (combo) - Tuesday, 03 April 2007, 21:35 GMT
Last edited by Paul Mattal (paul) - Saturday, 12 January 2008, 03:48 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Jason Chu (jason)
Paul Mattal (paul)
Architecture All
Severity Low
Priority Normal
Reported Version 0.8 Voodoo
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

There is a bug post_install of jre (and similar) packages:
---------------------
mailcap=$(grep -v 'application/x-java-jnlp-file' /etc/mailcap)
echo $mailcap >/etc/mailcap
---------------------
This will delete the \n characters from the file making it unusable.
And the same for mime.types
This task depends upon

Closed by  Paul Mattal (paul)
Saturday, 12 January 2008, 03:48 GMT
Reason for closing:  Fixed
Additional comments about closing:  Fixed in jre 6u3-2.
Comment by Jan de Groot (JGC) - Tuesday, 03 April 2007, 22:25 GMT
hmm

sed -e '/application\/x-java-jnlp-file/d' -i /etc/mailcap

would be better than this grep action. Other option is using a tempfile which is created by piping through grep -v, I would prefer the sed method, as it's cleaner.
Comment by Nagy Gabor (combo) - Wednesday, 04 April 2007, 09:13 GMT
Probably the reason for using grep is the fact that it is more common than sed. However grep should be added to jre's dependency list too.
Comment by Jan de Groot (JGC) - Wednesday, 04 April 2007, 10:24 GMT
grep and sed are both base packages, so there's no about "what's more common" ;)
Comment by Giorgio Lando (patroclo7) - Thursday, 03 May 2007, 00:24 GMT
I have this problem too. May be it should be marked something more than LOW since having a broken /etc/mime.types can have relevant consequences in certain environments: I have sent several unreadable mail attachments with mutt, since the attachment was encoded in the wrong way.
Comment by Alberto Gonzalez (Luis) - Tuesday, 22 May 2007, 16:48 GMT
I have this problem too. I only noticed it because Firefox can't offer me a default app to open files so I need browse to the executable myself every time.
Comment by Arthur Danskin (wiremore) - Tuesday, 17 July 2007, 05:13 GMT
I had this problem too. Fixed it by deleting /etc/mime.types are reinstalling the package, but this is really annoying!
Comment by Dan McGee (toofishes) - Sunday, 29 July 2007, 21:32 GMT
Is this fixed yet? We shouldn't even be touching mime.types in the jre and other install files as this type is already there to begin with if you install the mime-types package.
Comment by Paul Mattal (paul) - Wednesday, 01 August 2007, 21:50 GMT
Shouldn't this be assigned to Jason, as maintainer of this package?

But more productively, Dan can we really just get rid of the touching of mime.types entirely, or are we going to need to find a safer way to do this?
Comment by Paul Mattal (paul) - Tuesday, 27 November 2007, 14:43 GMT
Jason, do you want me to take a crack at this?

If so, let me know and I will.
Comment by Jason Chu (jason) - Tuesday, 27 November 2007, 15:41 GMT
If the mime.types line is in there, great, but how will we automatically add the web start line to mailcap? That's the whole reason these scripts are run in the first place.

Feel free to try Paul.
Comment by Dan McGee (toofishes) - Tuesday, 27 November 2007, 15:54 GMT
Paul- I have an updated mime-types PKGBUILD sitting around that I've never pushed, but I don't think that is the holdup here. We shouldn't have to touch mime.types, so we should focus on the mailcap issue.
Comment by Paul Mattal (paul) - Monday, 31 December 2007, 06:26 GMT
So as I understand this:

1) We can just never touch mime-types.

2) Jan's solution above seems safe for mailcap and addresses the \n issues.

So does this attached jre.install seem to everyone like it would solve the problems? If so, I'll go ahead and test/deploy it. But I didn't want to go any further without being sure I understood the issues-- this seems a little too simple to me to be the answer.
Comment by Giorgio Lando (patroclo7) - Monday, 31 December 2007, 11:12 GMT
I have tested the new jre.install in all the four scenarios I imagined:
1) first installation of jre and no /etc/mailcap in the system;
2) upgrade of jre and no /etc/mailcap;
3) first installation and existing /etc/mailcap;
4) upgrade and existing /etc/mailcap.
In all the four scenarios, it seems to do the right thing. So, when there is no /etc/mailcap, a single line /etc/mailcap is created with:

application/x-java-jnlp-file;/opt/java/jre/bin/javaws %s

When /etc/mailcap exists, this line is added at the end of the file, without damaging the rest of the file; also the \n are untouched.

Obviously also /etc/mime.types is now not damaged.

It seems to me that this simple solution works fine.
Comment by Giorgio Lando (patroclo7) - Monday, 31 December 2007, 11:16 GMT
Oh, and finally I tested also the remove scenarios: if I remove jre when that file includes only that line, then the file is removed. If it includes also other things, then only that line is deleted and the file is not damaged.

Loading...