sox vs libmagic

classic Classic list List threaded Threaded
49 messages Options
123
Reply | Threaded
Open this post in threaded view
|

sox vs libmagic

Jan Stary
Would anyone miss the libmagic functionality
if it was removed from SoX?

  Jan


------------------------------------------------------------------------------
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: sox vs libmagic

René Bastian
Le Sat, 17 Sep 2016 21:47:05 +0200,
Jan Stary <[hidden email]> a écrit :

> Would anyone miss the libmagic functionality
> if it was removed from SoX?

I will not miss it.

rb

>
>   Jan
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Sox-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/sox-users
>



--
René Bastian
www.pythoneon.org

------------------------------------------------------------------------------
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: sox vs libmagic

Fmiser
In reply to this post by Jan Stary
> Jan wrote:
>
> Would anyone miss the libmagic functionality
> if it was removed from SoX?

I build it with libmagic.  But I don't know how often it uses it.
I just figured it was a good idea to leave it in there.

Is there a reason to take it out?

------------------------------------------------------------------------------
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: sox vs libmagic

Fmiser
In reply to this post by Jan Stary
> Jan wrote:
>
> Would anyone miss the libmagic functionality
> if it was removed from SoX?

Is there a reason to take it out?  

If you don't want it you can build it without it.  Otherwise, it
seems to me using a files magic number is good way to deal with
missing or wrong extensions.

Am I missing something?

------------------------------------------------------------------------------
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: sox vs libmagic

Jan Stary
On Sep 18 02:51:47, [hidden email] wrote:
> > Would anyone miss the libmagic functionality
> > if it was removed from SoX?
>
> I build it with libmagic.  But I don't know how often it uses it.

Almost never, I would think.

> Is there a reason to take it out?

I think it's dead wood (and a security concern too).

> If you don't want it you can build it without it

I do.

> Otherwise, it seems to me using a files magic number
> is good way to deal with missing or wrong extensions.

How many audio files with missing or wrong extensions
have you processed in the last year?

        Jan

------------------------------------------------------------------------------
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: sox vs libmagic

Måns Rullgård
Jan Stary <[hidden email]> writes:

> On Sep 18 02:51:47, [hidden email] wrote:
>> > Would anyone miss the libmagic functionality
>> > if it was removed from SoX?
>>
>> I build it with libmagic.  But I don't know how often it uses it.
>
> Almost never, I would think.
>
>> Is there a reason to take it out?
>
> I think it's dead wood (and a security concern too).

Please explain.

--
Måns Rullgård

------------------------------------------------------------------------------
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: sox vs libmagic

Peter P.
In reply to this post by Jan Stary
* Jan Stary <[hidden email]> [2016-09-18 05:21]:
[...]
> How many audio files with missing or wrong extensions
> have you processed in the last year?
I am trying to understand what it does. Apparently libmagic lets you
find out filetypes according to "magic number tests". I never used it
but am wondering what other program (if not sox) I would throw at the
problem of reading unknown or wrong extension audiiofiles. Is this
libmagic functionality a unique feature only found in sox? Then it might
be worth leaving it in.
A few other posters have commented to either enable or disable at
compilation time. I am using sox a lot, but have never compiled it
myself and would be happy if I hadn't to in the future to either enable
or disable libmagic, whatever my preference would be.
In what sense does it pose a security risk?

thanks for asking this list,
and for maintaining this great program!
Peter

------------------------------------------------------------------------------
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: sox vs libmagic

Måns Rullgård
"Peter P." <[hidden email]> writes:

> * Jan Stary <[hidden email]> [2016-09-18 05:21]:
> [...]
>> How many audio files with missing or wrong extensions
>> have you processed in the last year?
> I am trying to understand what it does. Apparently libmagic lets you
> find out filetypes according to "magic number tests". I never used it
> but am wondering what other program (if not sox) I would throw at the
> problem of reading unknown or wrong extension audiiofiles. Is this
> libmagic functionality a unique feature only found in sox? Then it might
> be worth leaving it in.

Libmagic determines file types by matching against a list of known
header patterns.  It is used by the "file" command line utility.  Other
software varies in handling of unspecified file types.  Some programs
have their own similar functionality built in while others simply fail.
It's a useful feature at times, and I'd be reluctant to remove it
without a good reason.

> A few other posters have commented to either enable or disable at
> compilation time. I am using sox a lot, but have never compiled it
> myself and would be happy if I hadn't to in the future to either enable
> or disable libmagic, whatever my preference would be.
> In what sense does it pose a security risk?

