[Jack-Devel] [PATCH] Jack-1: jack_port_by_name

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

[Jack-Devel] [PATCH] Jack-1: jack_port_by_name

termtech
Hi.

https://dl.dropboxusercontent.com/u/53315356/jack1_port_by_name_fix.diff

This JACK-1 patch fixes a problem in jack_port_by_name()
 and jack_port_by_name_int():

jack_port_by_name_int() did not first search client->ports.

Thus, a pointer returned by jack_port_register() often will not
 be the same as the one returned by jack_port_by_name().


Also, I took the liberty of allowing a forced installation,
 with a special configure flag. There is PLENTY of warning.

I didn't touch version numbers or anything else.

Thanks.
Tim.
The MusE Project.
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Jack-1: jack_port_by_name

Adrian Knoth
On 01/22/15 05:36, Tim E. Real wrote:

> https://dl.dropboxusercontent.com/u/53315356/jack1_port_by_name_fix.diff

Next time, please send the patch to this ML, so it's easier to comment
on it. Like people do on LKML, alsa-devel etc.

The other option would be a github pull request.

Here's your patch.

diff --git configure.ac configure.ac
index 5c20236..d662dfc 100644
--- configure.ac
+++ configure.ac
@@ -8,6 +8,12 @@ dnl
  dnl Check for existing JACK installs
  dnl

+
+
+AC_ARG_ENABLE(force_install,
+        AC_HELP_STRING([--enable-force-install],[force install CAUTION:
Read warnings! (default=no)]),,
+        [ enable_force_install=no ])
+
  AC_MSG_CHECKING([existing, conflicting JACK installs])
  not_overwriting=0
  installs=
@@ -30,22 +36,28 @@ if test $not_overwriting -gt 0 ; then
      echo
      echo "Complete or partial JACK installs exist in:$installs"
      echo
-    echo "Installing this version will leave at least one of these"
-    echo "existing installations installed and this will probably break"
-    echo "JACK on your machine. "
+    echo "WARNING:"
+    echo "Installing multiple jack versions, even in different locations,"
+    echo "could cause JACK to break unless your system is setup properly."
+    echo "Be sure THIS installation is found first in your system's"
+    echo "executable and library paths. Currently some distros such as"
+    echo "Debian (or Ubuntu etc) may incorrectly set the library path."
      echo
-    echo "Before building, you should first remove the existing JACK"
-    echo "installation(s). "
+    echo "Please contact your distribution packager for JACK and"
+    echo "ask them to fix their packaging."
      echo
-    echo "Alternatively use ./configure --prefix=... to force overwriting"
-    echo "the existing install."
+    echo "Alternatively, you might be simply reinstalling THIS version."
+    echo "Or replacing some other local version you built - BE SURE TO"
+    echo "completely uninstall any such previous local install first !"
      echo
-    echo "WARNING: ON ANY DEBIAN-DERIVED DISTRIBUTION (Debian, Ubuntu etc)"
-    echo "CHANGING THE INSTALLATION PREFIX WILL NOT PRODUCE A WORKING JACK"
-    echo "INSTALL. Please contact the distribution packager for JACK and"
-    echo "ask them to fix their packaging."
+    echo "If you KNOW WHAT YOU ARE DOING and are sure you want to proceed,"
+    echo "run ./configure with --enable-force-install"
      echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
-    exit 1
+    echo
+
+    if test "x$enable_force_install" = xno; then
+      exit 1
+    fi
  fi

  AC_CONFIG_AUX_DIR(config)
