[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mtree exit code



On Tue, Dec 28, 2004 at 04:40:59PM -0500, Roy Morris wrote:
> 
> I think mtree is exiting with the wrong error code. 
> 
> Here is what the man page says .. 
>      The mtree utility exits with a status of 0 on success, 1 if any error oc-
>      curred, and 2 if the file hierarchy did not match the specification.  A
>      status of 2 is converted to a status of 0 if the -U option is used.
> 
> here is what I did as a test .. 
> cd /sbin
> # mtree -ck md5digest,cksum,uid,gid,nlink,mode,type >/root/sbin.mtree
> # mtree </root/sbin.mtree
> # touch /sbin/roy.txt
> # mtree </root/sbin.mtree
> extra: roy.txt
> # echo $?
> 0
> 

i think you're correct that sth is not right...

poking around a bit, this seems to happen if *either* the `time' keyword
is not specified, *or* extra() in verify.c is the last routine to return.

that is,

	# mtree -ck md5digest,cksum,uid,gid,nlink,mode,type,time

seems to work ok, or if there is another change in the hierarchy (not
just an added file) e.g. i alter a file and the md5 check comes after
the extra() check, it works ok too.

i guess sth is not setting the return value correctly.

jmc