Like anything, libmagic might have bugs, though I see no reason to fear
it more than sox itself.

--
Måns Rullgård

------------------------------------------------------------------------------
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: sox vs libmagic

Jeremy Nicoll - ml sox users
On 2016-09-19 11:52, Måns Rullgård wrote:

> Libmagic determines file types by matching against a list of known
> header patterns.  It is used by the "file" command line utility.

Then, can't people who want the libmagic facility just use it via
the 'file' command?

--
Jeremy Nicoll - my opinions are my own

------------------------------------------------------------------------------
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: sox vs libmagic

Måns Rullgård
Jeremy Nicoll - ml sox users <[hidden email]> writes:

> On 2016-09-19 11:52, Måns Rullgård wrote:
>
>> Libmagic determines file types by matching against a list of known
>> header patterns.  It is used by the "file" command line utility.
>
> Then, can't people who want the libmagic facility just use it via
> the 'file' command?

That would be rather inconvenient compared to having a single sox
command do the right thing.

Until someone can point to a specific problem the feature is causing,
I see absolutely no reason for removing it.

--
Måns Rullgård

------------------------------------------------------------------------------
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: sox vs libmagic

Jan Stary
In reply to this post by Fmiser
> > Would anyone miss the libmagic functionality
> > if it was removed from SoX?

On Sep 18 10:27:00, [hidden email] wrote:
> A few other posters have commented to either enable or disable at
> compilation time. I am using sox a lot, but have never compiled it
> myself and would be happy if I hadn't to in the future to either enable
> or disable libmagic, whatever my preference would be.

On Sep 19 15:51:53, [hidden email] wrote:
> Until someone can point to a specific problem the feature is causing,
> I see absolutely no reason for removing it.

I think it goes the other way: there needs to be
a specific reason to have it in there.

Here is SoX 14.4.2 built --without-magic:


hans@dell:tmp$ sox -n file.wav synth 1 sin 440 gain -6
hans@dell:tmp$ soxi file.wav

Input File     : 'file.wav'
Channels       : 1
Sample Rate    : 48000
Precision      : 32-bit
Duration       : 00:00:01.00 = 48000 samples ~ 75 CDDA sectors
File Size      : 192k
Bit Rate       : 1.54M
Sample Encoding: 32-bit Signed Integer PCM

hans@dell:tmp$ mv file.wav file
hans@dell:tmp$ soxi file

Input File     : 'file' (wav)
Channels       : 1
Sample Rate    : 48000
Precision      : 32-bit
Duration       : 00:00:01.00 = 48000 samples ~ 75 CDDA sectors
File Size      : 192k
Bit Rate       : 1.54M
Sample Encoding: 32-bit Signed Integer PCM

hans@dell:tmp$ mv file mp3
hans@dell:tmp$ soxi file.mp3

Input File     : 'file.mp3' (wav)
Channels       : 1
Sample Rate    : 48000
Precision      : 32-bit
Duration       : 00:00:01.00 = 48000 samples ~ 75 CDDA sectors
File Size      : 192k
Bit Rate       : 1.54M
Sample Encoding: 32-bit Signed Integer PCM

hans@dell:tmp$ play file.mp3

file.mp3:

 File Size: 192k      Bit Rate: 1.54M
  Encoding: Signed PCM
  Channels: 1 @ 32-bit
Samplerate: 48000Hz
Replaygain: off
  Duration: 00:00:01.00

In:100%% 00:00:01.00 [00:00:00.00] Out:48.0k [ =====|===== ]    Clip:0


So I created a file.wav and renamed it to 'file' just to confuse SoX.
But it seems to recognize it as WAV just fine.

Then I renamed it to file.mp3 to cause even more confusion.
But SoX recognizes it as WAV all the same.

This is --without-magic. What exactly do we need it for?
Can someone more knowledgeable in the codebase please explain
when exactly is libmagic used to help SoX determine the a file format?
Apparently, having a *.wav file named *.mp3 is not such an example.

Hm, now that I tried the oposite (*.mp3 file named *.wav),
"play file.wav" fails with

   can't open input file `file.wav': WAVE: RIFF header not found

but "play --magic file.wav" works. Does that mean that --magic
needs to be explicitly specified for the libmagic to happen?

On Sep 18 02:53:52, [hidden email] wrote:
> seems to me using a files magic number is good way to deal with
> missing or wrong extensions.

