bug-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to check for perl or usable printf tools?


From: Simon Josefsson
Subject: Re: How to check for perl or usable printf tools?
Date: Mon, 12 Sep 2022 11:04:58 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Erik Auerswald <auerswal@unix-ag.uni-kl.de> writes:

> I am trying to use the reported input file that crashes tftp for the test.
> This file contains non-printable characters (i.e., it is a "binary" file).
> I do not want to add this binary file as-is to the git repository.

Why?  I don't see anything fundamentally wrong with commiting a binary
fuzz file that trigger som particular bad behaviour.

> Thus I want to create the contents with some widely available tool from
> some description, e.g., hexadecimal byte values.

Awk or ed?

Or 'od'?

> One possibility is printf.  It seems to me as if printf(1) is not yet used
> in GNU Inetutils.  Both the Bash builtin version and the GNU Coreutils
> version of printf support "\xHH" in the format string.  But the Debian
> Almquist Shell (dash) builtin printf does not, at least not in dash
> version 0.5.8-2.10.  The "\xHH" escape sequence is not specified by POSIX.
> (Perhaps I could use octal instead of hexadecimal, since that is specified
> by POSIX, and the printf built into dash supports it.)  Thus we would
> need to check for a usable printf implementation first.  But Autoconf
> does not seem to contain such a macro (I did not see "AC_PROG_PRINTF"
> in the documentation).

If printf is already a fragile tool for this, it sounds like it will
cause problems.

> Another possibility is perl.  Perl is already used in GNU Inetutils,
> for the "bootstrap" script and for "whois".  I did not see an obvious
> perl check in Autoconf (i.e., no "AC_PROG_PERL") in the documentation.
> The test script would need to test if perl is available to avoid a false
> positive test result with broken tftp.

It is only required for developers and 'make dist', isn't it?

> I think I'll just hack something together with printf and octal escape
> sequences, but I would prefer a "proper" Autoconf-based approach.
> Help with Autoconf would be appreciated.

I can help with it, but sounds like it would be nice to settle on a
solution we believe is portable first.

Maybe 'perl' is actually the simplest, and the self-test should SKIP
when perl isn't available?

/Simon

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]