Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Mar 2000 01:59:03 +0100 (CET)
From:      Matthias Buelow <mkb@altair.mayn.de>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/17480: m4 changecom doesn't work as documented
Message-ID:  <200003190059.BAA05378@altair.mayn.de>

next in thread | raw e-mail | index | archive | help

>Number:         17480
>Category:       bin
>Synopsis:       m4 changecom doesn't work as documented
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar 18 17:00:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Matthias Buelow
>Release:        FreeBSD 3.3-STABLE i386
>Organization:
nil
>Environment:

FreeBSD altair.mayn.de 3.3-STABLE FreeBSD 3.3-STABLE #4: Wed Mar  8 22:02:50 CET 2000     root@altair.mayn.de:/usr/src/sys/compile/ALTAIR  i386

>Description:

The m4 program is a general purpose macro processor.
Its "changecom" command allows the user to change the comment-start
and end sequences.  Quote from the manpage:

     changecom       Change the start and end comment sequences.  The default
                     is the pound sign `#' and the newline character.  With no
                     arguments comments are turned off.  The maximum length
                     for a comment marker is five characters.

which doesn't work at all in the m4 shipped with FreeBSD.
System V m4 and Gnu m4 work that way, though.
An example (the first line of a pair is always typed, the second
is what m4 prints to stdout):

$ m4
changecom

# dnl asdf
# dnl asdf

as you can see the comment chars are still effective although
according to the manpage there should be no comments at all now
and the output should be

# dnl asdf
#

A quick look at the code showed that changecom without arguments
actually resets the comment chars to their compile-time defaults.

Setting comment characters to more than one char isn't possible
either (I don't know who wrote the manpage but certainly not the
person who did the implementation):

changecom(`/*', `*/')

/* dnl adsf */
/* 

which is also wrong, it should display

/* dnl asdf */
/* dnl asdf */

The problem above is that m4 actually only takes the first character
of the comment string.

>How-To-Repeat:

See above.  Look at m4's eval.c dochc() function and you'll see
that it was never intended to do what the manpage says.
However, since the behaviour described by the manpage seems to
be the case with "other" m4s (as found on System V, Digital Unix and
with Gnu m4) I suggest implementing the missing functionality.
Maybe a general code inspection will reveal some other "missing"
things.

>Fix:

I'm quite busy and can't cough up a patch currently.
As a workaround, you can install Gnu m4 from the ports collection.


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200003190059.BAA05378>