alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* udev rules prefix
@ 2013-11-13 20:36 Ivailo
  2013-11-14  2:48 ` David Henningsson
  2013-11-14  6:45 ` Takashi Iwai
  0 siblings, 2 replies; 13+ messages in thread
From: Ivailo @ 2013-11-13 20:36 UTC (permalink / raw)
  To: alsa-devel

Hello,

the default prefix for alsa-utils is /usr however the udev rules directory
is /lib/udev/rules.d thus on setups with separate partition for /usr the
binaries, from /usr/bin and /usr/sbin, will likely not be available during
the boot process and the udev rule will fail to restore the state.

I suggest that the udev rules directory follows the prefix or append /usr
to it to resolve this.

Cheers!

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: udev rules prefix
  2013-11-13 20:36 udev rules prefix Ivailo
@ 2013-11-14  2:48 ` David Henningsson
  2013-11-14  6:45 ` Takashi Iwai
  1 sibling, 0 replies; 13+ messages in thread
From: David Henningsson @ 2013-11-14  2:48 UTC (permalink / raw)
  To: Ivailo, alsa-devel

On 11/13/2013 09:36 PM, Ivailo wrote:
> Hello,
> 
> the default prefix for alsa-utils is /usr however the udev rules directory
> is /lib/udev/rules.d thus on setups with separate partition for /usr the
> binaries, from /usr/bin and /usr/sbin, will likely not be available during
> the boot process and the udev rule will fail to restore the state.
> 
> I suggest that the udev rules directory follows the prefix or append /usr
> to it to resolve this.
> 
> Cheers!

Hi,

ALSA merely follows what udev dictates, so I think your
question/suggestion is better redirected on the udev (now systemd)
mailinglist. Or potentially that of your distro.

-- 
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: udev rules prefix
  2013-11-13 20:36 udev rules prefix Ivailo
  2013-11-14  2:48 ` David Henningsson
@ 2013-11-14  6:45 ` Takashi Iwai
  2013-11-14 12:08   ` Ivailo Monev
  1 sibling, 1 reply; 13+ messages in thread
From: Takashi Iwai @ 2013-11-14  6:45 UTC (permalink / raw)
  To: Ivailo; +Cc: alsa-devel

At Wed, 13 Nov 2013 20:36:48 +0000,
Ivailo wrote:
> 
> Hello,
> 
> the default prefix for alsa-utils is /usr however the udev rules directory
> is /lib/udev/rules.d thus on setups with separate partition for /usr the
> binaries, from /usr/bin and /usr/sbin, will likely not be available during
> the boot process and the udev rule will fail to restore the state.

Not true.  /lib must be always present at boot even if /usr isn't
mounted.  That's the reason why /lib/udev was chosen as default in the
past.


Takashi

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: udev rules prefix
  2013-11-14 12:08   ` Ivailo Monev
@ 2013-11-14  9:42     ` Takashi Iwai
  2013-11-14 13:24       ` Ivailo Monev
  0 siblings, 1 reply; 13+ messages in thread
From: Takashi Iwai @ 2013-11-14  9:42 UTC (permalink / raw)
  To: Ivailo Monev; +Cc: alsa-devel

At Thu, 14 Nov 2013 12:08:47 +0000,
Ivailo Monev wrote:
> 
> On 11/14/13 02:48, David Henningsson wrote:
> > On 11/13/2013 09:36 PM, Ivailo wrote:
> >> Hello,
> >>
> >> the default prefix for alsa-utils is /usr however the udev rules directory
> >> is /lib/udev/rules.d thus on setups with separate partition for /usr the
> >> binaries, from /usr/bin and /usr/sbin, will likely not be available during
> >> the boot process and the udev rule will fail to restore the state.
> >>
> >> I suggest that the udev rules directory follows the prefix or append /usr
> >> to it to resolve this.
> >>
> >> Cheers!
> > Hi,
> >
> > ALSA merely follows what udev dictates, so I think your
> > question/suggestion is better redirected on the udev (now systemd)
> > mailinglist. Or potentially that of your distro.
> >
> Actually, you are not following what udev dictates (unless I'm missing 
> something).
> By default, systemd (and more importantly udev) will be installed with 
> /usr prefix
> (which is wrong in it self because it blindly assumes that /usr has been 
> mounted
> via initrd/initramfs where separate /usr partition is in use but let's 
> not talk about
> this here).
> 
> 
> On 11/14/13 06:45, Takashi Iwai wrote:
> > At Wed, 13 Nov 2013 20:36:48 +0000,
> > Ivailo wrote:
> >> Hello,
> >>
> >> the default prefix for alsa-utils is /usr however the udev rules directory
> >> is /lib/udev/rules.d thus on setups with separate partition for /usr the
> >> binaries, from /usr/bin and /usr/sbin, will likely not be available during
> >> the boot process and the udev rule will fail to restore the state.
> > Not true.  /lib must be always present at boot even if /usr isn't
> > mounted.  That's the reason why /lib/udev was chosen as default in the
> > past.
> >
> >
> > Takashi
> You got me wrong, I know that /lib should be available on early boot 
> (unless it's a
> symlink, like in Arch Linux) but the point is that since the alsa-utils 
> binaries are
> installed in /usr so should be the udev rules otherwise during boot 
> without /usr
> being mounted you will see error message about /usr/sbin/alsactl.

Theoretically yes, but this has been rather less problems than
creating a non-existing /usr/lib/udev in the past.  That's the very
reason of hard-coded /lib/udev.  Changing the default behavior is
often worse unless you really do it carefully with consideration of
compatibility with old systems.

So, if you want to change the default, don't hard code again.  Make
configure to guess the right place.  A patch achieving it is welcome.


Takashi

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: udev rules prefix
  2013-11-14 13:24       ` Ivailo Monev
@ 2013-11-14 10:51         ` Takashi Iwai
  2013-11-14 18:49           ` Ivailo Monev
  0 siblings, 1 reply; 13+ messages in thread
From: Takashi Iwai @ 2013-11-14 10:51 UTC (permalink / raw)
  To: Ivailo Monev; +Cc: alsa-devel

At Thu, 14 Nov 2013 13:24:49 +0000,
Ivailo Monev wrote:
> 
> On 11/14/13 09:42, Takashi Iwai wrote:
> > At Thu, 14 Nov 2013 12:08:47 +0000,
> > Ivailo Monev wrote:
> >> On 11/14/13 02:48, David Henningsson wrote:
> >>> On 11/13/2013 09:36 PM, Ivailo wrote:
> >>>> Hello,
> >>>>
> >>>> the default prefix for alsa-utils is /usr however the udev rules directory
> >>>> is /lib/udev/rules.d thus on setups with separate partition for /usr the
> >>>> binaries, from /usr/bin and /usr/sbin, will likely not be available during
> >>>> the boot process and the udev rule will fail to restore the state.
> >>>>
> >>>> I suggest that the udev rules directory follows the prefix or append /usr
> >>>> to it to resolve this.
> >>>>
> >>>> Cheers!
> >>> Hi,
> >>>
> >>> ALSA merely follows what udev dictates, so I think your
> >>> question/suggestion is better redirected on the udev (now systemd)
> >>> mailinglist. Or potentially that of your distro.
> >>>
> >> Actually, you are not following what udev dictates (unless I'm missing
> >> something).
> >> By default, systemd (and more importantly udev) will be installed with
> >> /usr prefix
> >> (which is wrong in it self because it blindly assumes that /usr has been
> >> mounted
> >> via initrd/initramfs where separate /usr partition is in use but let's
> >> not talk about
> >> this here).
> >>
> >>
> >> On 11/14/13 06:45, Takashi Iwai wrote:
> >>> At Wed, 13 Nov 2013 20:36:48 +0000,
> >>> Ivailo wrote:
> >>>> Hello,
> >>>>
> >>>> the default prefix for alsa-utils is /usr however the udev rules directory
> >>>> is /lib/udev/rules.d thus on setups with separate partition for /usr the
> >>>> binaries, from /usr/bin and /usr/sbin, will likely not be available during
> >>>> the boot process and the udev rule will fail to restore the state.
> >>> Not true.  /lib must be always present at boot even if /usr isn't
> >>> mounted.  That's the reason why /lib/udev was chosen as default in the
> >>> past.
> >>>
> >>>
> >>> Takashi
> >> You got me wrong, I know that /lib should be available on early boot
> >> (unless it's a
> >> symlink, like in Arch Linux) but the point is that since the alsa-utils
> >> binaries are
> >> installed in /usr so should be the udev rules otherwise during boot
> >> without /usr
> >> being mounted you will see error message about /usr/sbin/alsactl.
> > Theoretically yes, but this has been rather less problems than
> > creating a non-existing /usr/lib/udev in the past.  That's the very
> > reason of hard-coded /lib/udev.  Changing the default behavior is
> > often worse unless you really do it carefully with consideration of
> > compatibility with old systems.
> >
> > So, if you want to change the default, don't hard code again.  Make
> > configure to guess the right place.  A patch achieving it is welcome.
> >
> >
> > Takashi
> Ok, here is the patch:
> 
>  From 74faeceb26c4730d6150e726792f6eb1f257b03e Mon Sep 17 00:00:00 2001
> From: Ivailo Monev <xakepa10@gmail.com>
> Date: Thu, 14 Nov 2013 13:13:43 +0000
> Subject: [PATCH 1/1] detect udevdir via pkg-config
> 
> ---
>   configure.in | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/configure.in b/configure.in
> index 3ae3209..74b891e 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -121,7 +121,7 @@ AM_CONDITIONAL(USE_XMLTO, test x"$xmlto" = xyes)
>   AC_ARG_WITH(
>           [udev-rules-dir],
>           AS_HELP_STRING([--with-udev-rules-dir],[Directory where to 
> install udev rules to (defaults to /lib/udev/rules.d)]),
> -        [udevrulesdir=$withval], [udevrulesdir="/lib/udev/rules.d"])
> +        [udevrulesdir=$withval], [udevrulesdir=$($PKG_CONFIG udev 
> --variable=udevdir)"/rules.d"])
>   AC_SUBST(udevrulesdir)

This pkg-config option isn't always available.  Make sure to have a
proper fallback to /lib/udev/rules.d.  Also, update the help text,
too.


thanks,

Takashi

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: udev rules prefix
  2013-11-14  6:45 ` Takashi Iwai
