Thanks for the improvement. I have applied and pushed it in the following modified form (including documentation in the ChangeLog and NEWS files):
commit 74db15e2210178415647411dbdbc31d53cd95fca Author: Bernhard Voelker <[email protected]> Date: Tue Nov 27 00:01:42 2012 +0100 Improve error message for find -type X (X = an unknown file type). * find/parser.c (insert_type): Give a more comprehensible error message when the type letter following -type or -xtype corresponds to a type of file which was unknown on the system which compiled the find binary. * NEWS: Mention this improvement. diff --git a/ChangeLog b/ChangeLog index 8e40f99..5c8aefb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2013-03-24 Bernhard Voelker <[email protected]> + + Improve error message for find -type X (X = an unknown file type). + * find/parser.c (insert_type): Give a more comprehensible error + message when the type letter following -type or -xtype corresponds + to a type of file which was unknown on the system which compiled + the find binary. + * NEWS: Mention this improvement. + 2013-03-24 James Youngman <[email protected]> Fix Savannah bug #38583: errno-buffer read failed in xargs_do_exec diff --git a/NEWS b/NEWS index 6c89796..4889e85 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,14 @@ GNU findutils NEWS - User visible changes. -*- outline -*- (allout) * Major changes in release 4.5.12-git, YYYY-MM-DD +** Documentation Changes + +If you use -type or -xtype with a type letter corresponding to a file +type which is not supported by the system on which find was compiled, +find will now give a clearer error message (though the functionality +is unchanged). Type letters are affected are D, l and p (for Solaris +Doors, symbolic links and named pipes respectively). + ** Bug Fixes Some bugs in 4.5.11 were fixed without addinng them to the bug diff --git a/find/parser.c b/find/parser.c index aa01253..18173fb 100644 --- a/find/parser.c +++ b/find/parser.c @@ -2863,30 +2863,50 @@ insert_type (char **argv, int *arg_ptr, type_cell = S_IFREG; rate = 0.95f; break; -#ifdef S_IFLNK case 'l': /* symbolic link */ +#ifdef S_IFLNK type_cell = S_IFLNK; rate = 0.1f; - break; +#else + error (EXIT_FAILURE, 0, + _("-type %c is not supported because symbolic links " + "are not supported on the platform find was compiled on."), + (*typeletter)); #endif -#ifdef S_IFIFO + break; case 'p': /* pipe */ +#ifdef S_IFIFO type_cell = S_IFIFO; rate = 0.01f; - break; +#else + error (EXIT_FAILURE, 0, + _("-type %c is not supported because FIFOs " + "are not supported on the platform find was compiled on."), + (*typeletter)); #endif -#ifdef S_IFSOCK + break; case 's': /* socket */ +#ifdef S_IFSOCK type_cell = S_IFSOCK; rate = 0.01f; - break; +#else + error (EXIT_FAILURE, 0, + _("-type %c is not supported because named sockets " + "are not supported on the platform find was compiled on."), + (*typeletter)); #endif -#ifdef S_IFDOOR + break; case 'D': /* Solaris door */ +#ifdef S_IFDOOR type_cell = S_IFDOOR; rate = 0.01f; - break; +#else + error (EXIT_FAILURE, 0, + _("-type %c is not supported because Solaris doors " + "are not supported on the platform find was compiled on."), + (*typeletter)); #endif + break; default: /* None of the above ... nuke 'em. */ error (EXIT_FAILURE, 0, _("Unknown argument to -type: %c"), (*typeletter));
