Colin Watson wrote on 2008-11-18: > I'd much rather live in a world where people use > Gnulib and so are willing to use non-portable functions like > asprintf, canonicalize_file_name, openat, and so on than our current > world which is still full of stupid vulnerabilities due to people > getting sprintf or realpath buffer sizes wrong or race conditions > while traversing directory trees.
Excellent point! I'm including this argument in a new advocacy section in the gnulib manual. 2008-12-06 Bruno Haible <[EMAIL PROTECTED]> Advocacy documentation. * doc/gnulib-intro.texi (Benefits): New section. * doc/gnulib.texi: Update. *** doc/gnulib-intro.texi.orig 2008-12-06 12:56:52.000000000 +0100 --- doc/gnulib-intro.texi 2008-12-06 12:56:07.000000000 +0100 *************** *** 1,3 **** --- 1,37 ---- + @node Benefits + @section Benefits of using Gnulib + + Gnulib is useful to enhance various aspects of a package: + + @itemize @bullet + @item + Portability: With Gnulib, a package maintainer can program against the + POSIX and GNU libc APIs and nevertheless expect good portability to + platforms that don't implement POSIX. + + @item + Maintainability: When a package uses modules from Gnulib instead of code + written specifically for that package, the maintainer has less code to + maintain. + + @item + Security: Gnulib provides functions that are immune against vulnerabilities + that plagues the uses of the corresponding commonplace functions. For + example, @code{asprintf}, @code{canonicalize_file_name} are not affected + by buffer sizing problems that affect @code{sprintf}, @code{realpath}. + @code{openat} does not have the race conditions that @code{open} has. Etc. + + @item + Reliability: Gnulib provides functions that combine a call to a system + function with a check of the result. Examples are @code{xalloc}, + @code{xprintf}, @code{xstrtod}, @code{xgetcwd}. + + @item + Structure: Gnulib offers a way to structure code into modules, typically + one include file, one source code file, and one autoconf macro for each + functionality. Modularity helps maintainability. + @end itemize + @node Library vs Reusable Code @section Library vs. Reusable Code *** doc/gnulib.texi.orig 2008-12-06 12:56:52.000000000 +0100 --- doc/gnulib.texi 2008-12-06 12:34:41.000000000 +0100 *************** *** 78,83 **** --- 78,84 ---- @[EMAIL PROTECTED]<bug-gnulib at gnu dot org>}}. @end macro + @node Introduction @chapter Introduction *************** *** 96,101 **** --- 97,103 ---- @end itemize @menu + * Benefits:: * Library vs Reusable Code:: * Portability and Application Code:: * Modules::