@ 2013-11-14 12:08   ` Ivailo Monev
  2013-11-14  9:42     ` Takashi Iwai
  0 siblings, 1 reply; 13+ messages in thread
From: Ivailo Monev @ 2013-11-14 12:08 UTC (permalink / raw)
  Cc: alsa-devel

On 11/14/13 02:48, David Henningsson wrote:
> On 11/13/2013 09:36 PM, Ivailo wrote:
>> Hello,
>>
>> the default prefix for alsa-utils is /usr however the udev rules directory
>> is /lib/udev/rules.d thus on setups with separate partition for /usr the
>> binaries, from /usr/bin and /usr/sbin, will likely not be available during
>> the boot process and the udev rule will fail to restore the state.
>>
>> I suggest that the udev rules directory follows the prefix or append /usr
>> to it to resolve this.
>>
>> Cheers!
> Hi,
>
> ALSA merely follows what udev dictates, so I think your
> question/suggestion is better redirected on the udev (now systemd)
> mailinglist. Or potentially that of your distro.
>
Actually, you are not following what udev dictates (unless I'm missing 
something).
By default, systemd (and more importantly udev) will be installed with 
/usr prefix
(which is wrong in it self because it blindly assumes that /usr has been 
mounted
via initrd/initramfs where separate /usr partition is in use but let's 
not talk about
this here).


On 11/14/13 06:45, Takashi Iwai wrote:
> At Wed, 13 Nov 2013 20:36:48 +0000,
> Ivailo wrote:
>> Hello,
>>
>> the default prefix for alsa-utils is /usr however the udev rules directory
>> is /lib/udev/rules.d thus on setups with separate partition for /usr the
>> binaries, from /usr/bin and /usr/sbin, will likely not be available during
>> the boot process and the udev rule will fail to restore the state.
> Not true.  /lib must be always present at boot even if /usr isn't
> mounted.  That's the reason why /lib/udev was chosen as default in the
> past.
>
>
> Takashi
You got me wrong, I know that /lib should be available on early boot 
(unless it's a
symlink, like in Arch Linux) but the point is that since the alsa-utils 
binaries are
installed in /usr so should be the udev rules otherwise during boot 
without /usr
being mounted you will see error message about /usr/sbin/alsactl.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: udev rules prefix
  2013-11-14  9:42     ` Takashi Iwai
@ 2013-11-14 13:24       ` Ivailo Monev
  2013-11-14 10:51         ` Takashi Iwai
  0 siblings, 1 reply; 13+ messages in thread
From: Ivailo Monev @ 2013-11-14 13:24 UTC (permalink / raw)
  To: alsa-devel

On 11/14/13 09:42, Takashi Iwai wrote:
> At Thu, 14 Nov 2013 12:08:47 +0000,
> Ivailo Monev wrote:
>> On 11/14/13 02:48, David Henningsson wrote:
>>> On 11/13/2013 09:36 PM, Ivailo wrote:
>>>> Hello,
>>>>
>>>> the default prefix for alsa-utils is /usr however the udev rules directory
>>>> is /lib/udev/rules.d thus on setups with separate partition for /usr the
>>>> binaries, from /usr/bin and /usr/sbin, will likely not be available during
>>>> the boot process and the udev rule will fail to restore the state.
>>>>
>>>> I suggest that the udev rules directory follows the prefix or append /usr
>>>> to it to resolve this.
>>>>
>>>> Cheers!
>>> Hi,
>>>
>>> ALSA merely follows what udev dictates, so I think your
>>> question/suggestion is better redirected on the udev (now systemd)
>>> mailinglist. Or potentially that of your distro.
>>>
>> Actually, you are not following what udev dictates (unless I'm missing
>> something).
>> By default, systemd (and more importantly udev) will be installed with
>> /usr prefix
>> (which is wrong in it self because it blindly assumes that /usr has been
>> mounted
>> via initrd/initramfs where separate /usr partition is in use but let's
>> not talk about
>> this here).
>>
>>
>> On 11/14/13 06:45, Takashi Iwai wrote:
>>> At Wed, 13 Nov 2013 20:36:48 +0000,
>>> Ivailo wrote:
>>>> Hello,
>>>>
>>>> the default prefix for alsa-utils is /usr however the udev rules directory
>>>> is /lib/udev/rules.d thus on setups with separate partition for /usr the
>>>> binaries, from /usr/bin and /usr/sbin, will likely not be available during
>>>> the boot process and the udev rule will fail to restore the state.
>>> Not true.  /lib must be always present at boot even if /usr isn't
>>> mounted.  That's the reason why /lib/udev was chosen as default in the
>>> past.
>>>
>>>
>>> Takashi
>> You got me wrong, I know that /lib should be available on early boot
>> (unless it's a
>> symlink, like in Arch Linux) but the point is that since the alsa-utils
>> binaries are
>> installed in /usr so should be the udev rules otherwise during boot
>> without /usr
>> being mounted you will see error message about /usr/sbin/alsactl.
> Theoretically yes, but this has been rather less problems than
> creating a non-existing /usr/lib/udev in the past.  That's the very
> reason of hard-coded /lib/udev.  Changing the default behavior is
> often worse unless you really do it carefully with consideration of
> compatibility with old systems.
>
> So, if you want to change the default, don't hard code again.  Make
> configure to guess the right place.  A patch achieving it is welcome.
>
>
> Takashi
Ok, here is the patch:

 From 74faeceb26c4730d6150e726792f6eb1f257b03e Mon Sep 17 00:00:00 2001
From: Ivailo Monev <xakepa10@gmail.com>
Date: Thu, 14 Nov 2013 13:13:43 +0000
Subject: [PATCH 1/1] detect udevdir via pkg-config

---
  configure.in | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.in b/configure.in
index 3ae3209..74b891e 100644
--- a/configure.in
+++ b/configure.in
@@ -121,7 +121,7 @@ AM_CONDITIONAL(USE_XMLTO, test x"$xmlto" = xyes)
  AC_ARG_WITH(
          [udev-rules-dir],
          AS_HELP_STRING([--with-udev-rules-dir],[Directory where to 
install udev rules to (defaults to /lib/udev/rules.d)]),
-        [udevrulesdir=$withval], [udevrulesdir="/lib/udev/rules.d"])
+        [udevrulesdir=$withval], [udevrulesdir=$($PKG_CONFIG udev 
--variable=udevdir)"/rules.d"])
  AC_SUBST(udevrulesdir)

  dnl Checks for header files.
-- 
1.8.3.4

However, since udev must reside on root (/) in the first place
the alsa-utils rules will still be installed in /lib/udev/rules.d. So
this patch will improve the current rules placement but will
not solve the separate /usr issue I'm talking about. I know
that hard coding paths is not a good idea in general but the
way I see it it's the best option and this patch should not be
used. I'm providing it just in case you don't agree with me on
using /usr/lib/udev/rules.d as default rules placement directory.

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: udev rules prefix
  2013-11-14 18:49           ` Ivailo Monev
@ 2013-11-14 16:14             ` Takashi Iwai
  2013-11-15 13:16               ` Ivailo Monev
  0 siblings, 1 reply; 13+ messages in thread
From: Takashi Iwai @ 2013-11-14 16:14 UTC (permalink / raw)
  To: Ivailo Monev; +Cc: alsa-devel

