compressdir bug?

Stu Donaldson stu at gtisqr.UUCP
Wed Sep 14 11:59:19 AEST 1988


In article <318 at hawkmoon.MN.ORG> det at hawkmoon.MN.ORG (Derek E. Terveer) writes:
>In article <442 at gt-ford.gtisqr.UUCP>, stu at gtisqr.UUCP (Stu Donaldson) writes:
>> In article <303 at hawkmoon.MN.ORG>, root at hawkmoon.MN.ORG (Admin) writes:
>>
>> > There is a missing `!' just before the -exec in the find.
>
>I don't think so -- your analysis of the command is correct, however perhaps
>this is a case where i may be forced to stick my foot in my mouth and wiggle my
>toes vigoursly... (:-(  I assumed that because it didn't seem to work on MY
>system (uPort V/386 3.0-L2.2) that it was a bug.
>
>I any event this is why i decided to insert the "!" (before the first exec) in
>my copy of compressdir:

>$ ls -l /bin/test
>/bin/test: No such file or directory

Some time after I posted my response, I found that compressdir didn't
work on another of our machines.  Upon investigation, I found that /bin/test
was missing.  Then I recalled, that it was missing missing from the uPort
System V/386 distribution, and I had created my own '/bin/test' to fix
this sort of problem.

I don't know if /bin/test is supposed to be there, and isn't, or if they
just left it off of the V/386 release.

The simple case of the problem is this:

	find . -exec test -r {} \; -print

This will cause find to execute the command 'test -r FILENAME'
for each file it finds.  This will fail, because there is no
command 'test'.  'test' is internal to the shell, and was apparently
not placed in /bin/test.

Placing a '!' in front of the exec part of the 'find' command seems
to me to be definately the wrong way to solve the problem.  You are
relying on the exec command of 'test ...' to fail.

As I said, my solution was to create /bin/test.  Here is a copy,
it is incredibly simple.

	:
	# /bin/test
	if [ $* ]
	then
	  exit 0
	else
	  exit 1
	fi

As you can see, it relies on the test command implimented within
the shell.  I wonder if anyone has brought this up with microport?

>derek
>--
>Derek Terveer		det at hawkmoon.MN.ORG
>			w(612)681-6986	h(612)688-0667
>
>"A proper king is crowned" -- Thomas B. Costain
-- 
Stu Donaldson          UUCP: uw-beaver!uw-nsr!uw-warp!gtisqr!stu
Global Tech Int'l Inc. ARPA: uw-nsr!uw-warp!gtisqr!stu at beaver.cs.washington.edu
Mukilteo WA, 98275     Bell: (206) 742-9111
 PS, use one of the above return addresses, the From field is probably hosed.



More information about the Comp.bugs.sys5 mailing list