Skip to contentSkip to conversation

Build fix for 64bit

PATCH In review Christoph Egger 2 participants 2 messages Jun 3, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Build fix for 64bit

Hi!

The sh manpage for option -e says:

-e errexit If not interactive, exit immediately if any
untested command fails. The exit status of a com- mand is considered to be explicitly tested if the command is used to control an if, elif, while, or until; or if the command is the left hand operand of an ``&&'' or ``||'' operator.

In short, the statement

test -x /usr/xpg4/bin/sed

fails on NetBSD (directory xpg4 does not exist) and aborts build process immediately. Attached patch fixes this.

Signature · 12 lines
AMD Saxony, Dresden, Germany
Operating System Research Center

Legal Information:
AMD Saxony Limited Liability Company & Co. KG
Sitz (Geschäftsanschrift):
   Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland
Registergericht Dresden: HRA 4896
vertretungsberechtigter Komplementär:
   AMD Saxony LLC (Sitz Wilmington, Delaware, USA)
Geschäftsführer der AMD Saxony LLC:
   Dr. Hans-R. Deppe, Thomas McCoy
xen/tools/get-fields.sh +3 -1
diff -r 5603534c62f9 xen/tools/get-fields.sh
@@ -2,7 +2,9 @@ set -ef
 set -ef
 
 SED=sed
-test -x /usr/xpg4/bin/sed && SED=/usr/xpg4/bin/sed
+if test -x /usr/xpg4/bin/sed; then
+	SED=/usr/xpg4/bin/sed
+fi
 
 get_fields ()
 {

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

Christoph Egger writes ("[Xen-devel] [PATCH][XEN] Build fix for 64bit"):

Quoted 10 lines

The sh manpage for option -e says:

-e errexit If not interactive, exit immediately if
any untested command fails. The exit status of a com- mand is considered to be explicitly tested if the command is used to control an if, elif, while, or until; or if the command is the left hand operand of an ``&&'' or ``||'' operator.

This description isn't quite relevant for the code fragment

Quoted 1 line

-test -x /usr/xpg4/bin/sed && SED=/usr/xpg4/bin/sed

since here test _is_ the left hand operand of &&.

But I think that NetBSD's behaviour here is arguably defensible, because an alternative reasonable interpretation of a && b in the context of set -e is that _both_ commands must succeed.

On the other hand, NetBSD's behaviour is not according to its own documentation and also in contravention of SuSv3, whose section
http://www.opengroup.org/onlinepubs/009695399/utilities/set.html
says about set -e:
if a simple command fails for any of the reasons listed in Consequences of Shell Errors or returns an exit status value >0, and is not part of the compound list following a while, until, or if keyword, and is not a part of an AND or OR list
and of course test' is a simple command' as defined.

So I think your patch should be applied to Xen but you should also report a bug to NetBSD, for them to fix either their documentation or their code.

Ian.