source: chapter08/bash.xml

trunk
Last change on this file was 4816dc6, checked in by Xi Ruoyao <xry111@…>, 3 months ago

bash: Really pass through the return code

We want expect to return the return code of "make test" (stored in
$value), but $value is expanded too early to nothing by Bash. Quote EOF
so Bash won't expand $xxx.

  • Property mode set to 100644
File size: 5.9 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../general.ent">
5 %general-entities;
6]>
7
8<sect1 id="ch-system-bash" role="wrap">
9 <?dbhtml filename="bash.html"?>
10
11 <sect1info condition="script">
12 <productname>bash</productname>
13 <productnumber>&bash-version;</productnumber>
14 <address>&bash-url;</address>
15 </sect1info>
16
17 <title>Bash-&bash-version;</title>
18
19 <indexterm zone="ch-system-bash">
20 <primary sortas="a-Bash">Bash</primary>
21 </indexterm>
22
23 <sect2 role="package">
24 <title/>
25
26 <para>The Bash package contains the Bourne-Again Shell.</para>
27
28 <segmentedlist>
29 <segtitle>&buildtime;</segtitle>
30 <segtitle>&diskspace;</segtitle>
31
32 <seglistitem>
33 <seg>&bash-fin-sbu;</seg>
34 <seg>&bash-fin-du;</seg>
35 </seglistitem>
36 </segmentedlist>
37
38 </sect2>
39
40 <sect2 role="installation">
41 <title>Installation of Bash</title>
42
43 <para>First, fix some issues identified upstream:</para>
44
45<screen><userinput remap="pre">patch -Np1 -i ../&bash-upstream-fixes-patch;</userinput></screen>
46
47 <para>Prepare Bash for compilation:</para>
48
49 <screen><userinput remap="configure">./configure --prefix=/usr \
50 --without-bash-malloc \
51 --with-installed-readline \
52 --docdir=/usr/share/doc/bash-&bash-version;</userinput></screen>
53
54 <variablelist>
55 <title>The meaning of the new configure option:</title>
56
57 <varlistentry>
58 <term><parameter>--with-installed-readline</parameter></term>
59 <listitem>
60 <para>This option tells Bash to use the <filename
61 class="libraryfile">readline</filename> library that is already
62 installed on the system rather than using its own readline
63 version.</para>
64 </listitem>
65 </varlistentry>
66
67 </variablelist>
68
69 <para>Compile the package:</para>
70
71<screen><userinput remap="make">make</userinput></screen>
72
73 <para>Skip down to <quote>Install the
74 package</quote> if not running the test suite.</para>
75
76 <para>To prepare the tests, ensure that the <systemitem class="username">tester</systemitem> user can write to the sources tree:</para>
77
78<screen><userinput remap="test">chown -R tester .</userinput></screen>
79
80 <para>The test suite of this package is designed to be run as a non-&root;
81 user who owns the terminal connected to standard input. To satisfy the
82 requirement, spawn a new pseudo terminal using
83 <application>Expect</application> and run the tests as the <systemitem
84 class="username">tester</systemitem> user:</para>
85
86<screen><userinput remap="test">su -s /usr/bin/expect tester &lt;&lt; "EOF"
87set timeout -1
88spawn make tests
89expect eof
90lassign [wait] _ _ _ value
91exit $value
92EOF</userinput></screen>
93
94 <para>The test suite uses <command>diff</command> to detect the
95 difference between test script output and the expected output. Any
96 output from <command>diff</command> (prefixed with
97 <computeroutput>&lt;</computeroutput> and
98 <computeroutput>&gt;</computeroutput>) indicates a test failure, unless
99 there is a message saying the difference can be ignored.
100 <!-- Some host distros set core file size hard limit < 1000, then the
101 test "ulimit -c -S 1000" attempts to set soft limit > hard limit
102 and fail. -->
103 One test named <filename>run-builtins</filename> is known to fail on
104 some host distros with a difference on the first line of the
105 output.</para>
106
107 <para>Install the package:</para>
108
109<screen><userinput remap="install">make install</userinput></screen>
110
111 <para>Run the newly compiled <command>bash</command> program (replacing the one that is
112 currently being executed):</para>
113
114 <screen role="nodump"><userinput>exec /usr/bin/bash --login</userinput></screen>
115
116 </sect2>
117
118 <sect2 id="contents-bash" role="content">
119 <title>Contents of Bash</title>
120
121 <segmentedlist>
122 <segtitle>Installed programs</segtitle>
123 <segtitle>Installed directory</segtitle>
124
125 <seglistitem>
126 <seg>bash, bashbug, and sh (link to bash)</seg>
127 <seg>/usr/include/bash, /usr/lib/bash, and
128 /usr/share/doc/bash-&bash-version;</seg>
129 </seglistitem>
130 </segmentedlist>
131
132 <variablelist>
133 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
134 <?dbfo list-presentation="list"?>
135 <?dbhtml list-presentation="table"?>
136
137 <varlistentry id="bash">
138 <term><command>bash</command></term>
139 <listitem>
140 <para>A widely-used command interpreter; it performs many types of
141 expansions and substitutions on a given command line before executing
142 it, thus making this interpreter a powerful tool</para>
143 <indexterm zone="ch-system-bash bash">
144 <primary sortas="b-bash">bash</primary>
145 </indexterm>
146 </listitem>
147 </varlistentry>
148
149 <varlistentry id="bashbug">
150 <term><command>bashbug</command></term>
151 <listitem>
152 <para>A shell script to help the user compose and mail standard
153 formatted bug reports concerning <command>bash</command></para>
154 <indexterm zone="ch-system-bash bashbug">
155 <primary sortas="b-bashbug">bashbug</primary>
156 </indexterm>
157 </listitem>
158 </varlistentry>
159
160 <varlistentry id="sh">
161 <term><command>sh</command></term>
162 <listitem>
163 <para>A symlink to the <command>bash</command> program; when invoked
164 as <command>sh</command>, <command>bash</command> tries to mimic the
165 startup behavior of historical versions of <command>sh</command> as
166 closely as possible, while conforming to the POSIX standard as
167 well</para>
168 <indexterm zone="ch-system-bash sh">
169 <primary sortas="b-sh">sh</primary>
170 </indexterm>
171 </listitem>
172 </varlistentry>
173
174 </variablelist>
175
176 </sect2>
177
178</sect1>
Note: See TracBrowser for help on using the repository browser.