At Thu, 14 Nov 2013 18:49:02 +0000,
Ivailo Monev wrote:
> 
> On 11/14/13 10:51, Takashi Iwai wrote:
> > At Thu, 14 Nov 2013 13:24:49 +0000,
> > Ivailo Monev wrote:
> >> On 11/14/13 09:42, Takashi Iwai wrote:
> >>> At Thu, 14 Nov 2013 12:08:47 +0000,
> >>> Ivailo Monev wrote:
> >>>> On 11/14/13 02:48, David Henningsson wrote:
> >>>>> On 11/13/2013 09:36 PM, Ivailo wrote:
> >>>>>> Hello,
> >>>>>>
> >>>>>> the default prefix for alsa-utils is /usr however the udev rules directory
> >>>>>> is /lib/udev/rules.d thus on setups with separate partition for /usr the
> >>>>>> binaries, from /usr/bin and /usr/sbin, will likely not be available during
> >>>>>> the boot process and the udev rule will fail to restore the state.
> >>>>>>
> >>>>>> I suggest that the udev rules directory follows the prefix or append /usr
> >>>>>> to it to resolve this.
> >>>>>>
> >>>>>> Cheers!
> >>>>> Hi,
> >>>>>
> >>>>> ALSA merely follows what udev dictates, so I think your
> >>>>> question/suggestion is better redirected on the udev (now systemd)
> >>>>> mailinglist. Or potentially that of your distro.
> >>>>>
> >>>> Actually, you are not following what udev dictates (unless I'm missing
> >>>> something).
> >>>> By default, systemd (and more importantly udev) will be installed with
> >>>> /usr prefix
> >>>> (which is wrong in it self because it blindly assumes that /usr has been
> >>>> mounted
> >>>> via initrd/initramfs where separate /usr partition is in use but let's
> >>>> not talk about
> >>>> this here).
> >>>>
> >>>>
> >>>> On 11/14/13 06:45, Takashi Iwai wrote:
> >>>>> At Wed, 13 Nov 2013 20:36:48 +0000,
> >>>>> Ivailo wrote:
> >>>>>> Hello,
> >>>>>>
> >>>>>> the default prefix for alsa-utils is /usr however the udev rules directory
> >>>>>> is /lib/udev/rules.d thus on setups with separate partition for /usr the
> >>>>>> binaries, from /usr/bin and /usr/sbin, will likely not be available during
> >>>>>> the boot process and the udev rule will fail to restore the state.
> >>>>> Not true.  /lib must be always present at boot even if /usr isn't
> >>>>> mounted.  That's the reason why /lib/udev was chosen as default in the
> >>>>> past.
> >>>>>
> >>>>>
> >>>>> Takashi
> >>>> You got me wrong, I know that /lib should be available on early boot
> >>>> (unless it's a
> >>>> symlink, like in Arch Linux) but the point is that since the alsa-utils
> >>>> binaries are
> >>>> installed in /usr so should be the udev rules otherwise during boot
> >>>> without /usr
> >>>> being mounted you will see error message about /usr/sbin/alsactl.
> >>> Theoretically yes, but this has been rather less problems than
> >>> creating a non-existing /usr/lib/udev in the past.  That's the very
> >>> reason of hard-coded /lib/udev.  Changing the default behavior is
> >>> often worse unless you really do it carefully with consideration of
> >>> compatibility with old systems.
> >>>
> >>> So, if you want to change the default, don't hard code again.  Make
> >>> configure to guess the right place.  A patch achieving it is welcome.
> >>>
> >>>
> >>> Takashi
> >> Ok, here is the patch:
> >>
> >>   From 74faeceb26c4730d6150e726792f6eb1f257b03e Mon Sep 17 00:00:00 2001
> >> From: Ivailo Monev <xakepa10@gmail.com>
> >> Date: Thu, 14 Nov 2013 13:13:43 +0000
> >> Subject: [PATCH 1/1] detect udevdir via pkg-config
> >>
> >> ---
> >>    configure.in | 2 +-
> >>    1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/configure.in b/configure.in
> >> index 3ae3209..74b891e 100644
> >> --- a/configure.in
> >> +++ b/configure.in
> >> @@ -121,7 +121,7 @@ AM_CONDITIONAL(USE_XMLTO, test x"$xmlto" = xyes)
> >>    AC_ARG_WITH(
> >>            [udev-rules-dir],
> >>            AS_HELP_STRING([--with-udev-rules-dir],[Directory where to
> >> install udev rules to (defaults to /lib/udev/rules.d)]),
> >> -        [udevrulesdir=$withval], [udevrulesdir="/lib/udev/rules.d"])
> >> +        [udevrulesdir=$withval], [udevrulesdir=$($PKG_CONFIG udev
> >> --variable=udevdir)"/rules.d"])
> >>    AC_SUBST(udevrulesdir)
> > This pkg-config option isn't always available.  Make sure to have a
> > proper fallback to /lib/udev/rules.d.  Also, update the help text,
> > too.
> >
> >
> > thanks,
> >
> > Takashi
> I'm not an autotools guru but there is PKG_PROG_PKG_CONFIG in
> configure.in which is supposed to ensure that pkg-config is installed,
> right? Besides, with_systemdsystemunitdir uses almost the same
> method as in my patch which I looked at before submitting it.

udev.pc is no hard requirement for alsa-utils, thus there is no
guarantee that "pkg-config udev" works as you expected.  If it's not
installed, pkg-config doesn't complain but just gives an empty
string.


> Anyway, here is an updated patch that keeps things more like the
> other tests in configure.in:
> 
>  From b30824ef1682f3040d53c1495dae308f51a4f380 Mon Sep 17 00:00:00 2001
> From: Ivailo Monev <xakepa10@gmail.com>
> Date: Thu, 14 Nov 2013 18:41:55 +0000
> Subject: [PATCH 1/1] detect udevdir via pkg-config
> 
> ---
>   configure.in | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/configure.in b/configure.in
> index 3ae3209..e8e1e82 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -120,8 +120,8 @@ AM_CONDITIONAL(USE_XMLTO, test x"$xmlto" = xyes)
> 
>   AC_ARG_WITH(
>           [udev-rules-dir],
> -        AS_HELP_STRING([--with-udev-rules-dir],[Directory where to 
> install udev rules to (defaults to /lib/udev/rules.d)]),
> -        [udevrulesdir=$withval], [udevrulesdir="/lib/udev/rules.d"])
> +        AS_HELP_STRING([--with-udev-rules-dir=DIR],[Directory where to 
> install udev rules to (default=auto)]),
> +        [udevrulesdir="$withval"], [udevrulesdir=$($PKG_CONFIG udev 
> --variable=udevdir)/rules.d])
>   AC_SUBST(udevrulesdir)
> 
>   dnl Checks for header files.
> -- 
> 1.8.3.4
> 
> If you are not happy with my patch you can write your own based
> which uses the pkg-config approach without hesitation, I will not
> get upset.
> 
> And still, will you do something about separate /usr or not? Just
> asking. As stated before, this patch will not solve it but replace
> the path hard coding with a flexible method.

It's matter distributors decide.  The default value is just some
value that might work.  Users and distros must read the document and
give the proper configure options.