diff --git include/internal.h include/internal.h
index bf622c8..ffb1d1b 100644
--- include/internal.h
+++ include/internal.h
@@ -537,7 +537,7 @@ extern jack_port_t *jack_port_by_id_int (const
jack_client_t *client,
  jack_port_id_t id, int* free);

  extern jack_port_t *jack_port_by_name_int (jack_client_t *client,
-   const char *port_name);
+   const char *port_name, int* free);
  extern int jack_port_name_equals (jack_port_shared_t* port, const
char* target);

  /** Get the size (in bytes) of the data structure used to store
diff --git libjack/port.c libjack/port.c
index 481f6e0..5ebfea3 100644
--- libjack/port.c
+++ libjack/port.c
@@ -487,8 +487,16 @@ jack_port_by_id (jack_client_t *client,
jack_port_id_t id)
  }

  jack_port_t *
-jack_port_by_name_int (jack_client_t *client, const char *port_name)
+jack_port_by_name_int (jack_client_t *client, const char *port_name,
int* free)
  {
+ JSList *node;
+ for (node = client->ports; node; node = jack_slist_next (node)) {
+ if (jack_port_name_equals(((jack_port_t *) node->data)->shared,
port_name)) {
+ *free = FALSE;
+ return (jack_port_t *) node->data;
+ }
+ }
+
  unsigned long i, limit;
  jack_port_shared_t *port;
 
@@ -497,6 +505,7 @@ jack_port_by_name_int (jack_client_t *client, const
char *port_name)
 
  for (i = 0; i < limit; i++) {
  if (port[i].in_use && jack_port_name_equals (&port[i], port_name)) {
+ *free = TRUE;
  return jack_port_new (client, port[i].id,
       client->engine);
  }
@@ -510,6 +519,7 @@ jack_port_by_name (jack_client_t *client,  const
char *port_name)
  {
  JSList *node;
  jack_port_t* port;
+ int need_free = FALSE;
  for (node = client->ports_ext; node; node = jack_slist_next (node)) {
  port = node->data;
  if (jack_port_name_equals (port->shared, port_name)) {
@@ -518,10 +528,10 @@ jack_port_by_name (jack_client_t *client,  const
char *port_name)
  }
  }
 
- /* Otherwise allocate a new port structure, keep it in the
+ /* Otherwise possibly allocate a new port structure, keep it in the
  * ports_ext list for later use. */
- port = jack_port_by_name_int (client, port_name);
- if (port != NULL)
+ port = jack_port_by_name_int (client, port_name, &need_free);
+ if (port != NULL && need_free)
  client->ports_ext =
  jack_slist_prepend (client->ports_ext, port);
  return port;
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Jack-1: jack_port_by_name

Adrian Knoth
Hi!

> +    echo "Be sure THIS installation is found first in your system's"
> +    echo "executable and library paths. Currently some distros such as"
> +    echo "Debian (or Ubuntu etc) may incorrectly set the library path."

What exactly is wrong with Debian's library path? I see a couple of
problems with this wording:

   * "currently" - this message is going to stay, so will be outdated. It
     doesn't even say what "currently" means.

   * "may incorrectly set" - well, is it wrong or not?

   * "some distros" - too vague

> +    echo "Please contact your distribution packager for JACK and"
> +    echo "ask them to fix their packaging."

Since I'm said packager: tell me what's wrong.

> +    echo "If you KNOW WHAT YOU ARE DOING and are sure you want to
> proceed,"
> +    echo "run ./configure with --enable-force-install"

If you go this route, maybe add "Promise not to ask for help if things
break."

I'll leave the rest of your patch to Paul, since I haven't worked on
jackd for a year now.


Cheers
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Jack-1: jack_port_by_name

termtech
On January 22, 2015 06:25:05 PM Adrian Knoth wrote:

> Hi!
>
> > +    echo "Be sure THIS installation is found first in your system's"
> > +    echo "executable and library paths. Currently some distros such as"
> > +    echo "Debian (or Ubuntu etc) may incorrectly set the library path."
>
> What exactly is wrong with Debian's library path? I see a couple of
> problems with this wording:
>
>    * "currently" - this message is going to stay, so will be outdated. It
>      doesn't even say what "currently" means.
>
>    * "may incorrectly set" - well, is it wrong or not?
>
>    * "some distros" - too vague
>
> > +    echo "Please contact your distribution packager for JACK and"
> > +    echo "ask them to fix their packaging."
>
> Since I'm said packager: tell me what's wrong.
>
> > +    echo "If you KNOW WHAT YOU ARE DOING and are sure you want to
> > proceed,"
> > +    echo "run ./configure with --enable-force-install"
>
> If you go this route, maybe add "Promise not to ask for help if things
> break."
>
> I'll leave the rest of your patch to Paul, since I haven't worked on
> jackd for a year now.
>
>
> Cheers

