* RE: Problem in configure
@ 2008-10-13 11:33 James Shewey
0 siblings, 0 replies; 5+ messages in thread
From: James Shewey @ 2008-10-13 11:33 UTC (permalink / raw)
To: The development of GRUB 2
Ahh. That makes sense. Interesting bit of history there. The x in the left side of the evuation is what threw me. I didn't think that would even be legal syntactically, but those explanations make a lot of sense.
- James
-----Original Message-----
From: Christian Franke <Christian.Franke@t-online.de>
Sent: Monday, October 13, 2008 3:38 AM
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: Problem in configure
Clemens Helfmeier wrote:
> This is a shell thing. It just ensures that the evaluation does not
> result in if test = xno; then
> (in case the variable is empty) and thus throw an error. with "x" it
> its like this for an empty variable
> if test x = xno; then
> which would work fine for shells.
>
BTW: This is not necessary if the expanded argument is quoted like in
the original example.
Instead of
test "x$foo" = "xno"
it is OK to use:
test "$foo" = "no"
or
test "$foo" = no
which is IMO more easy to read. For an unset/empty variable, this
expands to
test "" = no
which does not throw an error.
The leading 'x' was probably necessary for very ancient shells with
broken evaluation of quoted empty argument.
[The entire original message is not included]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Problem in configure
@ 2008-10-13 0:29 James Shewey
2008-10-13 1:08 ` James Shewey
0 siblings, 1 reply; 5+ messages in thread
From: James Shewey @ 2008-10-13 0:29 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 243 bytes --]
I believe that line 6938, which reads:
if test "x$grub_cv_prog_target_cc" = xno; then
May contain an error. Perhaps this should read
if test "$grub_cv_prog_target_cc" = xno; then
or
if test "$grub_cv_prog_target_cc" = no; then
?
-James
[-- Attachment #2: Type: text/html, Size: 354 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Problem in configure
2008-10-13 0:29 James Shewey
@ 2008-10-13 1:08 ` James Shewey
2008-10-13 6:56 ` Clemens Helfmeier
0 siblings, 1 reply; 5+ messages in thread
From: James Shewey @ 2008-10-13 1:08 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 727 bytes --]
This may be a nevermind situation. I was compiling on a 64 bit system.
Changing the line described to if test "$grub_cv_prog_target_cc" = xno;
then" Resulted in an error stating that neither start or _start was defined.
This led me to the following post:
http://bbs.archlinux.org/viewtopic.php?id=56033. This led me to try
compiling on my 32 bit system which worked just fine.
On Sun, Oct 12, 2008 at 8:29 PM, James Shewey <jdshewey@gmail.com> wrote:
> I believe that line 6938, which reads:
>
> if test "x$grub_cv_prog_target_cc" = xno; then
>
> May contain an error. Perhaps this should read
>
> if test "$grub_cv_prog_target_cc" = xno; then
>
> or
>
> if test "$grub_cv_prog_target_cc" = no; then
>
> ?
>
> -James
>
>
>
>
[-- Attachment #2: Type: text/html, Size: 1163 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Problem in configure
2008-10-13 1:08 ` James Shewey
@ 2008-10-13 6:56 ` Clemens Helfmeier
2008-10-13 7:38 ` Christian Franke
0 siblings, 1 reply; 5+ messages in thread
From: Clemens Helfmeier @ 2008-10-13 6:56 UTC (permalink / raw)
To: The development of GRUB 2
Hi James,
This is a shell thing. It just ensures that the evaluation does not result in
if test = xno; then
(in case the variable is empty) and thus throw an error. with "x" it its like
this for an empty variable
if test x = xno; then
which would work fine for shells.
The x does not affect the result of the evaluation since it is on both sides of
the evaluation.
Bye,
Clemens
On Sun, Oct 12, 2008 at 09:08:09PM -0400, James Shewey wrote:
> This may be a nevermind situation. I was compiling on a 64 bit system.
> Changing the line described to if test "$grub_cv_prog_target_cc" = xno;
> then" Resulted in an error stating that neither start or _start was defined.
> This led me to the following post:
> http://bbs.archlinux.org/viewtopic.php?id=56033. This led me to try
> compiling on my 32 bit system which worked just fine.
>
> On Sun, Oct 12, 2008 at 8:29 PM, James Shewey <jdshewey@gmail.com> wrote:
>
> > I believe that line 6938, which reads:
> >
> > if test "x$grub_cv_prog_target_cc" = xno; then
> >
> > May contain an error. Perhaps this should read
> >
> > if test "$grub_cv_prog_target_cc" = xno; then
> >
> > or
> >
> > if test "$grub_cv_prog_target_cc" = no; then
> >
> > ?
> >
> > -James
> >
> >
> >
> >
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Problem in configure
2008-10-13 6:56 ` Clemens Helfmeier
@ 2008-10-13 7:38 ` Christian Franke
0 siblings, 0 replies; 5+ messages in thread
From: Christian Franke @ 2008-10-13 7:38 UTC (permalink / raw)
To: The development of GRUB 2
Clemens Helfmeier wrote:
> This is a shell thing. It just ensures that the evaluation does not
> result in if test = xno; then
> (in case the variable is empty) and thus throw an error. with "x" it
> its like this for an empty variable
> if test x = xno; then
> which would work fine for shells.
>
BTW: This is not necessary if the expanded argument is quoted like in
the original example.
Instead of
test "x$foo" = "xno"
it is OK to use:
test "$foo" = "no"
or
test "$foo" = no
which is IMO more easy to read. For an unset/empty variable, this
expands to
test "" = no
which does not throw an error.
The leading 'x' was probably necessary for very ancient shells with
broken evaluation of quoted empty argument.
Even using the 'x' to avoid quoting is dangerous. It works for empty
variables, but throws an error if the variable contains spaces, e.g:
foo="one two"
test x$foo = xno
result:
test xone two = xno
bash: test: too many arguments
Regards,
Christian
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-10-13 11:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-13 11:33 Problem in configure James Shewey
-- strict thread matches above, loose matches on Subject: below --
2008-10-13 0:29 James Shewey
2008-10-13 1:08 ` James Shewey
2008-10-13 6:56 ` Clemens Helfmeier
2008-10-13 7:38 ` Christian Franke
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.