Re: sox vs libmagic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jan Stary <hans@xxxxxxxx> writes:

> On Sep 20 17:05:10, mans@xxxxxxxxx wrote:
>> Jan Stary <hans@xxxxxxxx> writes:
>> 
>> >> > I am proposing to remove libmagic from SoX, because
>> >> >
>> >> > 1. It is of questionable utility. Next time you encounter
>> >> >    a missnamed or unrecognizable audio file, just run file(1) on it.
>> >> >    That's what file(1) is for. 
>> >> 
>> >> Wrong.  How would you do that in an automated fashion?
>> >
>> > I don't understand the question -
>> > cannot file(1) be scripted just like sox?
>> 
>> What do you propose one should do with the file(1) output?
>
> Ah, that's right.
>
> But I still believe that if I have a misnamed or unrecognizable file
> (say, an OGG file named *.wav), the first thing to do is to fix _that_,
> (i.e. rename it to *.ogg) and only then run SoX on it.
>
> Using libmagic in SoX let's me ignore that: sox --magic let's me
> treat the *.wav file as an OGG which it is. That is _not_ a good thing:
> the very same problem is still there.

Oh gosh, the world isn't perfect.  Let's immediately stick our heads in
the sand and pretend it ain't so.

>> >> > 2. I haven't inspected the code closely, but it also seems that
>> >> >    for the libmagic functionality to even happen, you need to call SoX
>> >> >    with an explicit --magic. If that's the case, tell me:
>> >> 
>> >> Yes, that is the case.
>> >> 
>> >> >    have you ever done that? No. So you are not using it anyway.
>> >> 
>> >> Again, it doesn't matter.  Since it's there, I have to assume someone is
>> >> using it.
>> >
>> > This seems to be exactly the point where we differ:
>> > I believe it's dead code:
>> 
>> Based on what?  That *you* haven't ever needed it?
>
> No. That's why I am asking here first.
> (So far, zero people said "I am using it".)

Only a tiny fraction of all sox users follow this mailing list.

>> >> > So far the only argument for it to stay is that it's already there.
>> >> > IMHO that's not a reason for it to be there. Or, to paraphrase:
>> >> > code without reason is always misguided.
>> >> >
>> >> > Of course I can build my SoX --without-magic (and I do).  I just
>> >> > believe that it would be beneficial to SoX as a piece of software to
>> >> > drop it entirely. It would be smaller without really losing anything.
>> >> 
>> >> It would be losing a feature.  How is that ever beneficial?
>> >
>> > Again, this seems to be the very difference in attitude:
>> > "features must never be removed". No wonder software gets
>> > evr more bloated.
>> 
>> By extension, features should never be added either.
>> Hell, we should just stop writing software at all.
>
> Again with the false generalizations. No, that's not what I am saying.
> But your argument for "why should libmagic stay" is "because it's there".
> That's not a reason to keep it. 

Just why do you think someone added the feature in the first place?  My
money is on someone needing it.

Unless it is broken or a burden to maintain, it should stay.  You're not
even the maintainer, so why do you care?

>> Why do you hate this particular feature so badly?
>
> I don't hate it (or have any other sentiment towards it).
> I just think it's unused cruft of questionable value,
> and thus a candidate for removal. That's why I asked
> if people are using it. (So far, no-one said yes.)

You could say the same about almost every feature in sox.  The vast
majority of effects are very rarely used.

> NB: Using libmagic in SoX means explicitly using the --magic option.
> If anyone is doing that, please speak up.

Again, most users do not follow this mailing list.

>> >> That said, having looked at the code, the use of libmagic is actually
>> >> quite limited and could probably be replaced with little effort without
>> >> losing any functionality.  If I cared as deeply as you appear to do,
>> >> that's where I'd be looking.
>> >
>> > "Replaced" with what?
>> 
>> Similar functionality re-implemented without libmagic.
>
> How would that be any different? I don't have anything against
> libmagic itself; but I believe SoX does not need to try to guess
> unrecognized file formats, be it via libmagic or something
> quite-the-same-but-different internally.

What kind of fantasy land do you live in?

> If I have an OGG file named *.wav, _that_ is the problem. If an internet
> radio streams a FLAC stream named *.mp3, _that_ is the problem.
> And using libmagic (or any format guessing for that matter) _in_SoX_
> is not a solution to it. Instead, find out what the format really is,
> maybe using a tool designed for file format guessing such as file(1),
> and fix _that_ first. "Fixing" it within SoX is imho a pollution of SoX.
> That's my point.

So you want to fix the internet.  Good luck with that.

-- 
Måns Rullgård

------------------------------------------------------------------------------
_______________________________________________
Sox-users mailing list
Sox-users@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/sox-users




[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux