bug-gnulib
[Top][All Lists]
Advanced

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

Re: serial number format


From: Bruno Haible
Subject: Re: serial number format
Date: Thu, 04 Apr 2024 12:45:33 +0200

Sam James wrote:
> For reasons once might be able to guess, I'm currently playing with
> "known" M4 macros vs unseen serials and such.
> 
> At the moment, my tool uses the format described at
> https://www.gnu.org/software/automake/manual/html_node/Serials.html.
> 
> My reading of it implies that the use in e.g. m4/build-to-host.m4
> as '# build-to-host.m4 serial 3' isn't valid (I would expect "# serial 3
> build-to-host.m4" or similar, closest analogue).
> 
> If I grep for serial in gnulib, I see a mix of both the format I
> expected and this other format which uses the macro name too.
> 
> Are both formats valid (I know it's largely a convention)?

The handling of the 'serial' lines happens in $PREFIX/bin/aclocal,
lines 149..151:

  # Match a serial number.
  my $serial_line_rx = '^#\s*serial\s+(\S*)';
  my $serial_number_rx = '^\d+(?:\.\d+)*$';

and lines 604..709. This means, the format is a line that starts
with '#', followed by optional whitespace, then the word 'serial',
then some whitespace, then some consecutive non-whitespace characters.
The latter must consist only of digits and dots and start with a digit
(see also the error message at line 611:
  "expecting a version string with only digits and dots").

So, a line
  # build-to-host.m4 serial 3
has no effect.

The format with fractional digits is, of course, useful for git branches,
where we can have
  # serial 4.1
if on the 'master' branch the serial 4 and 5 already exist.

> Is there a
> reason for the apparent inconsistency in format used within e.g. gnulib?

Yes: In some cases (see $PREFIX/bin/aclocal, lines 910..936) the generated
aclocal.m4 file does not contain a reference to the .m4 file but its entire
contents. In order to make it clear which .m4 file is where in the aclocal.m4
file, I added a comment indicating the original file name. But having not
read the Automake documentation, I thought I could merge it with the 'serial'
line...

> I'll inevitably have to try deal with both formats as they will be in
> the wild anyway, but got curious ;)

No, you need to deal only with the valid format, not with the ineffective one.

I am applying these three patches:


2024-04-04  Bruno Haible  <bruno@clisp.org>

        Add serial numbers to *.m4 files that did not have them.
        * m4/*.m4: Ensure the usual file header with file name and serial
        number.

        Make the file header of *.m4 files consistent:
        1. The file name.
        2. The serial number.
        3. The copyright and license header.
        * m4/*.m4: Adjust file headers.

        Make the serial numbers in *.m4 files effective.
        Reported by Sam James in
        <https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00051.html>.
        * m4/*.m4: Apply sed -e '1s|^# \(.*[.]m4\) serial |# \1\n# serial |'.

Attachment: 0001-Make-the-serial-numbers-in-.m4-files-effective.patch.gz
Description: application/gzip

Attachment: 0002-Make-the-file-header-of-.m4-files-consistent.patch.gz
Description: application/gzip

Attachment: 0003-Add-serial-numbers-to-.m4-files-that-did-not-have-th.patch
Description: Text Data


reply via email to

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