Bug 199442 - Fix find(1) option order
Fix find(1) option order
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: cpanspec (Show other bugs)
rawhide
All Linux
low Severity low
: ---
: ---
Assigned To: Steven Pritchard
Fedora Extras Quality Assurance
: EasyFix, Patch
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-07-19 12:39 EDT by Ville Skyttä
Modified: 2007-11-30 17:11 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-07-19 13:10:39 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Fix find(1) option order (285 bytes, patch)
2006-07-19 12:39 EDT, Ville Skyttä
no flags Details | Diff

  None (edit)
Description Ville Skyttä 2006-07-19 12:39:01 EDT
I just discovered that find(1) doesn't like the order of arguments in the FE
Perl spec template.  The warning goes to /dev/null so it has went unnoticed. 
Reproducer:

$ find /tmp -type d -depth >/dev/null
find: warning: you have specified the -depth option after a non-option argument
-type, but options are not positional (-depth affects tests specified before it
as well as those specified after it).  Please specify options before other
arguments.

I've fixed this in rpmdevtools CVS; fix against cpanspec 1.67 attached.
Comment 1 Ville Skyttä 2006-07-19 12:39:02 EDT
Created attachment 132694 [details]
Fix find(1) option order
Comment 2 Steven Pritchard 2006-07-19 13:10:39 EDT
Thanks.  I've applied the patch to cpanspec in CVS.
Comment 3 Steven Pritchard 2006-09-13 13:14:35 EDT
I just noticed that find has a -empty option.  I wonder if we should be doing this:

find $RPM_BUILD_ROOT -depth -type d -empty -exec rmdir {} \;

(Not redirecting output.)
Comment 4 Ville Skyttä 2006-09-13 13:45:36 EDT
I think the reason -empty is not used is because it's not in POSIX nor LSB (note
how the *.bs check uses -size 0 too).  Not sure of the relevance of that though.

Newer versions of find have also -delete which could be interesting.  And rmdir
has -p and --ignore-fail-on-non-empty, and from the pedantic POV we should
possibly be using find -print0 | xargs -0 (if -delete is not used) and the chmod
would be better off done immediately after make pure_install and DESTDIR
probably works fine nowadays, it could be used instead of PERL_INSTALL_ROOT...

There are quite a few things that could be cleaned up, but I don't know what to
think of that; I haven't heard of anything being actually broken and changes
*could* result in some incompatibilities with old distros which may matter to
some people.  Thoughts?
Comment 5 Steven Pritchard 2006-09-13 14:09:52 EDT
Making everything "perfect" would be great and all, although it probably should
be saved until after FC6 is out.

My thought with using -empty was that it would let us drop the "2>/dev/null",
which would make it harder for problems with that line to be ignored.
Comment 6 Ville Skyttä 2006-09-13 14:29:45 EDT
Yes, I think the -empty stuff is an innocent enough change that could be done
soon (in case the POSIX/LSB issue is a non-issue).  About the other things, I'd
like to keep things compatible with RHEL4 as long as it makes sense, so as far
as I'm personally concerned, the FC6 release does not have a too significant
role wrt. any cosmetic cleanups.

Note You need to log in before you can comment on or make changes to this bug.