Bug 3185 - testparm exits 0 if it can read the config file regardless of errors
testparm exits 0 if it can read the config file regardless of errors
Status: RESOLVED FIXED
Product: Samba 3.0
Classification: Unclassified
Component: Config Files
3.0.9
x86 Linux
: P3 normal
: none
Assigned To: Karolin Seeger
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-10-17 15:56 UTC by Seth Alford
Modified: 2010-12-13 08:59 UTC (History)
2 users (show)

See Also:


Attachments
return false on EOF (503 bytes, patch)
2010-12-03 12:45 UTC, Holger Hetterich
no flags Details
Patch for v3-5-test (834 bytes, patch)
2010-12-04 11:26 UTC, Holger Hetterich
jra: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Seth Alford 2005-10-17 15:56:22 UTC
The testparm(1) man page says:

       If  testparm  finds  an error in the  smb.conf file it returns an exit
       code of 1 to the calling program, else it returns an exit code  of  0.
       This allows shell scripts to test the output from testparm.

Yet when I try running testparm on invalid files, it exits with 0.  E.g.:

       testparm /bin/cat

produces the following output (cut and pasted from another window:)

$ testparm -s -x /bin/cat
Load smb config files from /bin/cat
params.c:Parameter() - Unexpected end-of-file at: ELF
Loaded services file OK.
# Global parameters
[global]
$ echo $?
0
$
----end of cut and paste----

I see this on RH 8.0 with the following RH produced samba rpm's:

samba-common-2.2.7-4.8.0
samba-swat-2.2.7-4.8.0
samba-client-2.2.7-4.8.0
samba-2.2.7-4.8.0

and on Fedora Core 3 with the following RH produced samba rpm's:

samba-client-3.0.10-1.fc3
samba-common-3.0.10-1.fc3
system-config-samba-1.2.28-0.fc3.1
samba-swat-3.0.10-1.fc3
samba-3.0.10-1.fc3

I did check over at RedHat's bugzilla, but did not find this
bug reported there, either.
Comment 1 Holger Hetterich 2010-12-03 12:45:43 UTC
Created attachment 6103 [details]
return false on EOF
Comment 2 Holger Hetterich 2010-12-03 12:50:15 UTC
The comment says:
/* Shouldn't have EOF within param name. */

Isn't this a have-to-be error situation where it's fine to return false? Please see comment#1.
Comment 3 Jeremy Allison 2010-12-03 18:46:02 UTC
Pushed to v3-6-test and master. Holger, do you think this belongs in 3.5.7 ?
Jeremy.
Comment 4 Holger Hetterich 2010-12-04 11:26:14 UTC
Created attachment 6108 [details]
Patch for v3-5-test

Yes Jeremy, I've attached a patch for cherry-picking to v3-5-test.
Comment 5 Jeremy Allison 2010-12-06 11:44:54 UTC
Comment on attachment 6108 [details]
Patch for v3-5-test

+1 from me.
Comment 6 Jeremy Allison 2010-12-06 11:45:18 UTC
Re-assigning to Karolin for inclusion in 3.5.next.
Jeremy.
Comment 7 Karolin Seeger 2010-12-13 08:59:02 UTC
Pushed to v3-5-test.
Closing out bug report.

Thanks!