I'll repeat: how many audio files with missing or wrong extensions
have you encountered in the last year?

Also, it seems you have to run SoX with an explicit --magic option
- have you ever used that?

        Jan


------------------------------------------------------------------------------
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: sox vs libmagic

Peter P.
* Jan Stary <[hidden email]> [2016-09-19 18:10]:
[...]
> So I created a file.wav and renamed it to 'file' just to confuse SoX.
> But it seems to recognize it as WAV just fine.
>
> Then I renamed it to file.mp3 to cause even more confusion.
> But SoX recognizes it as WAV all the same.
>
> This is --without-magic. What exactly do we need it for?
> Can someone more knowledgeable in the codebase please explain
> when exactly is libmagic used to help SoX determine the a file format?
I guess that the file header has a field that says "wav" no matter what
filename extension you give it, or if you leave it away.
If that header would be missing as well, or would be corrupt or
otherwise faulty, I guess this is when libmagic would come in.

2cents only though
P

------------------------------------------------------------------------------
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: sox vs libmagic

Jan Stary
In reply to this post by Fmiser
> > So I created a file.wav and renamed it to 'file' just to confuse SoX.
> > But it seems to recognize it as WAV just fine.
> >
> > Then I renamed it to file.mp3 to cause even more confusion.
> > But SoX recognizes it as WAV all the same.
> >
> This is --without-magic. What exactly do we need it for?
> Can someone more knowledgeable in the codebase please explain
> when exactly is libmagic used to help SoX determine the a file format?

> I guess that the file header has a field that says "wav" no matter what
> filename extension you give it, or if you leave it away.
> If that header would be missing as well, or would be corrupt or
> otherwise faulty, I guess this is when libmagic would come in.

No, libmagic works the other way round: it is precisely
the presence of "RIFF$...WAVE" in the file that makes
it recognizable as WAV by its content, regardles of name.

What I meant is when does SoX use this?
So far, my speculation is: if and only if sox --magic.


------------------------------------------------------------------------------
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: sox vs libmagic

Måns Rullgård
In reply to this post by Jan Stary
Jan Stary <[hidden email]> writes:

>> > Would anyone miss the libmagic functionality
>> > if it was removed from SoX?
>
> On Sep 18 10:27:00, [hidden email] wrote:
>> A few other posters have commented to either enable or disable at
>> compilation time. I am using sox a lot, but have never compiled it
>> myself and would be happy if I hadn't to in the future to either enable
>> or disable libmagic, whatever my preference would be.
>
> On Sep 19 15:51:53, [hidden email] wrote:
>> Until someone can point to a specific problem the feature is causing,
>> I see absolutely no reason for removing it.
>
> I think it goes the other way: there needs to be a specific reason to
> have it in there.

It's already there, presumably because it was useful to someone.  I'm
against removing features merely because one person lacks the
imagination to see their utility.  If the situation were reversed,
someone sending a patch to add this feature, I'd be asking for examples
of when it is needed.  Change without reason is always misguided.

--
Måns Rullgård

------------------------------------------------------------------------------
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: sox vs libmagic

Jan Stary
On Sep 20 11:32:15, [hidden email] wrote:

> Jan Stary <[hidden email]> writes:
>
> >> > Would anyone miss the libmagic functionality
> >> > if it was removed from SoX?
> >
> > On Sep 18 10:27:00, [hidden email] wrote:
> >> A few other posters have commented to either enable or disable at
> >> compilation time. I am using sox a lot, but have never compiled it
> >> myself and would be happy if I hadn't to in the future to either enable
> >> or disable libmagic, whatever my preference would be.
> >
> > On Sep 19 15:51:53, [hidden email] wrote:
> >> Until someone can point to a specific problem the feature is causing,
> >> I see absolutely no reason for removing it.
> >
> > I think it goes the other way: there needs to be a specific reason to
> > have it in there.
>
> It's already there, presumably because it was useful to someone.

That's exactly what I am asking: is anyone using it?
How exactly are you using it? When have you last used it?

> I'm against removing features merely because one person lacks the
> imagination to see their utility.  If the situation were reversed,
> someone sending a patch to add this feature, I'd be asking for examples
> of when it is needed.  Change without reason is always misguided.

Let's stop with the generalizations and "persons without imagination", OK?
I know what libmagic does. I just don't think that it is much useful in SoX.
How many misnamed or unrecognizable audio files have you encountered recently?
Zero, that's how many. And how did libmagic in SoX help you with that?
You can't tell, because you haven't used it. Tell me it's not true.

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.

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:
   have you ever done that? No. So you are not using it anyway.