Takashi

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: udev rules prefix
  2013-11-14 10:51         ` Takashi Iwai
@ 2013-11-14 18:49           ` Ivailo Monev
  2013-11-14 16:14             ` Takashi Iwai
  0 siblings, 1 reply; 13+ messages in thread
From: Ivailo Monev @ 2013-11-14 18:49 UTC (permalink / raw)
  To: alsa-devel

On 11/14/13 10:51, Takashi Iwai wrote:
> At Thu, 14 Nov 2013 13:24:49 +0000,
> Ivailo Monev wrote:
>> On 11/14/13 09:42, Takashi Iwai wrote:
>>> At Thu, 14 Nov 2013 12:08:47 +0000,
>>> Ivailo Monev wrote:
>>>> On 11/14/13 02:48, David Henningsson wrote:
>>>>> On 11/13/2013 09:36 PM, Ivailo wrote:
>>>>>> Hello,
>>>>>>
>>>>>> the default prefix for alsa-utils is /usr however the udev rules directory
>>>>>> is /lib/udev/rules.d thus on setups with separate partition for /usr the
>>>>>> binaries, from /usr/bin and /usr/sbin, will likely not be available during
>>>>>> the boot process and the udev rule will fail to restore the state.
>>>>>>
>>>>>> I suggest that the udev rules directory follows the prefix or append /usr
>>>>>> to it to resolve this.
>>>>>>
>>>>>> Cheers!
>>>>> Hi,
>>>>>
>>>>> ALSA merely follows what udev dictates, so I think your
>>>>> question/suggestion is better redirected on the udev (now systemd)
>>>>> mailinglist. Or potentially that of your distro.
>>>>>
>>>> Actually, you are not following what udev dictates (unless I'm missing
>>>> something).
>>>> By default, systemd (and more importantly udev) will be installed with
>>>> /usr prefix
>>>> (which is wrong in it self because it blindly assumes that /usr has been
>>>> mounted
>>>> via initrd/initramfs where separate /usr partition is in use but let's
>>>> not talk about
>>>> this here).
>>>>
>>>>
>>>> On 11/14/13 06:45, Takashi Iwai wrote:
>>>>> At Wed, 13 Nov 2013 20:36:48 +0000,
>>>>> Ivailo wrote:
>>>>>> Hello,
>>>>>>
>>>>>> the default prefix for alsa-utils is /usr however the udev rules directory
>>>>>> is /lib/udev/rules.d thus on setups with separate partition for /usr the
>>>>>> binaries, from /usr/bin and /usr/sbin, will likely not be available during
>>>>>> the boot process and the udev rule will fail to restore the state.
>>>>> Not true.  /lib must be always present at boot even if /usr isn't
>>>>> mounted.  That's the reason why /lib/udev was chosen as default in the
>>>>> past.
>>>>>
>>>>>
>>>>> Takashi
>>>> You got me wrong, I know that /lib should be available on early boot
>>>> (unless it's a
>>>> symlink, like in Arch Linux) but the point is that since the alsa-utils
>>>> binaries are
>>>> installed in /usr so should be the udev rules otherwise during boot
>>>> without /usr
>>>> being mounted you will see error message about /usr/sbin/alsactl.
>>> Theoretically yes, but this has been rather less problems than
>>> creating a non-existing /usr/lib/udev in the past.  That's the very
>>> reason of hard-coded /lib/udev.  Changing the default behavior is
>>> often worse unless you really do it carefully with consideration of
>>> compatibility with old systems.
>>>
>>> So, if you want to change the default, don't hard code again.  Make
>>> configure to guess the right place.  A patch achieving it is welcome.
>>>
>>>
>>> Takashi
>> Ok, here is the patch:
>>
>>   From 74faeceb26c4730d6150e726792f6eb1f257b03e Mon Sep 17 00:00:00 2001
>> From: Ivailo Monev <xakepa10@gmail.com>
>> Date: Thu, 14 Nov 2013 13:13:43 +0000
>> Subject: [PATCH 1/1] detect udevdir via pkg-config
>>
>> ---
>>    configure.in | 2 +-
>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/configure.in b/configure.in
>> index 3ae3209..74b891e 100644
>> --- a/configure.in
>> +++ b/configure.in
>> @@ -121,7 +121,7 @@ AM_CONDITIONAL(USE_XMLTO, test x"$xmlto" = xyes)
>>    AC_ARG_WITH(
>>            [udev-rules-dir],
>>            AS_HELP_STRING([--with-udev-rules-dir],[Directory where to
>> install udev rules to (defaults to /lib/udev/rules.d)]),
>> -        [udevrulesdir=$withval], [udevrulesdir="/lib/udev/rules.d"])
>> +        [udevrulesdir=$withval], [udevrulesdir=$($PKG_CONFIG udev
>> --variable=udevdir)"/rules.d"])
>>    AC_SUBST(udevrulesdir)
> This pkg-config option isn't always available.  Make sure to have a
> proper fallback to /lib/udev/rules.d.  Also, update the help text,
> too.
>
>
> thanks,
>
> Takashi
I'm not an autotools guru but there is PKG_PROG_PKG_CONFIG in
configure.in which is supposed to ensure that pkg-config is installed,
right? Besides, with_systemdsystemunitdir uses almost the same
method as in my patch which I looked at before submitting it.

Anyway, here is an updated patch that keeps things more like the
other tests in configure.in:

 From b30824ef1682f3040d53c1495dae308f51a4f380 Mon Sep 17 00:00:00 2001
From: Ivailo Monev <xakepa10@gmail.com>
Date: Thu, 14 Nov 2013 18:41:55 +0000
Subject: [PATCH 1/1] detect udevdir via pkg-config

---
  configure.in | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure.in b/configure.in
index 3ae3209..e8e1e82 100644
--- a/configure.in
+++ b/configure.in
@@ -120,8 +120,8 @@ AM_CONDITIONAL(USE_XMLTO, test x"$xmlto" = xyes)

  AC_ARG_WITH(
          [udev-rules-dir],
-        AS_HELP_STRING([--with-udev-rules-dir],[Directory where to 
install udev rules to (defaults to /lib/udev/rules.d)]),
-        [udevrulesdir=$withval], [udevrulesdir="/lib/udev/rules.d"])
+        AS_HELP_STRING([--with-udev-rules-dir=DIR],[Directory where to 
install udev rules to (default=auto)]),
+        [udevrulesdir="$withval"], [udevrulesdir=$($PKG_CONFIG udev 
--variable=udevdir)/rules.d])
  AC_SUBST(udevrulesdir)

  dnl Checks for header files.
-- 
1.8.3.4

If you are not happy with my patch you can write your own based
which uses the pkg-config approach without hesitation, I will not
get upset.

And still, will you do something about separate /usr or not? Just
asking. As stated before, this patch will not solve it but replace
the path hard coding with a flexible method.

Cheers!

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: udev rules prefix
  2013-11-15 13:16               ` Ivailo Monev
@ 2013-11-15 10:29                 ` Takashi Iwai
  2013-11-16 14:00                   ` Ivailo Monev
  0 siblings, 1 reply; 13+ messages in thread
From: Takashi Iwai @ 2013-11-15 10:29 UTC (permalink / raw)
  To: Ivailo Monev; +Cc: alsa-devel