Well, look, I was trying to keep the 'spirit' of the original message
 without upsetting too much whoever wrote the original,
 while trying to provide some useful pointers.
Have you seen the original message? If not, read it.
 
I am speaking as someone trying to test a manual installation of
 Jack-1 along side a packaged installation of Jack-2.
But perhaps the original author was referring to the actual
 Jack-1 distro package not setting the lib path correctly,
 perhaps that was the thrust of his message.

The original message singled out Debian and variants,
 but I have seen other distros with this problem.
Which is, they don't include /usr/local/lib in /etc/ld.so.conf
My current distro (KUbuntu) did not include it.
So really I don't know exactly how many others don't do it.
I think it's better not to name names at all, just tell users to
 check because the path might not be there.
And what if the user chooses some install location other than
 /usr/local/lib? The user would have to manually edit ld.so.conf
 and exe paths anyway. This is probably what the message should
 really be saying.

I wrote 'may' because I could swear sometimes when I install
 this distro (many times) the path (usr/local/lib) is there.
Maybe when I build other software that uses say, CMake,
 it is automatically done. Maybe not.
I carefully considered what to write there, and figured better
 to say 'may' because who knows, maybe the path IS there.

You can put the message back to the original.

The whole point is, please let people proceed with the installation,
 instead of just exiting. The original message said proceeding was
 supposed to be possible, but it wasn't. So I'm not radically altering
 anything, just fixing a bug in the message.

Whaddya say folks? Does the rest of the patch look OK?

Thanks.
Tim.

_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Jack-1: jack_port_by_name

Jamie Heilman-2
Tim E. Real wrote:
> > > +    echo "executable and library paths. Currently some distros such as"
> > > +    echo "Debian (or Ubuntu etc) may incorrectly set the library path."
...
> Which is, they don't include /usr/local/lib in /etc/ld.so.conf
> My current distro (KUbuntu) did not include it.

[16]cucamonga<~/>cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf

[17]cucamonga<~/>cat /etc/ld.so.conf.d/libc.conf
# libc default configuration
/usr/local/lib
[18]cucamonga<~/>dpkg -S /etc/ld.so.conf.d/libc.conf
libc-bin: /etc/ld.so.conf.d/libc.conf
[19]cucamonga<~/>cat /etc/debian_version
8.0

...
[9]canarsie<~/>cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf

[10]canarsie<~/>cat /etc/ld.so.conf.d/libc.conf
# libc default configuration
/usr/local/lib
[11]canarsie<~/>dpkg -S /etc/ld.so.conf.d/libc.conf
libc-bin: /etc/ld.so.conf.d/libc.conf
[12]canarsie<~/>cat /etc/debian_version
7.8

This isn't a Debian problem.


--
Jamie Heilman                     http://audible.transient.net/~jamie/
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Jack-1: jack_port_by_name

John Rigg-16
In reply to this post by termtech
On Fri, Jan 23, 2015 at 08:33:51PM -0500, Tim E. Real wrote:
> The original message singled out Debian and variants,
>  but I have seen other distros with this problem.
> Which is, they don't include /usr/local/lib in /etc/ld.so.conf

Debian includes it in /etc/ld.so.conf.d/libc.conf. IIRC the original message
referred to the old (confusing) Debian package naming for jack files, but
that was fixed several years ago. Perhaps the Debian reference should now be
removed :-)

John
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Jack-1: jack_port_by_name: REVISED

termtech
On January 24, 2015 02:22:52 PM John Rigg wrote:

> On Fri, Jan 23, 2015 at 08:33:51PM -0500, Tim E. Real wrote:
> > The original message singled out Debian and variants,
> >
> >  but I have seen other distros with this problem.
> >
> > Which is, they don't include /usr/local/lib in /etc/ld.so.conf
>
> Debian includes it in /etc/ld.so.conf.d/libc.conf. IIRC the original message
> referred to the old (confusing) Debian package naming for jack files, but
> that was fixed several years ago. Perhaps the Debian reference should now
> be removed :-)
>
> John

OK. Apologies, should have asked first.
Once again I reach a wrong conclusion, where it ends up here  ;-)
My KUbuntu didn't have the path and I've been through this before,
 I was certain that was the source of the message.