4. It would be one less dependency, and less code.

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.

        Jan


------------------------------------------------------------------------------
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: sox vs libmagic

TrojanNemo
Hi everyone.

With all due respect, how can I unsubscribe from this mailing list? I haven't used SoX for at least a year, maybe two, and I keep getting these multiple emails a day. Thanks.

> Date: Tue, 20 Sep 2016 15:21:47 +0200

> From: [hidden email]
> To: [hidden email]
> Subject: Re: [SoX-users] sox vs libmagic
>
> On Sep 20 11:32:15, [hidden email] wrote:
> > Jan Stary <[hidden email]> writes:
> >
> > >> > Would anyone miss the libmagic functionality
> > >> > if it was removed from SoX?
> > >
> > > On Sep 18 10:27:00, [hidden email] wrote:
> > >> A few other posters have commented to either enable or disable at
> > >> compilation time. I am using sox a lot, but have never compiled it
> > >> myself and would be happy if I hadn't to in the future to either enable
> > >> or disable libmagic, whatever my preference would be.
> > >
> > > On Sep 19 15:51:53, [hidden email] wrote:
> > >> Until someone can point to a specific problem the feature is causing,
> > >> I see absolutely no reason for removing it.
> > >
> > > I think it goes the other way: there needs to be a specific reason to
> > > have it in there.
> >
> > It's already there, presumably because it was useful to someone.
>
> That's exactly what I am asking: is anyone using it?
> How exactly are you using it? When have you last used it?
>
> > I'm against removing features merely because one person lacks the
> > imagination to see their utility. If the situation were reversed,
> > someone sending a patch to add this feature, I'd be asking for examples
> > of when it is needed. Change without reason is always misguided.
>
> Let's stop with the generalizations and "persons without imagination", OK?
> I know what libmagic does. I just don't think that it is much useful in SoX.
> How many misnamed or unrecognizable audio files have you encountered recently?
> Zero, that's how many. And how did libmagic in SoX help you with that?
> You can't tell, because you haven't used it. Tell me it's not true.
>
> 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.
>
> 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:
> have you ever done that? No. So you are not using it anyway.
>
> 4. It would be one less dependency, and less code.
>
> 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.
>
> Jan
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Sox-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/sox-users

------------------------------------------------------------------------------

_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: sox vs libmagic

Måns Rullgård
In reply to this post by Jan Stary
Jan Stary <[hidden email]> writes:

> On Sep 20 11:32:15, [hidden email] wrote:
>> Jan Stary <[hidden email]> writes:
>>
>> >> > Would anyone miss the libmagic functionality
>> >> > if it was removed from SoX?
>> >
>> > On Sep 18 10:27:00, [hidden email] wrote:
>> >> A few other posters have commented to either enable or disable at
>> >> compilation time. I am using sox a lot, but have never compiled it
>> >> myself and would be happy if I hadn't to in the future to either enable
>> >> or disable libmagic, whatever my preference would be.
>> >
>> > On Sep 19 15:51:53, [hidden email] wrote:
>> >> Until someone can point to a specific problem the feature is causing,
>> >> I see absolutely no reason for removing it.
>> >
>> > I think it goes the other way: there needs to be a specific reason to
>> > have it in there.
>>
>> It's already there, presumably because it was useful to someone.
>
> That's exactly what I am asking: is anyone using it?
> How exactly are you using it? When have you last used it?

It doesn't matter what I or you have or haven't done.  The feature is
there, so I must assume that someone is using or least has used it.
Removing it without good reason would be rude.  It's what Gnome
developers do.

>> I'm against removing features merely because one person lacks the
>> imagination to see their utility.  If the situation were reversed,
>> someone sending a patch to add this feature, I'd be asking for examples
>> of when it is needed.  Change without reason is always misguided.
>
> Let's stop with the generalizations and "persons without imagination", OK?
> I know what libmagic does. I just don't think that it is much useful in SoX.
> How many misnamed or unrecognizable audio files have you encountered recently?

Recently, not a lot.  In the past, more than I care to count.

> Zero, that's how many. And how did libmagic in SoX help you with that?
> You can't tell, because you haven't used it. Tell me it's not true.
>
> 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?

> 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.

> 4. It would be one less dependency, and less code.

The dependency is optional.  The amount of code is negligible.