At Fri, 15 Nov 2013 13:16:41 +0000,
Ivailo Monev wrote:
> 
> On 11/14/13 16:14, Takashi Iwai wrote:
> > At Thu, 14 Nov 2013 18:49:02 +0000,
> > Ivailo Monev wrote:
> >> On 11/14/13 10:51, Takashi Iwai wrote:
> >>> At Thu, 14 Nov 2013 13:24:49 +0000,
> >>> Ivailo Monev wrote:
> >>>> On 11/14/13 09:42, Takashi Iwai wrote:
> >>>>> At Thu, 14 Nov 2013 12:08:47 +0000,
> >>>>> Ivailo Monev wrote:
> >>>>>> On 11/14/13 02:48, David Henningsson wrote:
> >>>>>>> On 11/13/2013 09:36 PM, Ivailo wrote:
> >>>>>>>> Hello,
> >>>>>>>>
> >>>>>>>> the default prefix for alsa-utils is /usr however the udev rules directory
> >>>>>>>> is /lib/udev/rules.d thus on setups with separate partition for /usr the
> >>>>>>>> binaries, from /usr/bin and /usr/sbin, will likely not be available during
> >>>>>>>> the boot process and the udev rule will fail to restore the state.
> >>>>>>>>
> >>>>>>>> I suggest that the udev rules directory follows the prefix or append /usr
> >>>>>>>> to it to resolve this.
> >>>>>>>>
> >>>>>>>> Cheers!
> >>>>>>> Hi,
> >>>>>>>
> >>>>>>> ALSA merely follows what udev dictates, so I think your
> >>>>>>> question/suggestion is better redirected on the udev (now systemd)
> >>>>>>> mailinglist. Or potentially that of your distro.
> >>>>>>>
> >>>>>> Actually, you are not following what udev dictates (unless I'm missing
> >>>>>> something).
> >>>>>> By default, systemd (and more importantly udev) will be installed with
> >>>>>> /usr prefix
> >>>>>> (which is wrong in it self because it blindly assumes that /usr has been
> >>>>>> mounted
> >>>>>> via initrd/initramfs where separate /usr partition is in use but let's
> >>>>>> not talk about
> >>>>>> this here).
> >>>>>>
> >>>>>>
> >>>>>> On 11/14/13 06:45, Takashi Iwai wrote:
> >>>>>>> At Wed, 13 Nov 2013 20:36:48 +0000,
> >>>>>>> Ivailo wrote:
> >>>>>>>> Hello,
> >>>>>>>>
> >>>>>>>> the default prefix for alsa-utils is /usr however the udev rules directory
> >>>>>>>> is /lib/udev/rules.d thus on setups with separate partition for /usr the
> >>>>>>>> binaries, from /usr/bin and /usr/sbin, will likely not be available during
> >>>>>>>> the boot process and the udev rule will fail to restore the state.
> >>>>>>> Not true.  /lib must be always present at boot even if /usr isn't
> >>>>>>> mounted.  That's the reason why /lib/udev was chosen as default in the
> >>>>>>> past.
> >>>>>>>
> >>>>>>>
> >>>>>>> Takashi
> >>>>>> You got me wrong, I know that /lib should be available on early boot
> >>>>>> (unless it's a
> >>>>>> symlink, like in Arch Linux) but the point is that since the alsa-utils
> >>>>>> binaries are
> >>>>>> installed in /usr so should be the udev rules otherwise during boot
> >>>>>> without /usr
> >>>>>> being mounted you will see error message about /usr/sbin/alsactl.
> >>>>> Theoretically yes, but this has been rather less problems than
> >>>>> creating a non-existing /usr/lib/udev in the past.  That's the very
> >>>>> reason of hard-coded /lib/udev.  Changing the default behavior is
> >>>>> often worse unless you really do it carefully with consideration of
> >>>>> compatibility with old systems.
> >>>>>
> >>>>> So, if you want to change the default, don't hard code again.  Make
> >>>>> configure to guess the right place.  A patch achieving it is welcome.
> >>>>>
> >>>>>
> >>>>> Takashi
> >>>> Ok, here is the patch:
> >>>>
> >>>>    From 74faeceb26c4730d6150e726792f6eb1f257b03e Mon Sep 17 00:00:00 2001
> >>>> From: Ivailo Monev <xakepa10@gmail.com>
> >>>> Date: Thu, 14 Nov 2013 13:13:43 +0000
> >>>> Subject: [PATCH 1/1] detect udevdir via pkg-config
> >>>>
> >>>> ---
> >>>>     configure.in | 2 +-
> >>>>     1 file changed, 1 insertion(+), 1 deletion(-)
> >>>>
> >>>> diff --git a/configure.in b/configure.in
> >>>> index 3ae3209..74b891e 100644
> >>>> --- a/configure.in
> >>>> +++ b/configure.in
> >>>> @@ -121,7 +121,7 @@ AM_CONDITIONAL(USE_XMLTO, test x"$xmlto" = xyes)
> >>>>     AC_ARG_WITH(
> >>>>             [udev-rules-dir],
> >>>>             AS_HELP_STRING([--with-udev-rules-dir],[Directory where to
> >>>> install udev rules to (defaults to /lib/udev/rules.d)]),
> >>>> -        [udevrulesdir=$withval], [udevrulesdir="/lib/udev/rules.d"])
> >>>> +        [udevrulesdir=$withval], [udevrulesdir=$($PKG_CONFIG udev
> >>>> --variable=udevdir)"/rules.d"])
> >>>>     AC_SUBST(udevrulesdir)
> >>> This pkg-config option isn't always available.  Make sure to have a
> >>> proper fallback to /lib/udev/rules.d.  Also, update the help text,
> >>> too.
> >>>
> >>>
> >>> thanks,
> >>>
> >>> Takashi
> >> I'm not an autotools guru but there is PKG_PROG_PKG_CONFIG in
> >> configure.in which is supposed to ensure that pkg-config is installed,
> >> right? Besides, with_systemdsystemunitdir uses almost the same
> >> method as in my patch which I looked at before submitting it.
> > udev.pc is no hard requirement for alsa-utils, thus there is no
> > guarantee that "pkg-config udev" works as you expected.  If it's not
> > installed, pkg-config doesn't complain but just gives an empty
> > string.
> >
> >
> >> Anyway, here is an updated patch that keeps things more like the
> >> other tests in configure.in:
> >>
> >>   From b30824ef1682f3040d53c1495dae308f51a4f380 Mon Sep 17 00:00:00 2001
> >> From: Ivailo Monev <xakepa10@gmail.com>
> >> Date: Thu, 14 Nov 2013 18:41:55 +0000
> >> Subject: [PATCH 1/1] detect udevdir via pkg-config
> >>
> >> ---
> >>    configure.in | 4 ++--
> >>    1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/configure.in b/configure.in
> >> index 3ae3209..e8e1e82 100644
> >> --- a/configure.in
> >> +++ b/configure.in
> >> @@ -120,8 +120,8 @@ AM_CONDITIONAL(USE_XMLTO, test x"$xmlto" = xyes)
> >>
> >>    AC_ARG_WITH(
> >>            [udev-rules-dir],
> >> -        AS_HELP_STRING([--with-udev-rules-dir],[Directory where to
> >> install udev rules to (defaults to /lib/udev/rules.d)]),
> >> -        [udevrulesdir=$withval], [udevrulesdir="/lib/udev/rules.d"])
> >> +        AS_HELP_STRING([--with-udev-rules-dir=DIR],[Directory where to
> >> install udev rules to (default=auto)]),
> >> +        [udevrulesdir="$withval"], [udevrulesdir=$($PKG_CONFIG udev
> >> --variable=udevdir)/rules.d])
> >>    AC_SUBST(udevrulesdir)
> >>
> >>    dnl Checks for header files.
> >> -- 
> >> 1.8.3.4
> >>
> >> If you are not happy with my patch you can write your own based
> >> which uses the pkg-config approach without hesitation, I will not
> >> get upset.
> >>
> >> And still, will you do something about separate /usr or not? Just
> >> asking. As stated before, this patch will not solve it but replace
> >> the path hard coding with a flexible method.
> > It's matter distributors decide.  The default value is just some
> > value that might work.  Users and distros must read the document and
> > give the proper configure options.
> >
> >
> > Takashi
> Sorry for the late reply.
> 
> So, I get that there is a variation from distribution to distribution.
> But what if udevrulesdir respects the default prefix
> (AC_PREFIX_DEFAULT)? That way, the issue in my first email will
> be solved. Will a patch for it be accepted?

It'd break the previously working behavior.

Simply fallback to the old value (/lib/udev/) when pkg-config gives an
empty string.  That should suffice for both cases.


Takashi

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: udev rules prefix
  2013-11-14 16:14             ` Takashi Iwai
@ 2013-11-15 13:16               ` Ivailo Monev
  2013-11-15 10:29                 ` Takashi Iwai
  0 siblings, 1 reply; 13+ messages in thread
From: Ivailo Monev @ 2013-11-15 13:16 UTC (permalink / raw)
  To: alsa-devel

On 11/14/13 16:14, Takashi Iwai wrote:
> At Thu, 14 Nov 2013 18:49:02 +0000,
> Ivailo Monev wrote:
>> On 11/14/13 10:51, Takashi Iwai wrote:
>>> At Thu, 14 Nov 2013 13:24:49 +0000,
>>> Ivailo Monev wrote:
>>>> On 11/14/13 09:42, Takashi Iwai wrote:
>>>>> At Thu, 14 Nov 2013 12:08:47 +0000,
>>>>> Ivailo Monev wrote:
>>>>>> On 11/14/13 02:48, David Henningsson wrote:
>>>>>>> On 11/13/2013 09:36 PM, Ivailo wrote:
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> the default prefix for alsa-utils is /usr however the udev rules directory
>>>>>>>> is /lib/udev/rules.d thus on setups with separate partition for /usr the
>>>>>>>> binaries, from /usr/bin and /usr/sbin, will likely not be available during
>>>>>>>> the boot process and the udev rule will fail to restore the state.
>>>>>>>>
>>>>>>>> I suggest that the udev rules directory follows the prefix or append /usr
>>>>>>>> to it to resolve this.
>>>>>>>>
>>>>>>>> Cheers!
>>>>>>> Hi,
>>>>>>>
>>>>>>> ALSA merely follows what udev dictates, so I think your
>>>>>>> question/suggestion is better redirected on the udev (now systemd)
>>>>>>> mailinglist. Or potentially that of your distro.
>>>>>>>
>>>>>> Actually, you are not following what udev dictates (unless I'm missing
>>>>>> something).
>>>>>> By default, systemd (and more importantly udev) will be installed with
>>>>>> /usr prefix
>>>>>> (which is wrong in it self because it blindly assumes that /usr has been
>>>>>> mounted
>>>>>> via initrd/initramfs where separate /usr partition is in use but let's
>>>>>> not talk about
>>>>>> this here).
>>>>>>
>>>>>>
>>>>>> On 11/14/13 06:45, Takashi Iwai wrote:
>>>>>>> At Wed, 13 Nov 2013 20:36:48 +0000,
>>>>>>> Ivailo wrote:
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> the default prefix for alsa-utils is /usr however the udev rules directory
>>>>>>>> is /lib/udev/rules.d thus on setups with separate partition for /usr the
>>>>>>>> binaries, from /usr/bin and /usr/sbin, will likely not be available during
>>>>>>>> the boot process and the udev rule will fail to restore the state.
>>>>>>> Not true.  /lib must be always present at boot even if /usr isn't
>>>>>>> mounted.  That's the reason why /lib/udev was chosen as default in the
>>>>>>> past.
>>>>>>>
>>>>>>>
>>>>>>> Takashi
>>>>>> You got me wrong, I know that /lib should be available on early boot
>>>>>> (unless it's a
>>>>>> symlink, like in Arch Linux) but the point is that since the alsa-utils
>>>>>> binaries are
>>>>>> installed in /usr so should be the udev rules otherwise during boot
>>>>>> without /usr
>>>>>> being mounted you will see error message about /usr/sbin/alsactl.
>>>>> Theoretically yes, but this has been rather less problems than
>>>>> creating a non-existing /usr/lib/udev in the past.  That's the very
>>>>> reason of hard-coded /lib/udev.  Changing the default behavior is
>>>>> often worse unless you really do it carefully with consideration of
>>>>> compatibility with old systems.
>>>>>
>>>>> So, if you want to change the default, don't hard code again.  Make
>>>>> configure to guess the right place.  A patch achieving it is welcome.
>>>>>
>>>>>
>>>>> Takashi
>>>> Ok, here is the patch:
>>>>
>>>>    From 74faeceb26c4730d6150e726792f6eb1f257b03e Mon Sep 17 00:00:00 2001
>>>> From: Ivailo Monev <xakepa10@gmail.com>
>>>> Date: Thu, 14 Nov 2013 13:13:43 +0000
>>>> Subject: [PATCH 1/1] detect udevdir via pkg-config
>>>>
>>>> ---
>>>>     configure.in | 2 +-
>>>>     1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/configure.in b/configure.in
>>>> index 3ae3209..74b891e 100644
>>>> --- a/configure.in
>>>> +++ b/configure.in
>>>> @@ -121,7 +121,7 @@ AM_CONDITIONAL(USE_XMLTO, test x"$xmlto" = xyes)
>>>>     AC_ARG_WITH(
>>>>             [udev-rules-dir],
>>>>             AS_HELP_STRING([--with-udev-rules-dir],[Directory where to
>>>> install udev rules to (defaults to /lib/udev/rules.d)]),
>>>> -        [udevrulesdir=$withval], [udevrulesdir="/lib/udev/rules.d"])
>>>> +        [udevrulesdir=$withval], [udevrulesdir=$($PKG_CONFIG udev
>>>> --variable=udevdir)"/rules.d"])
>>>>     AC_SUBST(udevrulesdir)
>>> This pkg-config option isn't always available.  Make sure to have a
>>> proper fallback to /lib/udev/rules.d.  Also, update the help text,
>>> too.
>>>
>>>
>>> thanks,
>>>
>>> Takashi
>> I'm not an autotools guru but there is PKG_PROG_PKG_CONFIG in
>> configure.in which is supposed to ensure that pkg-config is installed,
>> right? Besides, with_systemdsystemunitdir uses almost the same
>> method as in my patch which I looked at before submitting it.
> udev.pc is no hard requirement for alsa-utils, thus there is no
> guarantee that "pkg-config udev" works as you expected.  If it's not
> installed, pkg-config doesn't complain but just gives an empty
> string.
>
>
>> Anyway, here is an updated patch that keeps things more like the
>> other tests in configure.in:
>>
>>   From b30824ef1682f3040d53c1495dae308f51a4f380 Mon Sep 17 00:00:00 2001
>> From: Ivailo Monev <xakepa10@gmail.com>
>> Date: Thu, 14 Nov 2013 18:41:55 +0000
>> Subject: [PATCH 1/1] detect udevdir via pkg-config
>>
>> ---
>>    configure.in | 4 ++--
>>    1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/configure.in b/configure.in
>> index 3ae3209..e8e1e82 100644
>> --- a/configure.in
>> +++ b/configure.in
>> @@ -120,8 +120,8 @@ AM_CONDITIONAL(USE_XMLTO, test x"$xmlto" = xyes)
>>
>>    AC_ARG_WITH(
>>            [udev-rules-dir],
>> -        AS_HELP_STRING([--with-udev-rules-dir],[Directory where to
>> install udev rules to (defaults to /lib/udev/rules.d)]),
>> -        [udevrulesdir=$withval], [udevrulesdir="/lib/udev/rules.d"])
>> +        AS_HELP_STRING([--with-udev-rules-dir=DIR],[Directory where to
>> install udev rules to (default=auto)]),
>> +        [udevrulesdir="$withval"], [udevrulesdir=$($PKG_CONFIG udev
>> --variable=udevdir)/rules.d])
>>    AC_SUBST(udevrulesdir)
>>
>>    dnl Checks for header files.
>> -- 
>> 1.8.3.4
>>
>> If you are not happy with my patch you can write your own based
>> which uses the pkg-config approach without hesitation, I will not
>> get upset.
>>
>> And still, will you do something about separate /usr or not? Just
>> asking. As stated before, this patch will not solve it but replace
>> the path hard coding with a flexible method.
> It's matter distributors decide.  The default value is just some
> value that might work.  Users and distros must read the document and
> give the proper configure options.
>
>
> Takashi
Sorry for the late reply.

So, I get that there is a variation from distribution to distribution.
But what if udevrulesdir respects the default prefix
(AC_PREFIX_DEFAULT)? That way, the issue in my first email will
be solved. Will a patch for it be accepted?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: udev rules prefix
  2013-11-15 10:29                 ` Takashi Iwai
