module-init-tools-3.2.1

2005-11-21 Thread Matthew Burgess

Hi folks,

There's a minor issue with the Makefile in this version.

Essentially, if one uses the current '--prefix=' then the following 
ends up in the logs:


/bin/sh: line 0: [: =: unary operator expected

That's caused by:

Makefile:71: if [ $(prefix) = / ]

In this case, $(prefix) will obviously = , hence the test doesn't get 
a condition on the left-hand side.  Additionally, that test failing 
results in the manpages being installed to /share/man instead of 
/usr/share/man.  Now, we can fix this in a couple of ways:


1) ./configure --prefix=/ --enable-zlib - though this results in 
things being logged as being installed in '//sbin' '//bin', etc.  Not 
overly important as they obviously get installed in the right place.


2) ./configure --prefix= --mandir=/usr/share/man --enable-zlib - this 
causes us to skip the failing test, and no '//' appear in the logs.


3) Change the Makefile to do the following test instead:

if [ $(prefix) = / -o $(prefix) =  ];

This way we protect against a blank $(prefix) and additionally make sure 
that such a prefix will result in man pages going into the correct 
/usr/share/man hierarchy.


I've a preference for option 3) in the long-term but put 2) in the book 
for the time being until the patch for 2 is submitted, accepted and in 
an upstream release.


Are there any options I've missed or does anyone have a different 
preference?


Regards,

Matt.
--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page


Re: module-init-tools-3.2.1

2005-11-21 Thread Archaic
On Mon, Nov 21, 2005 at 09:22:27PM +, Matthew Burgess wrote:
 
 I've a preference for option 3) in the long-term but put 2) in the book 
 for the time being until the patch for 2 is submitted, accepted and in 
 an upstream release.

Since option 3, or some other fix decided upon by upstream is the only
correct long term solution, I think it would be best to follow suit lest
we forget to change the configure line next time this package is updated
(and it does seem to have a rather long release cycle which adds to our
forgetfulness).

-- 
Archaic

Want control, education, and security from your operating system?
Hardened Linux From Scratch
http://www.linuxfromscratch.org/hlfs

-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page


Re: module-init-tools-3.2.1

2005-11-21 Thread M.Canales.es
El Lunes, 21 de Noviembre de 2005 22:22, Matthew Burgess escribió:

 3) Change the Makefile to do the following test instead:

 if [ $(prefix) = / -o $(prefix) =  ];

Try this:

if [ x$(prefix) = x/ ]

That is recommended way to test varaibles when you aren't sure that it allways 
have an asigned value.


-- 
Manuel Canales Esparcia
Usuario de LFS nº2886:   http://www.linuxfromscratch.org
LFS en castellano: http://www.escomposlinux.org/lfs-es http://www.lfs-es.com
TLDP-ES:   http://es.tldp.org
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page


Re: module-init-tools-3.2.1

2005-11-21 Thread Jeremy Byron

Matthew Burgess wrote:

Hi folks,

There's a minor issue with the Makefile in this version.

Essentially, if one uses the current '--prefix=' then the following 
ends up in the logs:


/bin/sh: line 0: [: =: unary operator expected

That's caused by:

Makefile:71: if [ $(prefix) = / ]

In this case, $(prefix) will obviously = , hence the test doesn't get 
a condition on the left-hand side.  Additionally, that test failing 
results in the manpages being installed to /share/man instead of 
/usr/share/man.  Now, we can fix this in a couple of ways:

snip
3) Change the Makefile to do the following test instead:

if [ $(prefix) = / -o $(prefix) =  ];

snip
This should still give the 'unary operator expected' message, I would think.

In order to protect against '$(prefix) = /' failing, don't you need to 
test the null case first?


if [ $(prefix) =  -o $(prefix) = / ];

This way, assuming sh skips further OR cases when the first succeeds (as 
it should), you won't get the above error because '$(prefix) = /' is 
never reached.  I've never really looked into sh scripting, so I'm not 
certain this applies, but it's something for you to consider.


In any case, I think going directly to option 3 is the best route.

Regards,
Jeremy.
--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page


Re: module-init-tools-3.2.1

2005-11-21 Thread Matthew Burgess

Jeremy Byron wrote:

Matthew Burgess wrote:


3) Change the Makefile to do the following test instead:

if [ $(prefix) = / -o $(prefix) =  ];


This should still give the 'unary operator expected' message, I would 
think.


Nope, for once I did actually test this before proposing it :-)

In order to protect against '$(prefix) = /' failing, don't you need to 
test the null case first?


if [ $(prefix) =  -o $(prefix) = / ];


Nope, what happens is in the current Makefile, the $(prefix) gets 
expanded as follows:


if [ = / ]; # hence the unary operator error

With the fix, $(prefix) gets expanded as follows:

if [  = / ]; # now we've got two operators, so `sh' is happy


In any case, I think going directly to option 3 is the best route.


Yep, I'm preparing a patch as we speak, to test the waters with upstream.

Thanks,

Matt.
--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page


Re: module-init-tools-3.2.1

2005-11-21 Thread Matthew Burgess

M.Canales.es wrote:

El Lunes, 21 de Noviembre de 2005 22:22, Matthew Burgess escribió:



3) Change the Makefile to do the following test instead:

if [ $(prefix) = / -o $(prefix) =  ];



Try this:

if [ x$(prefix) = x/ ]

That is recommended way to test varaibles when you aren't sure that it allways 
have an asigned value.


Yes, but we also have to test for x$(prefix) = x otherwise mandir 
isn't set correctly.  Here's the full decision tree with $(prefix) expanded:


if [ /man = /man ]; then
  if [  = / ]; then
echo /usr/share/man;
  else
echo /share/man;
  fi;
else
  echo /man;
fi;

Note that we fail the second test, hence setting mandir=/share/man.  If 
we change the second test to:


if [  = / -o  =  ];

we end up setting $(mandir) to /usr/share/man whether prefix is  or 
/ on the command line.


Regards,

Matt.
--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page