> 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?

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.

--
Måns Rullgård

------------------------------------------------------------------------------
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: sox vs libmagic

Erich Eckner
In reply to this post by TrojanNemo
Hi Yemil,

like with any mailman-list:
klick the link at the bottom
(https://lists.sourceforge.net/lists/listinfo/sox-users), scroll to
bottom of page, proceed with instructions under "unsubscribe".

Regarding the discussion:
(I have not looked in the code base nor tried Jans commands)
From what Jan wrote, it looks to me, like there are cases where libmagic
is useful, e.g.:
mp3-files named *.wav, where renaming is inapropriate/impossible (live
downloaded stream, ro filesystem, ...)

Even if this is a singular use case, I'd prefer keeping the
functionality if there is no necessity to remove it (e.g. serious bugs)
or to change the code regarding libmagic (e.g. interface change)

cheers, Erich

On 20.09.2016 15:34, Yemil Aragon wrote:

> Hi everyone.
> With all due respect, how can I unsubscribe from this mailing list? I haven't used SoX for at least a year, maybe two, and I keep getting these multiple emails a day. Thanks.
>> Date: Tue, 20 Sep 2016 15:21:47 +0200
>> From: [hidden email]
>> To: [hidden email]
>> Subject: Re: [SoX-users] sox vs libmagic
>>
>> On Sep 20 11:32:15, [hidden email] wrote:
>>> Jan Stary <[hidden email]> writes:
>>>
>>>>>> Would anyone miss the libmagic functionality
>>>>>> if it was removed from SoX?
>>>>
>>>> On Sep 18 10:27:00, [hidden email] wrote:
>>>>> A few other posters have commented to either enable or disable at
>>>>> compilation time. I am using sox a lot, but have never compiled it
>>>>> myself and would be happy if I hadn't to in the future to either enable
>>>>> or disable libmagic, whatever my preference would be.
>>>>
>>>> On Sep 19 15:51:53, [hidden email] wrote:
>>>>> Until someone can point to a specific problem the feature is causing,
>>>>> I see absolutely no reason for removing it.
>>>>
>>>> I think it goes the other way: there needs to be a specific reason to
>>>> have it in there.
>>>
>>> It's already there, presumably because it was useful to someone.
>>
>> That's exactly what I am asking: is anyone using it?
>> How exactly are you using it? When have you last used it?
>>
>>> I'm against removing features merely because one person lacks the
>>> imagination to see their utility.  If the situation were reversed,
>>> someone sending a patch to add this feature, I'd be asking for examples
>>> of when it is needed.  Change without reason is always misguided.
>>
>> Let's stop with the generalizations and "persons without imagination", OK?
>> I know what libmagic does. I just don't think that it is much useful in SoX.
>> How many misnamed or unrecognizable audio files have you encountered recently?
>> Zero, that's how many. And how did libmagic in SoX help you with that?
>> You can't tell, because you haven't used it. Tell me it's not true.
>>
>> 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.
>>
>> 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:
>>    have you ever done that? No. So you are not using it anyway.
>>
>> 4. It would be one less dependency, and less code.
>>
>> 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.
>>
>> Jan
>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Sox-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/sox-users
>      
>
>
>
> ------------------------------------------------------------------------------
>
>
>
> _______________________________________________
> Sox-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/sox-users
>

------------------------------------------------------------------------------

_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: sox vs libmagic

Jan Stary
In reply to this post by Måns Rullgård
> > 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?

> > 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: the fact that it's there
does not mean someone is using it. With this attitude,
software would just bloat indefinitely.

> > 4. It would be one less dependency, and less code.
>
> The dependency is optional.

Yes.

> The amount of code is negligible.

It's not a matter of amount; just like having e.g. a needless malloc()
is a candidate for removal even if it's one line.

> > 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.

> 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?

        Respectfully,

                Jan


------------------------------------------------------------------------------
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: sox vs libmagic

Jan Stary
In reply to this post by Måns Rullgård
> >> > On Sep 18 10:27:00, [hidden email] wrote:
> >> >> A few other posters have commented to either enable or disable at
> >> >> compilation time. I am using sox a lot, but have never compiled it
> >> >> myself and would be happy if I hadn't to in the future to either enable
> >> >> or disable libmagic, whatever my preference would be.

The SoX binary you are using is either compiled with
or without libmagic support. If you want the other way
(whcichever it may be), you need to recompile.


------------------------------------------------------------------------------
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
123