@ 2013-11-16 14:00                   ` Ivailo Monev
  2013-11-17  9:07                     ` Takashi Iwai
  0 siblings, 1 reply; 13+ messages in thread
From: Ivailo Monev @ 2013-11-16 14:00 UTC (permalink / raw)
  To: alsa-devel

On 11/15/13 10:29, Takashi Iwai wrote:
> At Fri, 15 Nov 2013 13:16:41 +0000,
> Ivailo Monev wrote:
>> On 11/14/13 16:14, Takashi Iwai wrote:
>>> At Thu, 14 Nov 2013 18:49:02 +0000,
>>> Ivailo Monev wrote:
>>>> On 11/14/13 10:51, Takashi Iwai wrote:
>>>>> At Thu, 14 Nov 2013 13:24:49 +0000,
>>>>> Ivailo Monev wrote:
>>>>>> On 11/14/13 09:42, Takashi Iwai wrote:
>>>>>>> At Thu, 14 Nov 2013 12:08:47 +0000,
>>>>>>> Ivailo Monev wrote:
>>>>>>>> On 11/14/13 02:48, David Henningsson wrote:
>>>>>>>>> On 11/13/2013 09:36 PM, Ivailo wrote:
>>>>>>>>>> Hello,
>>>>>>>>>>
>>>>>>>>>> the default prefix for alsa-utils is /usr however the udev rules directory
>>>>>>>>>> is /lib/udev/rules.d thus on setups with separate partition for /usr the
>>>>>>>>>> binaries, from /usr/bin and /usr/sbin, will likely not be available during
>>>>>>>>>> the boot process and the udev rule will fail to restore the state.
>>>>>>>>>>
>>>>>>>>>> I suggest that the udev rules directory follows the prefix or append /usr
>>>>>>>>>> to it to resolve this.
>>>>>>>>>>
>>>>>>>>>> Cheers!
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> ALSA merely follows what udev dictates, so I think your
>>>>>>>>> question/suggestion is better redirected on the udev (now systemd)
>>>>>>>>> mailinglist. Or potentially that of your distro.
>>>>>>>>>
>>>>>>>> Actually, you are not following what udev dictates (unless I'm missing
>>>>>>>> something).
>>>>>>>> By default, systemd (and more importantly udev) will be installed with
>>>>>>>> /usr prefix
>>>>>>>> (which is wrong in it self because it blindly assumes that /usr has been
>>>>>>>> mounted
>>>>>>>> via initrd/initramfs where separate /usr partition is in use but let's
>>>>>>>> not talk about
>>>>>>>> this here).
>>>>>>>>
>>>>>>>>
>>>>>>>> On 11/14/13 06:45, Takashi Iwai wrote:
>>>>>>>>> At Wed, 13 Nov 2013 20:36:48 +0000,
>>>>>>>>> Ivailo wrote:
>>>>>>>>>> Hello,
>>>>>>>>>>
>>>>>>>>>> the default prefix for alsa-utils is /usr however the udev rules directory
>>>>>>>>>> is /lib/udev/rules.d thus on setups with separate partition for /usr the
>>>>>>>>>> binaries, from /usr/bin and /usr/sbin, will likely not be available during
>>>>>>>>>> the boot process and the udev rule will fail to restore the state.
>>>>>>>>> Not true.  /lib must be always present at boot even if /usr isn't
>>>>>>>>> mounted.  That's the reason why /lib/udev was chosen as default in the
>>>>>>>>> past.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Takashi
>>>>>>>> You got me wrong, I know that /lib should be available on early boot
>>>>>>>> (unless it's a
>>>>>>>> symlink, like in Arch Linux) but the point is that since the alsa-utils
>>>>>>>> binaries are
>>>>>>>> installed in /usr so should be the udev rules otherwise during boot
>>>>>>>> without /usr
>>>>>>>> being mounted you will see error message about /usr/sbin/alsactl.
>>>>>>> Theoretically yes, but this has been rather less problems than
>>>>>>> creating a non-existing /usr/lib/udev in the past.  That's the very
>>>>>>> reason of hard-coded /lib/udev.  Changing the default behavior is
>>>>>>> often worse unless you really do it carefully with consideration of
>>>>>>> compatibility with old systems.
>>>>>>>
>>>>>>> So, if you want to change the default, don't hard code again.  Make
>>>>>>> configure to guess the right place.  A patch achieving it is welcome.
>>>>>>>
>>>>>>>
>>>>>>> Takashi
>>>>>> Ok, here is the patch:
>>>>>>
>>>>>>     From 74faeceb26c4730d6150e726792f6eb1f257b03e Mon Sep 17 00:00:00 2001
>>>>>> From: Ivailo Monev <xakepa10@gmail.com>
>>>>>> Date: Thu, 14 Nov 2013 13:13:43 +0000
>>>>>> Subject: [PATCH 1/1] detect udevdir via pkg-config
>>>>>>
>>>>>> ---
>>>>>>      configure.in | 2 +-
>>>>>>      1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>>
>>>>>> diff --git a/configure.in b/configure.in
>>>>>> index 3ae3209..74b891e 100644
>>>>>> --- a/configure.in
>>>>>> +++ b/configure.in
>>>>>> @@ -121,7 +121,7 @@ AM_CONDITIONAL(USE_XMLTO, test x"$xmlto" = xyes)
>>>>>>      AC_ARG_WITH(
>>>>>>              [udev-rules-dir],
>>>>>>              AS_HELP_STRING([--with-udev-rules-dir],[Directory where to
>>>>>> install udev rules to (defaults to /lib/udev/rules.d)]),
>>>>>> -        [udevrulesdir=$withval], [udevrulesdir="/lib/udev/rules.d"])
>>>>>> +        [udevrulesdir=$withval], [udevrulesdir=$($PKG_CONFIG udev
>>>>>> --variable=udevdir)"/rules.d"])
>>>>>>      AC_SUBST(udevrulesdir)
>>>>> This pkg-config option isn't always available.  Make sure to have a
>>>>> proper fallback to /lib/udev/rules.d.  Also, update the help text,
>>>>> too.
>>>>>
>>>>>
>>>>> thanks,
>>>>>
>>>>> Takashi
>>>> I'm not an autotools guru but there is PKG_PROG_PKG_CONFIG in
>>>> configure.in which is supposed to ensure that pkg-config is installed,
>>>> right? Besides, with_systemdsystemunitdir uses almost the same
>>>> method as in my patch which I looked at before submitting it.
>>> udev.pc is no hard requirement for alsa-utils, thus there is no
>>> guarantee that "pkg-config udev" works as you expected.  If it's not
>>> installed, pkg-config doesn't complain but just gives an empty
>>> string.
>>>
>>>
>>>> Anyway, here is an updated patch that keeps things more like the
>>>> other tests in configure.in:
>>>>
>>>>    From b30824ef1682f3040d53c1495dae308f51a4f380 Mon Sep 17 00:00:00 2001
>>>> From: Ivailo Monev <xakepa10@gmail.com>
>>>> Date: Thu, 14 Nov 2013 18:41:55 +0000
>>>> Subject: [PATCH 1/1] detect udevdir via pkg-config
>>>>
>>>> ---
>>>>     configure.in | 4 ++--
>>>>     1 file changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/configure.in b/configure.in
>>>> index 3ae3209..e8e1e82 100644
>>>> --- a/configure.in
>>>> +++ b/configure.in
>>>> @@ -120,8 +120,8 @@ AM_CONDITIONAL(USE_XMLTO, test x"$xmlto" = xyes)
>>>>
>>>>     AC_ARG_WITH(
>>>>             [udev-rules-dir],
>>>> -        AS_HELP_STRING([--with-udev-rules-dir],[Directory where to
>>>> install udev rules to (defaults to /lib/udev/rules.d)]),
>>>> -        [udevrulesdir=$withval], [udevrulesdir="/lib/udev/rules.d"])
>>>> +        AS_HELP_STRING([--with-udev-rules-dir=DIR],[Directory where to
>>>> install udev rules to (default=auto)]),
>>>> +        [udevrulesdir="$withval"], [udevrulesdir=$($PKG_CONFIG udev
>>>> --variable=udevdir)/rules.d])
>>>>     AC_SUBST(udevrulesdir)
>>>>
>>>>     dnl Checks for header files.
>>>> -- 
>>>> 1.8.3.4
>>>>
>>>> If you are not happy with my patch you can write your own based
>>>> which uses the pkg-config approach without hesitation, I will not
>>>> get upset.
>>>>
>>>> And still, will you do something about separate /usr or not? Just
>>>> asking. As stated before, this patch will not solve it but replace
>>>> the path hard coding with a flexible method.
>>> It's matter distributors decide.  The default value is just some
>>> value that might work.  Users and distros must read the document and
>>> give the proper configure options.
>>>
>>>
>>> Takashi
>> Sorry for the late reply.
>>
>> So, I get that there is a variation from distribution to distribution.
>> But what if udevrulesdir respects the default prefix
>> (AC_PREFIX_DEFAULT)? That way, the issue in my first email will
>> be solved. Will a patch for it be accepted?
> It'd break the previously working behavior.
>
> Simply fallback to the old value (/lib/udev/) when pkg-config gives an
> empty string.  That should suffice for both cases.
>
>
> Takashi
 From 8bfe323092f08e8326dddbb6c15029845556f468 Mon Sep 17 00:00:00 2001