I offer this revised straight forward, stern yet toned down patch.
Tim.

(Your old .asoundrc examples  helped me with multiple cards. big thx.)


https://dl.dropboxusercontent.com/u/53315356/jack1_port_by_name_fix_ver_2.diff

diff --git configure.ac configure.ac
index 5c20236..aee4346 100644
--- configure.ac
+++ configure.ac
@@ -8,6 +8,12 @@ dnl
 dnl Check for existing JACK installs
 dnl
 
+
+
+AC_ARG_ENABLE(force_install,
+        AC_HELP_STRING([--enable-force-install],[force install CAUTION: Read
warnings! (default=no)]),,
+        [ enable_force_install=no ])
+        
 AC_MSG_CHECKING([existing, conflicting JACK installs])
 not_overwriting=0
 installs=
@@ -30,22 +36,24 @@ if test $not_overwriting -gt 0 ; then
     echo
     echo "Complete or partial JACK installs exist in:$installs"
     echo
-    echo "Installing this version will leave at least one of these"
-    echo "existing installations installed and this will probably break"
-    echo "JACK on your machine. "
+    echo "WARNING:"
+    echo "Installing multiple jack versions, even in different locations,"
+    echo "could cause JACK to break unless your system is setup properly."
+    echo "Be sure THIS installation is found first in your system's"
+    echo "executable and library paths."
     echo
-    echo "Before building, you should first remove the existing JACK"
-    echo "installation(s). "
+    echo "Alternatively, you might be simply reinstalling THIS version."
+    echo "Or replacing some other local version you built - BE SURE TO"
+    echo "completely uninstall any such previous local install first !"
     echo
-    echo "Alternatively use ./configure --prefix=... to force overwriting"
-    echo "the existing install."
-    echo
-    echo "WARNING: ON ANY DEBIAN-DERIVED DISTRIBUTION (Debian, Ubuntu etc)"
-    echo "CHANGING THE INSTALLATION PREFIX WILL NOT PRODUCE A WORKING JACK"
-    echo "INSTALL. Please contact the distribution packager for JACK and"
-    echo "ask them to fix their packaging."
+    echo "If you KNOW WHAT YOU ARE DOING and are sure you want to proceed,"
+    echo "run ./configure with --enable-force-install"
     echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
-    exit 1
+    echo
+    
+    if test "x$enable_force_install" = xno; then
+      exit 1
+    fi  
 fi
 
 AC_CONFIG_AUX_DIR(config)
diff --git include/internal.h include/internal.h
index bf622c8..ffb1d1b 100644
--- include/internal.h
+++ include/internal.h
@@ -537,7 +537,7 @@ extern jack_port_t *jack_port_by_id_int (const
jack_client_t *client,
  jack_port_id_t id, int* free);
 
 extern jack_port_t *jack_port_by_name_int (jack_client_t *client,
-   const char *port_name);
+   const char *port_name, int* free);
 extern int jack_port_name_equals (jack_port_shared_t* port, const char*
target);
 
 /** Get the size (in bytes) of the data structure used to store
diff --git libjack/port.c libjack/port.c
index 481f6e0..5ebfea3 100644
--- libjack/port.c
+++ libjack/port.c
@@ -487,8 +487,16 @@ jack_port_by_id (jack_client_t *client, jack_port_id_t
id)
 }
 
 jack_port_t *
-jack_port_by_name_int (jack_client_t *client, const char *port_name)
+jack_port_by_name_int (jack_client_t *client, const char *port_name, int*
free)
 {
+ JSList *node;
+ for (node = client->ports; node; node = jack_slist_next (node)) {
+ if (jack_port_name_equals(((jack_port_t *) node->data)->shared,
port_name)) {
+ *free = FALSE;
+ return (jack_port_t *) node->data;
+ }
+ }
+
  unsigned long i, limit;
  jack_port_shared_t *port;
 
@@ -497,6 +505,7 @@ jack_port_by_name_int (jack_client_t *client, const char
*port_name)
 
  for (i = 0; i < limit; i++) {
  if (port[i].in_use && jack_port_name_equals (&port[i], port_name)) {
+ *free = TRUE;
  return jack_port_new (client, port[i].id,
       client->engine);
  }
@@ -510,6 +519,7 @@ jack_port_by_name (jack_client_t *client,  const char
*port_name)
 {
  JSList *node;
  jack_port_t* port;
+ int need_free = FALSE;
  for (node = client->ports_ext; node; node = jack_slist_next (node)) {
  port = node->data;
  if (jack_port_name_equals (port->shared, port_name)) {
@@ -518,10 +528,10 @@ jack_port_by_name (jack_client_t *client,  const char
*port_name)
  }
  }
 
- /* Otherwise allocate a new port structure, keep it in the
+ /* Otherwise possibly allocate a new port structure, keep it in the
  * ports_ext list for later use. */
