Closed Bug 302602 Opened 19 years ago Closed 5 years ago

tests/common/init.sh is not very smart about DOMSUF

Categories

(NSS :: Test, defect, P3)

Other
FreeBSD

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: mi+mozilla, Unassigned)

Details

User-Agent:       Mozilla/5.0 (compatible; Konqueror/3.4; FreeBSD; X11; amd64) KHTML/3.4.1 (like Gecko)
Build Identifier: 

The script tries to figure out the DOMSUF from domainname(1), which returns an 
NIS, instead of the DNS domain. When NIS is not used, the script will fail and 
demand DOMSUF to be set. 
 
When NIS is used, but NIS' domain _differs_ from DNS', the tests will fail as 
other scripts try to glue the hostname back together from $HOST and $DOMSUF. 
 
Most of the time, the DOMSUF can figured out from the hostname. The patch below 
works with BSD's sh (ash) and Linux' sh (bash): 
 
--- tests/common/init.sh	Mon Apr 11 22:24:17 2005 
+++ tests/common/init.sh	Fri Jul 22 16:55:36 2005 
@@ -197,5 +197,6 @@ 
     case $HOST in 
         *\.*) 
-            HOST=`echo $HOST | sed -e "s/\..*//"` 
+	    DOMSUF=${HOST#*.}	# remove Smallest Prefix matching ``*.'' 
+	    HOST=${HOST%%.*}	# remove Largest Suffix ``.*''. See sh(1) 
             ;; 
         ?*) 
 
(mind the whitespace-tab problem, when copy/pasting). 

Reproducible: Always
This patch does not work for Solaris machines. 
$HOST only holds the value for uname -n.

Problem is not with domainname but NIS environments
where the domain name is not the same as the DNS domain
name. (This is a valid NIS configuration.)

The actual fix may be to the documentation with all.sh
or to display a warning for NIS environments that the DNS
domain name is required. (This could be a problem since NIS
environments are not required to have access to DNS or 
match DNS conventions. My guess is such environments are 
actually small.)
Can't the tests be modified not to require functional resolver at all? This is
something outside of the nss' scope anyway...

Would it reduce the test coverage, if all the tests operated on localhost or
(localhost.localdomain)?
My initial analysis shows that DOMSUF is used to build
HOSTADDR as a fully qualified domain name. Looks like
the DOMSUF part could be dropped without any penalties.
This would help NIS clients out.
Assignee: jason.m.reid → nobody
QA Contact: jason.m.reid → test
Priority: -- → P3

This variables are well documented:

Also, the script tests/common/init.sh has enough controls which try to automate the configuration of this variables and exit with a informative message if can't define its value.
https://searchfox.org/mozilla-central/source/security/nss/tests/common/init.sh#386

So, according with documentations informed above, if not work automatically, just set this variables manually to adapt the tests to the testing environment.

QA Contact: mwobensmith
Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.