From: Ivailo Monev <xakepa10@gmail.com>
Date: Fri, 15 Nov 2013 14:05:02 +0000
Subject: [PATCH] detect udevdir via pkg-config, fallback to 
/lib/udev/rules.d

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
---
  configure.in | 10 ++++++++--
  1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/configure.in b/configure.in
index 3ae3209..60da1fa 100644
--- a/configure.in
+++ b/configure.in
@@ -120,8 +120,14 @@ AM_CONDITIONAL(USE_XMLTO, test x"$xmlto" = xyes)

  AC_ARG_WITH(
          [udev-rules-dir],
-        AS_HELP_STRING([--with-udev-rules-dir],[Directory where to 
install udev rules to (defaults to /lib/udev/rules.d)]),
-        [udevrulesdir=$withval], [udevrulesdir="/lib/udev/rules.d"])
+        AS_HELP_STRING([--with-udev-rules-dir=DIR],[Directory where to 
install udev rules to (default=auto)]),
+        [udevrulesdir="$withval"],
+        [udevdir=$($PKG_CONFIG udev --variable=udevdir)
+        if test "x$udevdir" = "x"; then
+            udevrulesdir="/lib/udev/rules.d"
+        else
+            udevrulesdir="$udevdir/rules.d"
+        fi])
  AC_SUBST(udevrulesdir)

  dnl Checks for header files.
-- 
1.8.3.4

Cheers!

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: udev rules prefix
  2013-11-16 14:00                   ` Ivailo Monev
@ 2013-11-17  9:07                     ` Takashi Iwai
  0 siblings, 0 replies; 13+ messages in thread
From: Takashi Iwai @ 2013-11-17  9:07 UTC (permalink / raw)
  To: Ivailo Monev; +Cc: alsa-devel

