Bug 10108 - AS_AC_EXPAND usage breaks hal-device-manager
Summary: AS_AC_EXPAND usage breaks hal-device-manager
Status: RESOLVED FIXED
Alias: None
Product: hal
Classification: Unclassified
Component: build (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: David Zeuthen (not reading bugmail)
QA Contact:
URL: https://bugzilla.novell.com/show_bug....
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-26 22:06 UTC by Andreas Hanke
Modified: 2007-03-04 16:41 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Starting point (967 bytes, patch)
2007-02-26 22:37 UTC, Andreas Hanke
Details | Splinter Review
Even better version of the above patch. (971 bytes, patch)
2007-02-26 22:42 UTC, Andreas Hanke
Details | Splinter Review
Make hal-device-manager independent of AS_AC_EXPAND. (992 bytes, patch)
2007-02-26 23:09 UTC, Andreas Hanke
Details | Splinter Review

Description Andreas Hanke 2007-02-26 22:06:22 UTC
If configure was generated with autoconf >= 2.60 and is run without --datadir argument, AS_AC_EXPAND will fail to expand $(datadir), the pseudo-expanded value is $(prefix)/share and this ends up in hal-device-manager, effectively breaking it:

sys.path.append('${prefix}/share/hal/device-manager')
gtk.glade.bindtextdomain('hal', '${prefix}/share/locale')
DATADIR = "${prefix}/share/hal/device-manager"

(Note the *literal* instance of ${prefix}, not its value)

I did a long analysis of this in https://bugzilla.novell.com/show_bug.cgi?id=210297 and have been told that this would be fixed by removing hal-device-manager, but hal-device-manager is still there and still broken.

In the above Novell Bugzilla report, I've posted an easy solution that makes hal-device-manager work: Upgrade from AS_AC_EXPAND 0.1.0 to 0.2.0.

This is the easy fix, but the proper fix is to remove all traces of it from the codebase because it's just broken. Proper expansion and definition of directory variables has to be done from the Makefiles, not from configure - please see:

http://www.gnu.org/software/autoconf/manual/html_node/Defining-Directories.html
Comment 1 Andreas Hanke 2007-02-26 22:14:12 UTC
The easy, but incorrect fix is https://bugzilla.novell.com/attachment.cgi?id=105866
Comment 2 Andreas Hanke 2007-02-26 22:37:30 UTC
Created attachment 8868 [details] [review]
Starting point

This preliminary and self-contained patch can be seen as a starting point to get rid of AS_AC_EXPAND.

haldaemon.in is a shell script, so there's no need to expand the variables. If you want to get rid of AS_AC_EXPAND, just recode all shell scripts like this.
Comment 3 Andreas Hanke 2007-02-26 22:42:46 UTC
Created attachment 8869 [details] [review]
Even better version of the above patch.
Comment 4 Andreas Hanke 2007-02-26 23:09:16 UTC
Created attachment 8870 [details] [review]
Make hal-device-manager independent of AS_AC_EXPAND.

This patch, also self-contained, demonstrates how to properly expand variables in files which are not shell scripts, and by the way makes hal-device-manager independent of the broken AS_AC_EXPAND semantics.

For languages other than sh, perl, make and such, the trick with having the language interpreter expand the variables at runtime does not work, but fortunately make supports it, so let make do it and use sed to write it into arbitrary files.

I'm not going to work on more such patches now; the direction should be clear. After fixing all instances of similar things among the whole codebase, AS_AC_EXPAND will no longer be necessary and can be removed.
Comment 5 Andreas Hanke 2007-02-28 21:09:39 UTC
Btw. it is known since 3 years that this macro is broken:

https://mail.comedi.org/pipermail/comedi/2004-March/005611.html

And yet it is still present in all kinds of open source projects :-(


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.