6 ms·
In the end the error was in the program "file", which erroneously was detecting the postscript file as an Erlang JAM file (see https://bugs.launchpad.net/ubunt
by riquito 12y ago
In the end the error was in the program "file", which erroneously was detecting the postscript file as an Erlang JAM file
(see https://bugs.launchpad.net/ubuntu/+source/file/+bug/248619 https://bugs.launchpad.net/ubuntu/+source/file/+bug/248619)
- franze 12y agofile is funny, i just did file on standard JS file >file main.js >main.js: ASCII C++ program text, with very long lines
- chrisseaton 12y agoWhy does file always passive aggressively note the fact that you're using 'very long lines'? I'm not sure it's relevant to the format of the file.
- scrollaway 12y ago`file` does more than identify the file format; it also looks for properties. It can detect sizes and color properties for most image and video formats, various audio properties for audio formats etc. "Very long lines" is sort of a property of text files. It means it's unlikely to have been written by hand for one thing.
- chrisseaton 12y agoHmmm... I'm cynically inclined to believe it's there as a condescending remark about people the authors of file think aren't real hackers because they're not wrapping their lines to 80 characters.
- tedunangst 12y agoI'm cynically inclined to believe it's there to identify people who can't read the source to discover the cutoff is 300 characters.
- chrisseaton 12y agoBut it also has this warning for plain text files - so it's not just about source code where 300 lines is indeed quite long. However 300 characters is very short for a paragraph of text, if you aren't manually wrapping your plain text.
- jumpwah 12y agoeh, still useful for checking if plaintext or not for those who live in the terminal
- scrollaway 12y agoSpeaking as someone who has worked a lot on mime types: Do not ever use `file` as a means to identify a file type. Use the shared-mime-info database. http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html http://standards.freedesktop.org/shared-mime-info-spec/share... File has its own internal database. It can do more than the mime type db and is great for quickly identifying and getting lots of info about various file types, but it is AWFUL when used within other apps. Please, don't use it like so.
- slug 12y agonice! ~$ xdg-mime query filetype /etc/passwd text/plain
- Karellen 12y agoYeah, I'm not sure about that. According to the xdg-mime(1) man page: "The query option is for use inside a desktop session only." Why wouldn't it work from a console session? Or even a non-login session (e.g. cron job)? I'm not sure I want to trust a command-line program that only works as part of a desktop session. It sounds like the sort of fragile doodad that makes weird assumptions about its environment, which might one day no longer be true even in that environment, to me. Can anyone shed any further light on that crazy usage restriction?
- scrollaway 12y agoWhat it actually means is that it needs the various XDG basedir variables to be set, which they sometimes aren't in a non-desktop session (this is becoming less common). http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html http://standards.freedesktop.org/basedir-spec/basedir-spec-l... xdg-mime merely looks at the shared-mime-info db, processes files accordingly and spits out the result. Also, I did not actually say you should use xdg-mime; I said you should use the shared-mime-info database. xdg-mime is a (very crappy) interface for it, but using an xdg library is a lot, lot more efficient.
- 12y ago
- deleted 12y ago[deleted]