At Sat, 16 Nov 2013 14:00:19 +0000,
Ivailo Monev wrote:
> 
> On 11/15/13 10:29, Takashi Iwai wrote:
> > At Fri, 15 Nov 2013 13:16:41 +0000,
> > Ivailo Monev wrote:
> >> On 11/14/13 16:14, Takashi Iwai wrote:
> >>> At Thu, 14 Nov 2013 18:49:02 +0000,
> >>> Ivailo Monev wrote:
> >>>> On 11/14/13 10:51, Takashi Iwai wrote:
> >>>>> At Thu, 14 Nov 2013 13:24:49 +0000,
> >>>>> Ivailo Monev wrote:
> >>>>>> On 11/14/13 09:42, Takashi Iwai wrote:
> >>>>>>> At Thu, 14 Nov 2013 12:08:47 +0000,
> >>>>>>> Ivailo Monev wrote:
> >>>>>>>> On 11/14/13 02:48, David Henningsson wrote:
> >>>>>>>>> On 11/13/2013 09:36 PM, Ivailo wrote:
> >>>>>>>>>> Hello,
> >>>>>>>>>>
> >>>>>>>>>> the default prefix for alsa-utils is /usr however the udev rules directory
> >>>>>>>>>> is /lib/udev/rules.d thus on setups with separate partition for /usr the
> >>>>>>>>>> binaries, from /usr/bin and /usr/sbin, will likely not be available during
> >>>>>>>>>> the boot process and the udev rule will fail to restore the state.
> >>>>>>>>>>
> >>>>>>>>>> I suggest that the udev rules directory follows the prefix or append /usr
> >>>>>>>>>> to it to resolve this.
> >>>>>>>>>>
> >>>>>>>>>> Cheers!
> >>>>>>>>> Hi,
> >>>>>>>>>
> >>>>>>>>> ALSA merely follows what udev dictates, so I think your
> >>>>>>>>> question/suggestion is better redirected on the udev (now systemd)
> >>>>>>>>> mailinglist. Or potentially that of your distro.
> >>>>>>>>>
> >>>>>>>> Actually, you are not following what udev dictates (unless I'm missing
> >>>>>>>> something).
> >>>>>>>> By default, systemd (and more importantly udev) will be installed with
> >>>>>>>> /usr prefix
> >>>>>>>> (which is wrong in it self because it blindly assumes that /usr has been
> >>>>>>>> mounted
> >>>>>>>> via initrd/initramfs where separate /usr partition is in use but let's
> >>>>>>>> not talk about
> >>>>>>>> this here).
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> On 11/14/13 06:45, Takashi Iwai wrote:
> >>>>>>>>> At Wed, 13 Nov 2013 20:36:48 +0000,
> >>>>>>>>> Ivailo wrote:
> >>>>>>>>>> Hello,
> >>>>>>>>>>
> >>>>>>>>>> the default prefix for alsa-utils is /usr however the udev rules directory
> >>>>>>>>>> is /lib/udev/rules.d thus on setups with separate partition for /usr the
> >>>>>>>>>> binaries, from /usr/bin and /usr/sbin, will likely not be available during
> >>>>>>>>>> the boot process and the udev rule will fail to restore the state.
> >>>>>>>>> Not true.  /lib must be always present at boot even if /usr isn't
> >>>>>>>>> mounted.  That's the reason why /lib/udev was chosen as default in the
> >>>>>>>>> past.
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> Takashi
> >>>>>>>> You got me wrong, I know that /lib should be available on early boot
> >>>>>>>> (unless it's a
> >>>>>>>> symlink, like in Arch Linux) but the point is that since the alsa-utils
> >>>>>>>> binaries are
> >>>>>>>> installed in /usr so should be the udev rules otherwise during boot
> >>>>>>>> without /usr
> >>>>>>>> being mounted you will see error message about /usr/sbin/alsactl.
> >>>>>>> Theoretically yes, but this has been rather less problems than
> >>>>>>> creating a non-existing /usr/lib/udev in the past.  That's the very
> >>>>>>> reason of hard-coded /lib/udev.  Changing the default behavior is
> >>>>>>> often worse unless you really do it carefully with consideration of
> >>>>>>> compatibility with old systems.
> >>>>>>>
> >>>>>>> So, if you want to change the default, don't hard code again.  Make
> >>>>>>> configure to guess the right place.  A patch achieving it is welcome.
> >>>>>>>
> >>>>>>>
> >>>>>>> Takashi
> >>>>>> Ok, here is the patch:
> >>>>>>
> >>>>>>     From 74faeceb26c4730d6150e726792f6eb1f257b03e Mon Sep 17 00:00:00 2001
> >>>>>> From: Ivailo Monev <xakepa10@gmail.com>
> >>>>>> Date: Thu, 14 Nov 2013 13:13:43 +0000
> >>>>>> Subject: [PATCH 1/1] detect udevdir via pkg-config
> >>>>>>
> >>>>>> ---
> >>>>>>      configure.in | 2 +-
> >>>>>>      1 file changed, 1 insertion(+), 1 deletion(-)
> >>>>>>
> >>>>>> diff --git a/configure.in b/configure.in
> >>>>>> index 3ae3209..74b891e 100644
> >>>>>> --- a/configure.in
> >>>>>> +++ b/configure.in
> >>>>>> @@ -121,7 +121,7 @@ AM_CONDITIONAL(USE_XMLTO, test x"$xmlto" = xyes)
> >>>>>>      AC_ARG_WITH(
> >>>>>>              [udev-rules-dir],
> >>>>>>              AS_HELP_STRING([--with-udev-rules-dir],[Directory where to
> >>>>>> install udev rules to (defaults to /lib/udev/rules.d)]),
> >>>>>> -        [udevrulesdir=$withval], [udevrulesdir="/lib/udev/rules.d"])
> >>>>>> +        [udevrulesdir=$withval], [udevrulesdir=$($PKG_CONFIG udev
> >>>>>> --variable=udevdir)"/rules.d"])
> >>>>>>      AC_SUBST(udevrulesdir)
> >>>>> This pkg-config option isn't always available.  Make sure to have a
> >>>>> proper fallback to /lib/udev/rules.d.  Also, update the help text,
> >>>>> too.
> >>>>>
> >>>>>
> >>>>> thanks,
> >>>>>
> >>>>> Takashi
> >>>> I'm not an autotools guru but there is PKG_PROG_PKG_CONFIG in
> >>>> configure.in which is supposed to ensure that pkg-config is installed,
> >>>> right? Besides, with_systemdsystemunitdir uses almost the same
> >>>> method as in my patch which I looked at before submitting it.
> >>> udev.pc is no hard requirement for alsa-utils, thus there is no
> >>> guarantee that "pkg-config udev" works as you expected.  If it's not
> >>> installed, pkg-config doesn't complain but just gives an empty
> >>> string.
> >>>
> >>>
> >>>> Anyway, here is an updated patch that keeps things more like the
> >>>> other tests in configure.in:
> >>>>
> >>>>    From b30824ef1682f3040d53c1495dae308f51a4f380 Mon Sep 17 00:00:00 2001
> >>>> From: Ivailo Monev <xakepa10@gmail.com>
> >>>> Date: Thu, 14 Nov 2013 18:41:55 +0000
> >>>> Subject: [PATCH 1/1] detect udevdir via pkg-config
> >>>>
> >>>> ---
> >>>>     configure.in | 4 ++--
> >>>>     1 file changed, 2 insertions(+), 2 deletions(-)
> >>>>
> >>>> diff --git a/configure.in b/configure.in
> >>>> index 3ae3209..e8e1e82 100644
> >>>> --- a/configure.in
> >>>> +++ b/configure.in
> >>>> @@ -120,8 +120,8 @@ AM_CONDITIONAL(USE_XMLTO, test x"$xmlto" = xyes)
> >>>>
> >>>>     AC_ARG_WITH(
> >>>>             [udev-rules-dir],
> >>>> -        AS_HELP_STRING([--with-udev-rules-dir],[Directory where to
> >>>> install udev rules to (defaults to /lib/udev/rules.d)]),
> >>>> -        [udevrulesdir=$withval], [udevrulesdir="/lib/udev/rules.d"])
> >>>> +        AS_HELP_STRING([--with-udev-rules-dir=DIR],[Directory where to
> >>>> install udev rules to (default=auto)]),
> >>>> +        [udevrulesdir="$withval"], [udevrulesdir=$($PKG_CONFIG udev
> >>>> --variable=udevdir)/rules.d])
> >>>>     AC_SUBST(udevrulesdir)
> >>>>
> >>>>     dnl Checks for header files.
> >>>> -- 
> >>>> 1.8.3.4
> >>>>
> >>>> If you are not happy with my patch you can write your own based
> >>>> which uses the pkg-config approach without hesitation, I will not
> >>>> get upset.
> >>>>
> >>>> And still, will you do something about separate /usr or not? Just
> >>>> asking. As stated before, this patch will not solve it but replace
> >>>> the path hard coding with a flexible method.
> >>> It's matter distributors decide.  The default value is just some
> >>> value that might work.  Users and distros must read the document and
> >>> give the proper configure options.
> >>>
> >>>
> >>> Takashi
> >> Sorry for the late reply.
> >>
> >> So, I get that there is a variation from distribution to distribution.
> >> But what if udevrulesdir respects the default prefix
> >> (AC_PREFIX_DEFAULT)? That way, the issue in my first email will
> >> be solved. Will a patch for it be accepted?
> > It'd break the previously working behavior.
> >
> > Simply fallback to the old value (/lib/udev/) when pkg-config gives an
> > empty string.  That should suffice for both cases.
> >
> >
> > Takashi
>  From 8bfe323092f08e8326dddbb6c15029845556f468 Mon Sep 17 00:00:00 2001
> From: Ivailo Monev <xakepa10@gmail.com>
> Date: Fri, 15 Nov 2013 14:05:02 +0000
> Subject: [PATCH] detect udevdir via pkg-config, fallback to 
> /lib/udev/rules.d
> 
> Signed-off-by: Ivailo Monev <xakepa10@gmail.com>

Thanks, applied.

(Though, the patch couldn't be applied as is because your mailer broke
 spaces or lines, so I had to apply it manually.  At the next time,
 please fix MUA setup or use an attachment if it's difficult.)

Takashi

> ---
>   configure.in | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/configure.in b/configure.in
> index 3ae3209..60da1fa 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -120,8 +120,14 @@ AM_CONDITIONAL(USE_XMLTO, test x"$xmlto" = xyes)
> 
>   AC_ARG_WITH(
>           [udev-rules-dir],
> -        AS_HELP_STRING([--with-udev-rules-dir],[Directory where to 
> install udev rules to (defaults to /lib/udev/rules.d)]),
> -        [udevrulesdir=$withval], [udevrulesdir="/lib/udev/rules.d"])
> +        AS_HELP_STRING([--with-udev-rules-dir=DIR],[Directory where to 
> install udev rules to (default=auto)]),
> +        [udevrulesdir="$withval"],
> +        [udevdir=$($PKG_CONFIG udev --variable=udevdir)
> +        if test "x$udevdir" = "x"; then
> +            udevrulesdir="/lib/udev/rules.d"
> +        else
> +            udevrulesdir="$udevdir/rules.d"
> +        fi])
>   AC_SUBST(udevrulesdir)
> 
>   dnl Checks for header files.
> -- 
> 1.8.3.4
> 
> Cheers!
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-11-17  9:07 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-13 20:36 udev rules prefix Ivailo
2013-11-14  2:48 ` David Henningsson
2013-11-14  6:45 ` Takashi Iwai
2013-11-14 12:08   ` Ivailo Monev
2013-11-14  9:42     ` Takashi Iwai
2013-11-14 13:24       ` Ivailo Monev
2013-11-14 10:51         ` Takashi Iwai
2013-11-14 18:49           ` Ivailo Monev
2013-11-14 16:14             ` Takashi Iwai
2013-11-15 13:16               ` Ivailo Monev
2013-11-15 10:29                 ` Takashi Iwai
2013-11-16 14:00                   ` Ivailo Monev
2013-11-17  9:07                     ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).