- port = jack_port_by_name_int (client, port_name);
- if (port != NULL)
+ port = jack_port_by_name_int (client, port_name, &need_free);
+ if (port != NULL && need_free)
  client->ports_ext =
  jack_slist_prepend (client->ports_ext, port);
  return port;

_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Jack-1: jack_port_by_name

David Nielson-2
In reply to this post by Adrian Knoth
On 01/22/2015 11:25 AM, Adrian Knoth wrote:
>
> Since I'm said packager: tell me what's wrong.
>

Any time I start with a Debian desktop system and want to install Jack
from source, I must do this first, or the wrong libraries get
dynamically loaded, and jackd doesn't work:

sudo rm -f /usr/lib/x86_64-linux-gnu/libjack*

This isn't the jackd package; I'm not sure what it is. I never install
Debian's jack package, so I can't give you more information than this,
at least not now.

Thanks,

David Nielson
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Jack-1: jack_port_by_name

termtech
In reply to this post by Adrian Knoth
On January 22, 2015 05:46:15 PM Adrian Knoth wrote:
> On 01/22/15 05:36, Tim E. Real wrote:
> > https://dl.dropboxusercontent.com/u/53315356/jack1_port_by_name_fix.diff
>
> Next time, please send the patch to this ML, so it's easier to comment
> on it. Like people do on LKML, alsa-devel etc.
>
> The other option would be a github pull request.

OK. Some lists want a link or attached file, especially with large patches.

Is github pull request preferred over email? I feel so old school.

We've been with git for a while but I still struggle to learn.
I guess it makes the process automated rather than someone here
 having to apply it for me, and discussions can  take place there.

Thanks for your help.
Tim.
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Jack-1: jack_port_by_name

termtech
In reply to this post by David Nielson-2
On January 24, 2015 03:04:57 PM David Nielson wrote:
> On 01/22/2015 11:25 AM, Adrian Knoth wrote:
> > Since I'm said packager: tell me what's wrong.
>
> Any time I start with a Debian desktop system and want to install Jack
> from source, I must do this first, or the wrong libraries get
> dynamically loaded, and jackd doesn't work:
>
> sudo rm -f /usr/lib/x86_64-linux-gnu/libjack*

Yikes!
No I certainly would not recommend doing that!

This sounds like exactly the problem we have been speaking of
 which is solved by checking/fixing the library/executable paths,
 just as the ./configure message warns of.

After fixing the library paths you MUST run 'ldconfig' as root.
I did not mention it, but it usually goes without saying.

You may want to change path settings in apps, for example in
 QJackCtl you might want to change the path to jackd.


I have both Jack-1 and Jack-2 installed and they both run fine,
 even with pulse audio.
To switch between Jack-1 and Jack-2 I simply uninstall or reinstall
 Jack-1 and rerun 'ldconfig' as root.
Instead, I could leave them both, re-edit ld.so.conf and rerun 'ldconfig'
 but that is simply the easier way for me.


Check/perform these general steps with any software built locally,
 especially if overriding a packaged version.
Packages are not always easy to remove.
Most locally built software should work fine without removing
 or disrupting packages.

Tim.

>
> This isn't the jackd package; I'm not sure what it is. I never install
> Debian's jack package, so I can't give you more information than this,
> at least not now.
>
> Thanks,
>
> David Nielson

_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Jack-1: jack_port_by_name

John Rigg-16
In reply to this post by David Nielson-2
On Sat, Jan 24, 2015 at 03:04:57PM -0600, David Nielson wrote:

> On 01/22/2015 11:25 AM, Adrian Knoth wrote:
> >
> > Since I'm said packager: tell me what's wrong.
> >
>
> Any time I start with a Debian desktop system and want to install Jack
> from source, I must do this first, or the wrong libraries get
> dynamically loaded, and jackd doesn't work:
>
> sudo rm -f /usr/lib/x86_64-linux-gnu/libjack*

That's strange. The Debian jack packages have been working fine here
for quite a while now.

You do need to specify --prefix=usr --libdir=/usr/lib/x86_64-linux-gnu
at the configure stage if you want to install a locally compiled
version over the package files.

John
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Jack-1: jack_port_by_name

John Rigg-16
On Sun, Jan 25, 2015 at 08:47:19AM +0000, John Rigg wrote:
> You do need to specify --prefix=usr --libdir=/usr/lib/x86_64-linux-gnu
> at the configure stage if you want to install a locally compiled
> version over the package files.

Sorry, typo. Should be --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu, eg.:

./configure --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --alsa --firewire


John
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Jack-1: jack_port_by_name

David Nielson-2
In reply to this post by John Rigg-16

On 01/25/2015 02:47 AM, John Rigg wrote:
>
> You do need to specify --prefix=usr --libdir=/usr/lib/x86_64-linux-gnu
> at the configure stage if you want to install a locally compiled
> version over the package files.
>

Ah! I didn't know about libdir. I will update my procedures. Thanks!

David Nielson
_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Jack-1: jack_port_by_name: REVISED

termtech
In reply to this post by termtech
Hello? Anyone home?

Paul, have you had a chance to evaluate this?

Thanks.
Tim.

On January 24, 2015 03:30:51 PM Tim E. Real wrote:

