[parted-devel] adding infrastructure

Jim Meyering jim at meyering.net
Tue Feb 13 23:14:04 CET 2007


By "infrastructure", I mean the autoconf/automake building blocks
provided by gnulib to help do things more robustly and more portably.

For example,

    parted --help > /dev/full

causes a failed write syscall (you see it with strace),
but there is no diagnostic, and it exits successfully.
Same for --version or anything else that makes parted write to stdout.

I can fix that using gnulib's closeout module by adding
two lines to parted.c:

    #include "closeout.h"

[and near the top of main(),]

    atexit (close_stdout);

That (plus, maybe checking an fflush return code)
ensures that such usage will evoke the expected diagnostic,

    parted: write error: No space left on device

along with nonzero exit status.
-------------------------------------

However, in order to add those two lines to parted.c,
I'd end up adding a bunch of supporting files, from lib/*.[ch]
m4/*.m4, and a couple hooks in configure.ac.  Also probably a
bootstrap script like the one in coreutils.

For examples of this sort of infrastructure, look at coreutils,
bison, GNU m4, diffutils, and a few others.

It should be pretty non-invasive, and since so many other tools
also use gnulib, the few bugs that get into the sources there are
usually shaken out very quickly.

Interested?

Jim



More information about the parted-devel mailing list