iPXE discussion forum
isset always returns true ! - Printable Version

+- iPXE discussion forum (https://forum.ipxe.org)
+-- Forum: iPXE user forums (/forumdisplay.php?fid=1)
+--- Forum: General (/forumdisplay.php?fid=2)
+--- Thread: isset always returns true ! (/showthread.php?tid=8133)



isset always returns true ! - naruto - 2016-07-14 11:38

Hi,

I checkout to compile and run iPXE at the commit

commit bb9961fb548068f769c666970c1de6c68743ed07
Author: Michael Brown <mcb30@ipxe.org>
Date: Tue Jun 26 14:49:26 2012 +0100

[test] Add self-tests for TCP/IP checksum calculation

Signed-off-by: Michael Brown <mcb30@ipxe.org>


However I found the command "isset" always true although the value does not exist and the loop never ends.

#!ipxe
set idx:int32 0
:loop isset ${net${idx}/mac} || goto loop_done
echo net${idx} is a ${net${idx}/chip} with MAC ${net${idx}/mac}
inc idx && goto loop
:loop_done


The problem does not happen with the latest iPXE, could you hep to point out the commit that fixed above issue in old iPXE.

Thanks,
Brs,
Naruto


RE: isset always returns true ! - mcb30 - 2016-07-14 14:03

(2016-07-14 11:38)naruto Wrote:  I checkout to compile and run iPXE at the commit

commit bb9961fb548068f769c666970c1de6c68743ed07
Author: Michael Brown <mcb30@ipxe.org>
Date: Tue Jun 26 14:49:26 2012 +0100


However I found the command "isset" always true although the value does not exist and the loop never ends.

#!ipxe
set idx:int32 0
:loop isset ${net${idx}/mac} || goto loop_done
echo net${idx} is a ${net${idx}/chip} with MAC ${net${idx}/mac}
inc idx && goto loop
:loop_done

You are building a four-year old version of iPXE. The "inc" command does not even exist in the version that you are building. Nor does the ability to place commands on the same line as a loop label.

Use the current version of iPXE.

Michael


RE: isset always returns true ! - naruto - 2016-07-14 15:29

(2016-07-14 14:03)mcb30 Wrote:  
(2016-07-14 11:38)naruto Wrote:  I checkout to compile and run iPXE at the commit

commit bb9961fb548068f769c666970c1de6c68743ed07
Author: Michael Brown <mcb30@ipxe.org>
Date: Tue Jun 26 14:49:26 2012 +0100


However I found the command "isset" always true although the value does not exist and the loop never ends.

#!ipxe
set idx:int32 0
:loop isset ${net${idx}/mac} || goto loop_done
echo net${idx} is a ${net${idx}/chip} with MAC ${net${idx}/mac}
inc idx && goto loop
:loop_done

You are building a four-year old version of iPXE. The "inc" command does not even exist in the version that you are building. Nor does the ability to place commands on the same line as a loop label.

Use the current version of iPXE.

Michael

Hi Michael,

Thanks alot

Ffor "inc" command, I add my own function to increase, it can work. You mean I should add the commit to allow the ability to place commands on the same line as a loop label here: https://git.ipxe.org/ipxe.git/commit/31f5211035cf0434a1b5043f707ecd2316d4a18c

to make it work?


RE: isset always returns true ! - mcb30 - 2016-07-14 15:37

(2016-07-14 15:29)naruto Wrote:  Ffor "inc" command, I add my own function to increase, it can work. You mean I should add the commit to allow the ability to place commands on the same line as a loop label here: https://git.ipxe.org/ipxe.git/commit/31f5211035cf0434a1b5043f707ecd2316d4a18c
to make it work?

No, I mean exactly what I said. You should use the current version of iPXE.

Michael