> On January 24, 2015 02:22:52 PM John Rigg wrote:
> > On Fri, Jan 23, 2015 at 08:33:51PM -0500, Tim E. Real wrote:
> > > The original message singled out Debian and variants,
> > >
> > >  but I have seen other distros with this problem.
> > >
> > > Which is, they don't include /usr/local/lib in /etc/ld.so.conf
> >
> > Debian includes it in /etc/ld.so.conf.d/libc.conf. IIRC the original
> > message referred to the old (confusing) Debian package naming for jack
> > files, but that was fixed several years ago. Perhaps the Debian reference
> > should now be removed :-)
> >
> > John
>
> OK. Apologies, should have asked first.
> Once again I reach a wrong conclusion, where it ends up here  ;-)
> My KUbuntu didn't have the path and I've been through this before,
>  I was certain that was the source of the message.
>
> I offer this revised straight forward, stern yet toned down patch.
> Tim.
>
> (Your old .asoundrc examples  helped me with multiple cards. big thx.)
>
>
> https://dl.dropboxusercontent.com/u/53315356/jack1_port_by_name_fix_ver_2.di
> ff
>
> diff --git configure.ac configure.ac
> index 5c20236..aee4346 100644
> --- configure.ac
> +++ configure.ac
> @@ -8,6 +8,12 @@ dnl
>  dnl Check for existing JACK installs
>  dnl
>
> +
> +
> +AC_ARG_ENABLE(force_install,
> +        AC_HELP_STRING([--enable-force-install],[force install CAUTION:
> Read warnings! (default=no)]),,
> +        [ enable_force_install=no ])
> +
>  AC_MSG_CHECKING([existing, conflicting JACK installs])
>  not_overwriting=0
>  installs=
> @@ -30,22 +36,24 @@ if test $not_overwriting -gt 0 ; then
>      echo
>      echo "Complete or partial JACK installs exist in:$installs"
>      echo
> -    echo "Installing this version will leave at least one of these"
> -    echo "existing installations installed and this will probably break"
> -    echo "JACK on your machine. "
> +    echo "WARNING:"
> +    echo "Installing multiple jack versions, even in different locations,"
> +    echo "could cause JACK to break unless your system is setup properly."
> +    echo "Be sure THIS installation is found first in your system's"
> +    echo "executable and library paths."
>      echo
> -    echo "Before building, you should first remove the existing JACK"
> -    echo "installation(s). "
> +    echo "Alternatively, you might be simply reinstalling THIS version."
> +    echo "Or replacing some other local version you built - BE SURE TO"
> +    echo "completely uninstall any such previous local install first !"
>      echo
> -    echo "Alternatively use ./configure --prefix=... to force overwriting"
> -    echo "the existing install."
> -    echo
> -    echo "WARNING: ON ANY DEBIAN-DERIVED DISTRIBUTION (Debian, Ubuntu etc)"
> -    echo "CHANGING THE INSTALLATION PREFIX WILL NOT PRODUCE A WORKING
> JACK" -    echo "INSTALL. Please contact the distribution packager for JACK
> and" -    echo "ask them to fix their packaging."
> +    echo "If you KNOW WHAT YOU ARE DOING and are sure you want to proceed,"
> +    echo "run ./configure with --enable-force-install"
>      echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
> -    exit 1
> +    echo
> +
> +    if test "x$enable_force_install" = xno; then
> +      exit 1
> +    fi
>  fi
>
>  AC_CONFIG_AUX_DIR(config)
> diff --git include/internal.h include/internal.h
> index bf622c8..ffb1d1b 100644
> --- include/internal.h
> +++ include/internal.h
> @@ -537,7 +537,7 @@ extern jack_port_t *jack_port_by_id_int (const
> jack_client_t *client,
>   jack_port_id_t id, int* free);
>
>  extern jack_port_t *jack_port_by_name_int (jack_client_t *client,
> -   const char *port_name);
> +   const char *port_name, int* free);
>  extern int jack_port_name_equals (jack_port_shared_t* port, const char*
> target);
>
>  /** Get the size (in bytes) of the data structure used to store
> diff --git libjack/port.c libjack/port.c
> index 481f6e0..5ebfea3 100644
> --- libjack/port.c
> +++ libjack/port.c
> @@ -487,8 +487,16 @@ jack_port_by_id (jack_client_t *client, jack_port_id_t
> id)
>  }
>
>  jack_port_t *
> -jack_port_by_name_int (jack_client_t *client, const char *port_name)
> +jack_port_by_name_int (jack_client_t *client, const char *port_name, int*
> free)
>  {
> + JSList *node;
> + for (node = client->ports; node; node = jack_slist_next (node)) {
> + if (jack_port_name_equals(((jack_port_t *) node->data)->shared,
> port_name)) {
> + *free = FALSE;
> + return (jack_port_t *) node->data;
> + }
> + }
> +
>   unsigned long i, limit;
>   jack_port_shared_t *port;
>
> @@ -497,6 +505,7 @@ jack_port_by_name_int (jack_client_t *client, const char
> *port_name)
>
>   for (i = 0; i < limit; i++) {
>   if (port[i].in_use && jack_port_name_equals (&port[i], port_name)) {
> + *free = TRUE;
>   return jack_port_new (client, port[i].id,
>        client->engine);
>   }
> @@ -510,6 +519,7 @@ jack_port_by_name (jack_client_t *client,  const char
> *port_name)
>  {
>   JSList *node;
>   jack_port_t* port;
> + int need_free = FALSE;
>   for (node = client->ports_ext; node; node = jack_slist_next (node)) {
>   port = node->data;
>   if (jack_port_name_equals (port->shared, port_name)) {
> @@ -518,10 +528,10 @@ jack_port_by_name (jack_client_t *client,  const char
> *port_name)
>   }
>   }
>
> - /* Otherwise allocate a new port structure, keep it in the
> + /* Otherwise possibly allocate a new port structure, keep it in the
>   * ports_ext list for later use. */
> - port = jack_port_by_name_int (client, port_name);
> - if (port != NULL)
> + port = jack_port_by_name_int (client, port_name, &need_free);
> + if (port != NULL && need_free)
>   client->ports_ext =
>   jack_slist_prepend (client->ports_ext, port);
>   return port;
>

_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Jack-1: jack_port_by_name: REVISED

Paul Davis


On Wed, Feb 18, 2015 at 7:40 PM, Tim E. Real <[hidden email]> wrote:
Hello? Anyone home?

Paul, have you had a chance to evaluate this

Looks superb to me. And much appreciated. Just need a change to pull it. Ping me again if it doesn't happen soon.
 

_______________________________________________
Jack-Devel mailing list
[hidden email]
http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org